diff --git a/editors/ckeditor.inc b/editors/ckeditor.inc index 05c8f00..28e0a8c 100644 --- a/editors/ckeditor.inc +++ b/editors/ckeditor.inc @@ -141,6 +141,9 @@ function wysiwyg_ckeditor_settings_form(&$form, &$form_state) { $ckeditor_defaults = array( 'block_formats' => 'p,address,pre,h2,h3,h4,h5,h6,div', + 'toolbarLocation' => 'top', + 'resize_enabled' => TRUE, + 'stylesSet' => '', ); $settings += $ckeditor_defaults; diff --git a/editors/js/tinymce-4.js b/editors/js/tinymce-4.js new file mode 100644 index 0000000..45e95b6 --- /dev/null +++ b/editors/js/tinymce-4.js @@ -0,0 +1,234 @@ +(function($) { + +/** + * Initialize editor instances. + * + * @todo Is the following note still valid for 3.x? + * This function needs to be called before the page is fully loaded, as + * calling tinymce.init() after the page is loaded breaks IE6. + * + * @param editorSettings + * An object containing editor settings for each input format. + */ +Drupal.wysiwyg.editor.init.tinymce = function(settings) { + tinymce.on('active focus', function(e) { + Drupal.wysiwyg.activeId = e.editor.id; + }); + // Fix Drupal toolbar obscuring editor toolbar in fullscreen mode. + var $drupalToolbars = $('#toolbar, #admin-menu', Drupal.overlayChild ? window.parent.document : document); + tinymce.on('AddEditor', function (e) { + e.editor.on('FullscreenStateChanged', function (e) { + if (e.state) { + $drupalToolbars.hide(); + } + else { + $drupalToolbars.show(); + } + }); + }); + + // Initialize editor configurations. + for (var format in settings) { + if (Drupal.settings.wysiwyg.plugins[format]) { + // Load native external plugins. + // Array syntax required; 'native' is a predefined token in JavaScript. + for (var plugin in Drupal.settings.wysiwyg.plugins[format]['native']) { + tinymce.PluginManager.load(plugin, Drupal.settings.wysiwyg.plugins[format]['native'][plugin]); + } + // Load Drupal plugins. + for (var plugin in Drupal.settings.wysiwyg.plugins[format].drupal) { + Drupal.wysiwyg.editor.instance.tinymce.addPlugin(plugin, Drupal.settings.wysiwyg.plugins[format].drupal[plugin], Drupal.settings.wysiwyg.plugins.drupal[plugin]); + } + } + } +}; + +/** + * Attach this editor to a target element. + * + * See Drupal.wysiwyg.editor.attach.none() for a full desciption of this hook. + */ +Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) { + // Configure editor settings for this input format. +// var ed = new tinymce.Editor(params.field, settings); + + // Remove TinyMCE's internal mceItem class, which was incorrectly added to + // submitted content by Wysiwyg <2.1. TinyMCE only temporarily adds the class + // for placeholder elements. If preemptively set, the class prevents (native) + // editor plugins from gaining an active state, so we have to manually remove + // it prior to attaching the editor. This is done on the client-side instead + // of the server-side, as Wysiwyg has no way to figure out where content is + // stored, and the class only affects editing. + $field = $('#' + params.field); + $field.val($field.val().replace(/(<.+?\s+class=['"][\w\s]*?)\bmceItem\b([\w\s]*?['"].*?>)/ig, '$1$2')); + + // Attach editor. + // ed.render(); + settings.selector = '#' + params.field; + tinymce.init(settings); +}; + +/** + * Detach a single or all editors. + * + * See Drupal.wysiwyg.editor.detach.none() for a full desciption of this hook. + */ +Drupal.wysiwyg.editor.detach.tinymce = function (context, params, trigger) { + if (typeof params != 'undefined') { + var instance = tinymce.get(params.field); + if (instance) { + instance.save(); + if (trigger != 'serialize') { + instance.remove(); + } + } + } + else { + // Save contents of all editors back into textareas. + tinymce.triggerSave(); + if (trigger != 'serialize') { + // Remove all editor instances. + for (var instance in tinymce.editors) { + tinymce.editors[instance].remove(); + } + } + } +}; + +Drupal.wysiwyg.editor.instance.tinymce = { + addPlugin: function(plugin, settings, pluginSettings) { + if (typeof Drupal.wysiwyg.plugins[plugin] != 'object') { + return; + } + + // Register plugin. + tinymce.PluginManager.add('drupal_' + plugin, function (editor) { + var button = { + title : settings.iconTitle, + image : settings.icon, + onPostRender : function() { + var self = this; + editor.on('nodeChange', function (e) { + // isNode: Return whether the plugin button should be enabled for the + // current selection. + if (typeof Drupal.wysiwyg.plugins[plugin].isNode == 'function') { + self.active(Drupal.wysiwyg.plugins[plugin].isNode(e.element)); + } + }); + } + } + if (typeof Drupal.wysiwyg.plugins[plugin].invoke == 'function') { + button.onclick = function() { + var data = { format: 'html', node: editor.selection.getNode(), content: editor.selection.getContent() }; + // TinyMCE creates a completely new instance for fullscreen mode. + Drupal.wysiwyg.plugins[plugin].invoke(data, pluginSettings, editor.id); + } + } + + // Register the plugin button. + editor.addButton('drupal_' + plugin, button); + /** + * Initialize the plugin, executed after the plugin has been created. + * + * @param ed + * The tinymce.Editor instance the plugin is initialized in. + * @param url + * The absolute URL of the plugin location. + var editorId = (e.target.id == 'mce_fullscreen' ? e.target.getParam('fullscreen_editor_id') : e.target.id); + */ + editor.on('init', function(e) { + // Load custom CSS for editor contents on startup. + if (settings.css) { + editor.dom.loadCSS(settings.css); + } + + }); + + // Attach: Replace plain text with HTML representations. + editor.on('beforeSetContent', function(e) { + if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') { + e.content = Drupal.wysiwyg.plugins[plugin].attach(e.content, pluginSettings, e.target.id); + e.content = Drupal.wysiwyg.editor.instance.tinymce.prepareContent(e.content); + } + }); + + // Detach: Replace HTML representations with plain text. + editor.on('getContent', function(e) { + var editorId = (e.target.id == 'mce_fullscreen' ? e.target.getParam('fullscreen_editor_id') : e.target.id); + if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') { + e.content = Drupal.wysiwyg.plugins[plugin].detach(e.content, pluginSettings, editorId); + } + }); + }); + }, + + openDialog: function(dialog, params) { + var instanceId = this.getInstanceId(); + var editor = tinymce.get(instanceId); + editor.windowManager.open({ + file: dialog.url + '/' + instanceId, + width: dialog.width, + height: dialog.height, + inline: 1 + }, params); + }, + + closeDialog: function(dialog) { + var editor = tinymce.get(this.getInstanceId()); + editor.windowManager.close(dialog); + }, + + prepareContent: function(content) { + // Certain content elements need to have additional DOM properties applied + // to prevent this editor from highlighting an internal button in addition + // to the button of a Drupal plugin. + var specialProperties = { + img: { 'class': 'mceItem' } + }; + var $content = $('
' + content + '
'); // No .outerHTML() in jQuery :( + // Find all placeholder/replacement content of Drupal plugins. + $content.find('.drupal-content').each(function() { + // Recursively process DOM elements below this element to apply special + // properties. + var $drupalContent = $(this); + $.each(specialProperties, function(element, properties) { + $drupalContent.find(element).andSelf().each(function() { + for (var property in properties) { + if (property == 'class') { + $(this).addClass(properties[property]); + } + else { + $(this).attr(property, properties[property]); + } + } + }); + }); + }); + return $content.html(); + }, + + insert: function(content) { + content = this.prepareContent(content); + tinymce.get(this.field).insertContent(content); + }, + + setContent: function (content) { + content = this.prepareContent(content); + tinymce.get(this.field).setContent(content); + }, + + getContent: function () { + return tinymce.get(this.getInstanceId()).getContent(); + }, + + isFullscreen: function() { + var editor = tinymce.get(this.field); + return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen(); + }, + + getInstanceId: function () { + return this.field; + } +}; + +})(jQuery); diff --git a/editors/tinymce.inc b/editors/tinymce.inc index 7ec0927..880272b 100644 --- a/editors/tinymce.inc +++ b/editors/tinymce.inc @@ -15,7 +15,7 @@ function wysiwyg_tinymce_editor() { 'title' => 'TinyMCE', 'vendor url' => 'http://www.tinymce.com', 'download url' => 'http://www.tinymce.com/download/download.php', - 'library path' => wysiwyg_get_path('tinymce') . '/jscripts/tiny_mce', + 'library path' => wysiwyg_get_path('tinymce'), 'libraries' => array( '' => array( 'title' => 'Minified', @@ -41,14 +41,10 @@ function wysiwyg_tinymce_editor() { ), 'proxy plugin settings callback' => 'wysiwyg_tinymce_proxy_plugin_settings', 'versions' => array( - '2.1' => array( - 'js files' => array('tinymce-2.js'), - 'css files' => array('tinymce-2.css'), - 'download url' => 'http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430&release_id=557383', - ), // @todo Starting from 3.3, tiny_mce.js may support JS aggregation. '3.1' => array( 'js files' => array('tinymce-3.js'), + 'library path' => wysiwyg_get_path('tinymce') . '/jscripts/tiny_mce', 'css files' => array('tinymce-3.css'), 'libraries' => array( '' => array( @@ -67,6 +63,16 @@ function wysiwyg_tinymce_editor() { ), ), ), + '4' => array( + 'js files' => array('tinymce-4.js'), + 'library path' => wysiwyg_get_path('tinymce') . '/js/tinymce', + 'libraries' => array( + 'min' => array( + 'title' => 'Minified', + 'files' => array('tinymce.min.js'), + ), + ), + ), ), ); return $editor; @@ -82,9 +88,12 @@ function wysiwyg_tinymce_editor() { * The installed editor version. */ function wysiwyg_tinymce_version($editor) { - $script = $editor['library path'] . '/tiny_mce.js'; + $script = $editor['library path'] . '/jscripts/tiny_mce/tiny_mce.js'; if (!file_exists($script)) { - return; + $script = $editor['library path'] . '/js/tinymce/tinymce.min.js'; + if (!file_exists($script)) { + return; + } } $script = fopen($script, 'r'); // Version is contained in the first 200 chars. @@ -92,7 +101,8 @@ function wysiwyg_tinymce_version($editor) { fclose($script); // 2.x: this.majorVersion="2";this.minorVersion="1.3" // 3.x: majorVersion:'3',minorVersion:'2.0.1' - if (preg_match('@majorVersion[=:]["\'](\d).+?minorVersion[=:]["\']([\d\.]+)@', $line, $version)) { + // 4.x: 4.0b2 (2013-04-24) + if (preg_match('@majorVersion[=:]["\'](\d).+?minorVersion[=:]["\']([\d\.]+)@', $line, $version) || preg_match('@(\d)\.([\d\.\w]+) @', $line, $version)) { return $version[1] . '.' . $version[2]; } } @@ -124,7 +134,12 @@ function wysiwyg_tinymce_themes($editor, $profile) { } return $themes; */ - return array('advanced', 'simple'); + if (version_compare($editor['installed version'], '4', '>=')) { + return array('modern'); + } + else { + return array('advanced', 'simple'); + } } /** @@ -133,9 +148,10 @@ function wysiwyg_tinymce_themes($editor, $profile) { * @see http://www.tinymce.com/wiki.php/Configuration */ function wysiwyg_tinymce_settings_form(&$form, &$form_state) { + $version = $form_state['wysiwyg']['editor']['installed version']; $profile = $form_state['wysiwyg_profile']; $settings = $profile->settings; - $settings += array( + $default_settings = array( // Enabled by default. 'apply_source_formatting' => FALSE, // Also available, but buggy in TinyMCE 2.x: blockquote,code,dt,dd,samp. @@ -146,11 +162,21 @@ function wysiwyg_tinymce_settings_form(&$form, &$form_state) { 'preformatted' => FALSE, 'remove_linebreaks' => TRUE, 'theme_advanced_resizing' => TRUE, + 'theme_advanced_styles' => '', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_toolbar_location' => 'top', 'verify_html' => TRUE, ); + if (version_compare($version, '3.3', '>=')) { + $default_settings['style_formats'] = ''; + }; + if (version_compare($version, '4', '>')) { + $default_settings['indenting'] = FALSE; + } + + $settings += $default_settings; + $form['appearance']['theme_advanced_toolbar_location'] = array( '#type' => 'select', '#title' => t('Toolbar location'), @@ -216,14 +242,6 @@ function wysiwyg_tinymce_settings_form(&$form, &$form_state) { '#description' => t('If enabled, the editor will remove most linebreaks from contents. Disabling this option could avoid conflicts with other input filters.') . ' ' . t('Uses the @setting setting internally.', array('@setting' => 'remove_linebreaks', '@url' => url('http://www.tinymce.com/wiki.php/Configuration3x:remove_linebreaks'))), ); - $form['output']['apply_source_formatting'] = array( - '#type' => 'checkbox', - '#title' => t('Apply source formatting'), - '#default_value' => $settings['apply_source_formatting'], - '#return_value' => 1, - '#description' => t('If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters.') . ' ' . t('Uses the @setting setting internally.', array('@setting' => 'apply_source_formatting', '@url' => url('http://www.tinymce.com/wiki.php/Configuration3x:apply_source_formatting'))), - ); - $form['css']['theme_advanced_styles'] = array( '#type' => 'textarea', '#title' => t('CSS classes'), @@ -235,17 +253,53 @@ function wysiwyg_tinymce_settings_form(&$form, &$form_state) { ) ) . ' ' . t('Uses the @setting setting internally.', array('@setting' => 'theme_advanced_styles', '@url' => url('http://www.tinymce.com/wiki.php/Configuration3x:theme_advanced_styles'))), ); + if (version_compare($version, '4', '<')) { + $form['css']['theme_advanced_blockformats'] = array( + '#type' => 'textfield', + '#title' => t('Block formats'), + '#default_value' => $settings['theme_advanced_blockformats'], + '#size' => 40, + '#maxlength' => 250, + '#description' => t('Comma separated list of HTML block formats. Possible values: @format-list.', array('@format-list' => 'p,h1,h2,h3,h4,h5,h6,div,blockquote,address,pre,code,dt,dd')) . ' ' . t('Uses the @setting setting internally.', array('@setting' => 'theme_advanced_blockformats', '@url' => url('http://www.tinymce.com/wiki.php/Configuration3x:theme_advanced_blockformats'))), + '#element_validate' => array('wysiwyg_tinymce_settings_form_validate_blockformats'), + ); + } + if (version_compare($version, '3.3', '>=')) { + $link_url = url('http://www.tinymce.com/wiki.php/Configuration3x:style_formats'); + if (version_compare($version, '4', '>=')) { + $form['css']['theme_advanced_styles']['#access'] = FALSE; + $link_url = url('http://www.tinymce.com/wiki.php/Configuration:style_formats'); + } + else { + $form['css']['theme_advanced_styles']['#description'] .= '
' . t('This setting is only used if Style formats is empty.'); + } + $form['css']['style_formats'] = array( + '#type' => 'textarea', + '#title' => t('Style formats'), + '#default_value' => $settings['style_formats'], + '#description' => t('A JSON object containing advanced style formats for text and other elements to add to the editor. The value will be rendered as styles in the Formats dropdown.') . ' ' . t('Uses the @setting setting internally.', array('@setting' => 'style_formats', '@url' => $link_url)), + '#element_validate' => array('wysiwyg_tinymce_settings_form_validate_style_formats'), + ); + } - - $form['css']['theme_advanced_blockformats'] = array( - '#type' => 'textfield', - '#title' => t('Block formats'), - '#default_value' => $settings['theme_advanced_blockformats'], - '#size' => 40, - '#maxlength' => 250, - '#description' => t('Comma separated list of HTML block formats. Possible values: @format-list.', array('@format-list' => 'p,h1,h2,h3,h4,h5,h6,div,blockquote,address,pre,code,dt,dd')) . ' ' . t('Uses the @setting setting internally.', array('@setting' => 'theme_advanced_blockformats', '@url' => url('http://www.tinymce.com/wiki.php/Configuration3x:theme_advanced_blockformats'))), - '#element_validate' => array('wysiwyg_tinymce_settings_form_validate_blockformats'), - ); + if (version_compare($version, '3.4b1', '<')) { + $form['output']['apply_source_formatting'] = array( + '#type' => 'checkbox', + '#title' => t('Apply source formatting'), + '#default_value' => $settings['apply_source_formatting'], + '#return_value' => 1, + '#description' => t('If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters.') . ' ' . t('Uses the @setting setting internally.', array('@setting' => 'apply_source_formatting', '@url' => url('http://www.tinymce.com/wiki.php/Configuration3x:apply_source_formatting'))), + ); + } + else { + $form['output']['indenting'] = array( + '#type' => 'checkbox', + '#title' => t('Apply source formatting'), + '#default_value' => isset($settings['indenting']) ? $settings['indenting'] : $settings['apply_source_formatting'], + '#return_value' => 1, + '#description' => t('If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters.'), + ); + } $form['paste'] = array( '#type' => 'fieldset', @@ -275,6 +329,15 @@ function wysiwyg_tinymce_settings_form_validate_blockformats($element, &$form_st } /** + * #element_validate handler for style_formats element added by wysiwyg_tinymce_settings_form(). + */ +function wysiwyg_tinymce_settings_form_validate_style_formats($element, &$form_state) { + if (!empty($element['#value']) && json_decode($element['#value']) === NULL) { + form_error($element, t('The specified style formats are syntactically incorrect.')); + } +} + +/** * Returns an initialization JavaScript for this editor library. * * @param array $editor @@ -300,7 +363,7 @@ function wysiwyg_tinymce_init($editor, $library) { // @see http://www.tinymce.com/forum/viewtopic.php?id=23286 $settings = drupal_json_encode(array( 'base' => base_path() . $editor['library path'], - 'suffix' => (strpos($library, 'src') !== FALSE || strpos($library, 'dev') !== FALSE ? '_src' : ''), + 'suffix' => (strpos($library, 'src') !== FALSE || strpos($library, 'dev') !== FALSE ? '_src' : (strpos($library, 'min') !== FALSE ? '.min' : '')), 'query' => '', )); return << TRUE, // @todo Add a setting for this. 'document_base_url' => base_path(), @@ -356,11 +420,27 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { $settings[$setting_name] = $config[$setting_name]; } } + + if ($settings['language'] == 'en') { + unset($settings['language']); + } + + if (isset($config['apply_source_formatting'])) { + if (version_compare($version, '3.4b1', '>=')) { + $settings['indent'] = $config['apply_source_formatting']; + } + else { + $settings['apply_source_formatting'] = $config['apply_source_formatting']; + } + } if (isset($config['verify_html'])) { // TinyMCE performs a type-agnostic comparison on this particular setting. $settings['verify_html'] = (bool) $config['verify_html']; } + if (!empty($config['style_formats'])) { + $settings['style_formats'] = json_decode($config['style_formats']); + } if (!empty($config['theme_advanced_styles'])) { $settings['theme_advanced_styles'] = implode(';', array_filter(explode("\n", str_replace("\r", '', $config['theme_advanced_styles'])))); } @@ -402,11 +482,16 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { } // Add buttons. if ($type == 'buttons') { - $settings['buttons'][] = $button; + if (!empty($plugins[$plugin]['proxy'])) { + $settings['buttons'][] = 'drupal_' . $button; + } + else { + $settings['buttons'][] = $button; + } } // Add external Drupal plugins to the list of extensions. if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { - $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', $button)] = 1; + $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', 'drupal_' . $button)] = 1; } // Add external plugins to the list of extensions. elseif ($type == 'buttons' && empty($plugins[$plugin]['internal'])) { @@ -439,6 +524,18 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { unset($settings['extensions']); } + if (version_compare($version, '4', '>=')) { + $settings += array( + 'resize' => isset($config['resizing']) ? $config['resizing'] : 1, + ); + if (isset($settings['buttons'])) { + // @todo Allow to sort/arrange editor buttons. + for ($i = 0; $i < count($settings['buttons']); $i++) { + $settings['toolbar'][] = $settings['buttons'][$i]; + } + } + } + // Add theme-specific settings. switch ($theme) { case 'advanced': @@ -468,7 +565,7 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { unset($settings['buttons']); // Convert the config values into the form expected by TinyMCE. - $csv_settings = array('plugins', 'extended_valid_elements', 'theme_advanced_buttons1', 'theme_advanced_buttons2', 'theme_advanced_buttons3'); + $csv_settings = array('toolbar', 'plugins', 'extended_valid_elements', 'theme_advanced_buttons1', 'theme_advanced_buttons2', 'theme_advanced_buttons3'); foreach ($csv_settings as $key) { if (isset($settings[$key]) && is_array($settings[$key])) { $settings[$key] = implode(',', $settings[$key]); @@ -786,6 +883,94 @@ function wysiwyg_tinymce_plugins($editor) { ), ); } + if (version_compare($editor['installed version'], '4', '>=')) { + + $removedPlugins = array('advhr', 'advimage', 'advlink', 'inlinepopups', 'style', 'emotions', 'xhtmlxtras'); + foreach ($removedPlugins as $plugin) { + unset($plugins[$plugin]); + } + $removedDefaultButtons = array('link', 'unlink', 'anchor', 'image', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'forecolor', 'backcolor', 'sup', 'sub', 'code', 'charmap', 'cleanup'); + foreach ($removedDefaultButtons as $button) { + unset($plugins['default']['buttons'][$button]); + } + + unset($plugins['insertdatetime']['buttons']['insertdate']); + + $plugins['paste']['buttons'] = array( + 'paste' => t('Paste'), + ); + $plugins['searchreplace']['buttons'] = array( + 'searchreplace' => t('Search & Replace'), + ); + $plugins['table']['buttons'] = array( + 'table' => t('table'), + ); + + $plugins['hr'] = array( + 'path' => $editor['library path'] . '/plugins/hr', + 'buttons' => array('hr' => t('Insert horizontal rule')), + 'extended_valid_elements' => array('hr[class|width|size|noshade]'), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:hr', + 'internal' => TRUE, + 'load' => TRUE, + ); + $plugins['charmap'] = array( + 'path' => $editor['library path'] . '/plugins/charmap', + 'buttons' => array('hr' => t('Insert special character')), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:charmap', + 'internal' => TRUE, + 'load' => TRUE, + ); + $plugins['anchor'] = array( + 'path' => $editor['library path'] . '/plugins/anchor', + 'buttons' => array('anchor' => t('Insert anchor/bookmark')), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:anchor', + 'internal' => TRUE, + 'load' => TRUE, + ); + $plugins['image'] = array( + 'path' => $editor['library path'] . '/plugins/image', + 'buttons' => array('image' => t('Insert image')), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:image', + 'internal' => TRUE, + 'load' => TRUE, + ); + $plugins['link'] = array( + 'path' => $editor['library path'] . '/plugins/link', + 'buttons' => array('link' => t('Insert link'), 'unlink' => t('Remove link')), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:link', + 'internal' => TRUE, + 'load' => TRUE, + ); + $plugins['emoticons'] = array( + 'path' => $editor['library path'] . '/plugins/emoticons', + 'buttons' => array('emoticons' => t('Insert emoticons')), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:emoticons', + 'internal' => TRUE, + 'load' => TRUE, + ); + $plugins['code'] = array( + 'path' => $editor['library path'] . '/plugins/code', + 'buttons' => array('code' => t('Source code')), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:code', + 'internal' => TRUE, + 'load' => TRUE, + ); + $plugins['textcolor'] = array( + 'path' => $editor['library path'] . '/plugins/textcolor', + 'buttons' => array('forecolor' => t('Text color'), 'backcolor' => t('Background color')), + 'url' => 'http://www.tinymce.com/wiki.php/Plugin:textcolor', + 'internal' => TRUE, + 'load' => TRUE, + ); + + $plugins['default']['buttons'] += array( + 'subscript' => t('Subscript'), 'superscript' => t('Superscript'), + 'alignleft' => t('Align left'), 'aligncenter' => t('Align center'), 'alignright' => t('Align right'), 'alignjustify' => t('Justify'), + 'selectall' => t('Select All'), + ); + } + return $plugins; } diff --git a/editors/yui.inc b/editors/yui.inc index 1f7d889..a29fb66 100644 --- a/editors/yui.inc +++ b/editors/yui.inc @@ -123,6 +123,8 @@ function wysiwyg_yui_settings_form(&$form, &$form_state) { $settings = $profile->settings; $settings += array( + 'autoHeight' => FALSE, + 'block_formats' => 'p,h2,h3,h4,h5,h6', ); $form['appearance']['autoHeight'] = array(