Commit c792e281 authored by sun's avatar sun

#316507 by sun: Rewrote Wysiwyg API's internal architecture to support multiple editors.

parent 3a74e9b7
......@@ -6,6 +6,8 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 6.x-x.x, xxxx-xx-xx
---------------------------
#316507 by sun: Rewrote Wysiwyg API's internal architecture to support multiple
editors.
Wysiwyg 6.x-0.3, 2008-09-12
......
This diff is collapsed.
......@@ -119,3 +119,21 @@ function wysiwyg_editor_update_5001() {
return $ret;
}
/**
* Add editor key to wysiwyg profiles.
*/
function wysiwyg_editor_update_6002() {
$ret = array();
$profiles = db_query("SELECT name, settings FROM {wysiwyg_editor_profile}");
while ($profile = db_fetch_object($profiles)) {
$settings = unserialize($profile->settings);
if (!isset($settings['editor'])) {
$settings['editor'] = 'tinymce';
// We can't use update_sql() here because of curly braces in serialized
// array.
db_query("UPDATE {wysiwyg_editor_profile} SET settings = '%s' WHERE name = '%s'", serialize($settings), $profile->name);
}
}
return $ret;
}
......@@ -13,14 +13,14 @@ Drupal.wysiwygEditorInit = function () {
tinyMCE.srcMode = (Drupal.settings.wysiwygEditor.execMode == 'src' ? '_src' : '');
tinyMCE.gzipMode = (Drupal.settings.wysiwygEditor.execMode == 'gzip');
for (var theme in Drupal.settings.wysiwygEditor.configs) {
// Clone so we are not passing by reference. Otherwise the
// settings will get overwritten.
var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[theme]);
for (var theme in Drupal.settings.wysiwygEditor.configs.tinymce) {
// Clone so we are not passing by reference. Otherwise the settings will
// get overwritten.
var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs.tinymce[theme]);
tinyMCE.init(config);
}
for (var plugin in Drupal.settings.wysiwygEditor.plugins) {
tinyMCE.loadPlugin(plugin, Drupal.settings.wysiwygEditor.plugins[plugin]);
for (var plugin in Drupal.settings.wysiwygEditor.plugins.tinymce) {
tinyMCE.loadPlugin(plugin, Drupal.settings.wysiwygEditor.plugins.tinymce[plugin]);
}
}
......@@ -30,8 +30,8 @@ Drupal.wysiwygEditorInit = function () {
* This function can be called to process AJAX-loaded content.
*/
Drupal.wysiwygEditorAttach = function () {
for (var theme in Drupal.settings.wysiwygEditor.configs) {
var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[theme]);
for (var theme in Drupal.settings.wysiwygEditor.configs.tinymce) {
var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs.tinymce[theme]);
// Set configuration options for this theme.
for (var setting in config) {
tinyMCE.settings[setting] = config[setting];
......@@ -55,7 +55,7 @@ Drupal.wysiwygEditorAttach = function () {
*/
Drupal.wysiwygEditorToggle = function (id, theme) {
if (tinyMCE.getEditorId(id) == null) {
var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[theme]);
var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs.tinymce[theme]);
// Set configuration options for this theme.
for (var setting in config) {
tinyMCE.settings[setting] = config[setting];
......
This diff is collapsed.
......@@ -2,183 +2,15 @@
// $Id$
/**
* @file
* Registers TinyMCE plugins for the Drupal TinyMCE module. Note these settings
* can be overridden by each Drupal theme.
*/
/**
* Implementation of hook_wysiwyg_plugin().
*/
function wysiwyg_editor_wysiwyg_plugin($editor) {
$path_wysiwyg = drupal_get_path('module', 'wysiwyg_editor');
function wysiwyg_editor_wysiwyg_plugin($editor, $version) {
switch ($editor) {
case 'tinymce':
$path_editor = $path_wysiwyg .'/tinymce/jscripts/tiny_mce';
return array(
'default' => array(
'path' => $path_editor .'/themes/advanced',
'buttons' => array('bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), 'strikethrough' => t('Strike-through'), 'justifyleft' => t('Align left'), 'justifycenter' => t('Align center'), 'justifyright' => t('Align right'), 'justifyfull' => t('Justify'), 'bullist' => t('Bullet list'), 'numlist' => t('Numbered list'), 'outdent' => t('Outdent'), 'indent' => t('Indent'), 'undo' => t('Undo'), 'redo' => t('Redo'), 'link' => t('Link'), 'unlink' => t('Unlink'), 'anchor' => t('Anchor'), 'image' => t('Image'), 'cleanup' => t('Clean-up'), 'forecolor' => t('Forecolor'), 'backcolor' => t('Backcolor'), 'sup' => t('Sup'), 'sub' => t('Sub'), 'code' => t('Source code'), 'hr' => t('Horizontal rule'), 'cut' => t('Cut'), 'copy' => t('Copy'), 'paste' => t('Paste'), 'visualaid' => t('Visual aid'), 'removeformat' => t('Remove format'), 'charmap' => t('Char map'), 'help' => t('Help')),
'internal' => TRUE,
),
'advhr' => array(
'path' => $path_editor .'/plugins/advhr',
'buttons' => array('advhr' => t('Advanced horizontal rule')),
'extended_valid_elements' => array('hr[class|width|size|noshade]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
'internal' => TRUE,
'load' => TRUE,
),
'advimage' => array(
'path' => $path_editor .'/plugins/advimage',
'extensions' => array('advimage' => t('Advanced image')),
'extended_valid_elements' => array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
'internal' => TRUE,
'load' => TRUE,
),
'advlink' => array(
'path' => $path_editor .'/plugins/advlink',
'extensions' => array('advlink' => t('Advanced link')),
'extended_valid_elements' => array('a[name|href|target|title|onclick]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
'internal' => TRUE,
'load' => TRUE,
),
'autosave' => array(
'path' => $path_editor .'/plugins/autosave',
'extensions' => array('autosave' => t('Auto save')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
'internal' => TRUE,
'load' => TRUE,
),
'contextmenu' => array(
'path' => $path_editor .'/plugins/contextmenu',
'extensions' => array('contextmenu' => t('Context menu')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
'internal' => TRUE,
),
'directionality' => array(
'path' => $path_editor .'/plugins/directionality',
'buttons' => array('ltr' => t('Left-to-right'), 'rtl' => t('Right-to-left')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
'internal' => TRUE,
'load' => TRUE,
),
'emotions' => array(
'path' => $path_editor .'/plugins/emotions',
'buttons' => array('emotions' => t('Emotions')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
'internal' => TRUE,
'load' => TRUE,
),
// 'filemanager' => array(
// 'path' => $path_editor .'/plugins/filemanager',
// 'extensions' => array('filemanager' => t('File manager')),
// 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/filemanager',
// 'internal' => TRUE,
// ),
'flash' => array(
'path' => $path_editor .'/plugins/flash',
'buttons' => array('flash' => t('Flash')),
'extended_valid_elements' => array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash',
'internal' => TRUE,
'load' => TRUE,
),
'font' => array(
'path' => $path_editor .'/plugins/font',
'buttons' => array('formatselect' => t('HTML block format'), 'fontselect' => t('Font'), 'fontsizeselect' => t('Font size'), 'styleselect' => t('Font style')),
'extended_valid_elements' => array('font[face|size|color|style],span[class|align|style]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/font',
'internal' => TRUE,
),
'fullscreen' => array(
'path' => $path_editor .'/plugins/fullscreen',
'buttons' => array('fullscreen' => t('Fullscreen')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
'internal' => TRUE,
'load' => TRUE,
),
// 'imagemanager' => array(
// 'path' => $path_editor .'/plugins/imagemanager',
// 'extensions' => array('imagemanager' => t('Image manager')),
// 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/imagemanager',
// 'internal' => TRUE,
// ),
'inlinepopups' => array(
'path' => $path_editor .'/plugins/inlinepopups',
'extensions' => array('inlinepopups' => t('Inline popups')),
'options' => array(
'dialog_type' => array('modal'),
),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
'internal' => TRUE,
'load' => TRUE,
),
'insertdatetime' => array(
'path' => $path_editor .'/plugins/insertdatetime',
'buttons' => array('insertdate' => t('Insert date'), 'inserttime' => t('Insert time')),
'options' => array(
'plugin_insertdate_dateFormat' => array('%Y-%m-%d'),
'plugin_insertdate_timeFormat' => array('%H:%M:%S'),
),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime',
'internal' => TRUE,
'load' => TRUE,
),
'layer' => array(
'path' => $path_editor .'/plugins/layer',
'buttons' => array('insertlayer' => t('Insert layer'), 'moveforward' => t('Move forward'), 'movebackward' => t('Move backward'), 'absolute' => t('Absolute')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer',
'internal' => TRUE,
'load' => TRUE,
),
'paste' => array(
'path' => $path_editor .'/plugins/paste',
'buttons' => array('pastetext' => t('Paste text'), 'pasteword' => t('Paste from Word'), 'selectall' => t('Select all')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
'internal' => TRUE,
'load' => TRUE,
),
'preview' => array(
'path' => $path_editor .'/plugins/preview',
'buttons' => array('preview' => t('Preview')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',
'internal' => TRUE,
'load' => TRUE,
),
'print' => array(
'path' => $path_editor .'/plugins/print',
'buttons' => array('print' => t('Print')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print',
'internal' => TRUE,
'load' => TRUE,
),
'searchreplace' => array(
'path' => $path_editor .'/plugins/searchreplace',
'buttons' => array('search' => t('Search'), 'replace' => t('Replace')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
'internal' => TRUE,
'load' => TRUE,
),
'style' => array(
'path' => $path_editor .'/plugins/style',
'buttons' => array('styleprops' => t('Style properties')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
'internal' => TRUE,
'load' => TRUE,
),
'table' => array(
'path' => $path_editor .'/plugins/table',
'buttons' => array('tablecontrols' => t('Table')),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
'internal' => TRUE,
'load' => TRUE,
),
'wysiwyg' => array(
'path' => $path_wysiwyg .'/plugins/break',
'path' => drupal_get_path('module', 'wysiwyg_editor') .'/plugins/break',
'buttons' => array('break' => t('Teaser break')),
'url' => 'http://drupal.org/project/wysiwyg',
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment