From 1fea5537d4b16652bd3a800a789e009b28858dd8 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 8 May 2012 16:24:41 +0200 Subject: [PATCH] MDL-26901 add new option to specify list of available fonts in TinyMCE Also modified the list of languages appearance, textarea is more suitable for entry of long texts. It is now also possible to specify empty list of languages and fonts which removes the button from the editor toolbar. Includes release name fix. --- lib/editor/tinymce/lang/en/editor_tinymce.php | 1 + lib/editor/tinymce/lib.php | 16 ++++++++++++---- lib/editor/tinymce/settings.php | 5 ++++- lib/editor/tinymce/version.php | 4 ++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/editor/tinymce/lang/en/editor_tinymce.php b/lib/editor/tinymce/lang/en/editor_tinymce.php index 484ed6bbe37..587ed6621d7 100644 --- a/lib/editor/tinymce/lang/en/editor_tinymce.php +++ b/lib/editor/tinymce/lang/en/editor_tinymce.php @@ -31,6 +31,7 @@ $string['common:browsemedia'] = 'Find or upload a sound, video or applet...'; $string['dragmath:dragmath_desc'] = 'Insert equation'; $string['dragmath:dragmath_javaneeded'] = 'To use this page you need a Java-enabled browser. Download the latest Java plug-in from {$a}.'; $string['dragmath:dragmath_title'] = 'DragMath Equation Editor'; +$string['fontselectlist'] = 'Available fonts list'; $string['media_dlg:filename'] = 'Filename'; $string['moodleemoticon:desc'] = 'Insert emoticon'; $string['moodlenolink:desc'] = 'Prevent automatic linking'; diff --git a/lib/editor/tinymce/lib.php b/lib/editor/tinymce/lib.php index 3b1a6918d0d..885af159a10 100644 --- a/lib/editor/tinymce/lib.php +++ b/lib/editor/tinymce/lib.php @@ -94,6 +94,14 @@ class tinymce_texteditor extends texteditor { $context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context']; + $config = get_config('editor_tinymce'); + + $spelllanguagelist = empty($config->spelllanguagelist) ? '' : $config->spelllanguagelist; + $spellbutton = ($spelllanguagelist === '') ? '' : ',spellchecker'; + + $fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist; + $fontbutton = ($fontselectlist === '') ? '' : 'fontselect,'; + $xmedia = 'moodlemedia,'; // HQ thinks it should be always on, so it is no matter if it will actually work or not /* if (!empty($options['legacy'])) { @@ -135,20 +143,20 @@ class tinymce_texteditor extends texteditor { 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", 'theme_advanced_layout_manager' => "SimpleLayout", 'theme_advanced_toolbar_align' => "left", - 'theme_advanced_buttons1' => "fontselect,fontsizeselect,formatselect", + 'theme_advanced_buttons1' => "{$fontbutton}fontsizeselect,formatselect", 'theme_advanced_buttons1_add' => "|,undo,redo,|,search,replace,|,fullscreen", 'theme_advanced_buttons2' => "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright", 'theme_advanced_buttons2_add' => "|,cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl", 'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,|,image,{$xemoticon}{$xmedia}{$xdragmath}nonbreaking,charmap", - 'theme_advanced_buttons3_add' => "table,|,code,spellchecker", - 'theme_advanced_fonts' => "Trebuchet=Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;Wingdings=wingdings", + 'theme_advanced_buttons3_add' => "table,|,code{$spellbutton}", + 'theme_advanced_fonts' => $fontselectlist, 'theme_advanced_resize_horizontal' => true, 'theme_advanced_resizing' => true, 'theme_advanced_resizing_min_height' => 30, 'theme_advanced_toolbar_location' => "top", 'theme_advanced_statusbar_location' => "bottom", 'spellchecker_rpc_url' => $CFG->wwwroot."/lib/editor/tinymce/tiny_mce/$this->version/plugins/spellchecker/rpc.php", - 'spellchecker_languages' => get_config('editor_tinymce', 'spelllanguagelist') + 'spellchecker_languages' => $spelllanguagelist ); if ($xemoticon) { diff --git a/lib/editor/tinymce/settings.php b/lib/editor/tinymce/settings.php index db0270005e3..d26d84bd79f 100644 --- a/lib/editor/tinymce/settings.php +++ b/lib/editor/tinymce/settings.php @@ -33,8 +33,11 @@ if ($ADMIN->fulltree) { 'PSpellShell'=>'PSpellShell'); $settings->add(new admin_setting_configselect('editor_tinymce/spellengine', get_string('spellengine', 'admin'), '', 'GoogleSpell', $options)); - $settings->add(new admin_setting_configtext('editor_tinymce/spelllanguagelist', + $settings->add(new admin_setting_configtextarea('editor_tinymce/spelllanguagelist', get_string('spelllanguagelist', 'admin'), '', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,' . 'Portuguese=pt,Spanish=es,Swedish=sv', PARAM_RAW)); + $settings->add(new admin_setting_configtextarea('editor_tinymce/fontselectlist', + get_string('fontselectlist', 'editor_tinymce'), '', + 'Trebuchet=Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;Wingdings=wingdings', PARAM_RAW)); } diff --git a/lib/editor/tinymce/version.php b/lib/editor/tinymce/version.php index 318d64136a4..416fd95336c 100644 --- a/lib/editor/tinymce/version.php +++ b/lib/editor/tinymce/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2012030300; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2012050800; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2011112900; // Requires this Moodle version $plugin->component = 'editor_tinymce'; // Full name of the plugin (used for diagnostics) -$plugin->release = '3.4.9'; +$plugin->release = '3.5.0';