diff --git a/.gitignore b/.gitignore index 17c654470d7..d74f914f79f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ *~ # /config.php -/lib/editor/tinymce/extra/tools/temp/ /tags /TAGS /cscope.* diff --git a/admin/presets/classes/helper.php b/admin/presets/classes/helper.php index 808ed2b7c86..9619e42e686 100644 --- a/admin/presets/classes/helper.php +++ b/admin/presets/classes/helper.php @@ -278,9 +278,6 @@ class helper { static::add_plugin($presetid, 'repository', 'url', false); static::add_plugin($presetid, 'repository', 'wikimedia', false); - // Text editors: Disable TinyMCE HTML editor. - static::add_plugin($presetid, 'editor', 'tinymce', false); - // Create the "Full" site admin preset. $data = [ 'name' => get_string('fullpreset', 'core_adminpresets'), @@ -383,8 +380,5 @@ class helper { static::add_plugin($presetid, 'repository', 'local', true); static::add_plugin($presetid, 'repository', 'url', true); static::add_plugin($presetid, 'repository', 'wikimedia', true); - - // Text editors: Enable TinyMCE HTML editor. - static::add_plugin($presetid, 'editor', 'tinymce', true); } } diff --git a/admin/presets/classes/manager.php b/admin/presets/classes/manager.php index 4b478af3cda..fc059ddb43f 100644 --- a/admin/presets/classes/manager.php +++ b/admin/presets/classes/manager.php @@ -105,7 +105,6 @@ class manager { 'adminpresets_auth_shibboleth_admin_setting_special_idp_configtextarea' => 'adminpresets_admin_setting_configtext', 'adminpresets_auth_shibboleth_admin_setting_special_wayf_select' => 'adminpresets_admin_setting_configselect', 'adminpresets_editor_atto_toolbar_setting' => 'adminpresets_admin_setting_configtext', - 'adminpresets_editor_tinymce_json_setting_textarea' => 'adminpresets_admin_setting_configtext', 'adminpresets_enrol_database_admin_setting_category' => 'adminpresets_admin_setting_configselect', 'adminpresets_enrol_flatfile_role_setting' => 'adminpresets_admin_setting_configtext', 'adminpresets_enrol_ldap_admin_setting_category' => 'adminpresets_admin_setting_configselect', diff --git a/admin/tool/admin_presets/tests/behat/apply_presets.feature b/admin/tool/admin_presets/tests/behat/apply_presets.feature index 01559690eab..163ccc942ae 100644 --- a/admin/tool/admin_presets/tests/behat/apply_presets.feature +++ b/admin/tool/admin_presets/tests/behat/apply_presets.feature @@ -96,7 +96,6 @@ Feature: I can apply presets And I should see "Starred courses" in the "Setting changes" "table" And I should see "Survey" in the "Setting changes" "table" And I should see "Tags" in the "Setting changes" "table" - And I should see "TinyMCE HTML editor" in the "Setting changes" "table" And I should see "URL downloader" in the "Setting changes" "table" And I should see "Wiki" in the "Setting changes" "table" And I should see "Wikimedia" in the "Setting changes" "table" diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php index 183e2ed6b72..f98d8c95871 100644 --- a/lib/classes/plugin_manager.php +++ b/lib/classes/plugin_manager.php @@ -25,12 +25,6 @@ * @copyright 2011 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Singleton class providing general plugins management functionality. - */ class core_plugin_manager { /** the plugin is shipped with standard Moodle distribution */ @@ -1730,6 +1724,7 @@ class core_plugin_manager { 'auth' => array('radius', 'fc', 'nntp', 'pam', 'pop3', 'imap'), 'block' => array('course_overview', 'messages', 'community', 'participants', 'quiz_results'), 'cachestore' => array('memcache', 'memcached'), + 'editor' => array('tinymce'), 'enrol' => array('authorize'), 'filter' => array('censor'), 'media' => array('swf'), @@ -1739,7 +1734,10 @@ class core_plugin_manager { 'quizaccess' => array('safebrowser'), 'report' => array('search'), 'repository' => array('alfresco', 'picasa', 'skydrive', 'boxnet'), - 'tinymce' => array('dragmath'), + 'tinymce' => array('dragmath', 'ctrlhelp', 'managefiles', 'moodleemoticon', 'moodleimage', + 'moodlemedia', 'moodlenolink', 'pdw', 'spellchecker', 'wrap' + ), + 'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade', 'health'), 'theme' => array('bootstrapbase', 'clean', 'more', 'afterburner', 'anomaly', 'arialist', 'base', 'binarius', 'boxxie', 'brick', 'canvas', 'formal_white', 'formfactor', 'fusion', 'leatherbound', @@ -1861,7 +1859,7 @@ class core_plugin_manager { ), 'editor' => array( - 'atto', 'textarea', 'tiny', 'tinymce' + 'atto', 'textarea', 'tiny', ), 'enrol' => array( @@ -2037,11 +2035,6 @@ class core_plugin_manager { 'recordrtc', ], - 'tinymce' => array( - 'ctrlhelp', 'managefiles', 'moodleemoticon', 'moodleimage', - 'moodlemedia', 'moodlenolink', 'pdw', 'spellchecker', 'wrap' - ), - 'theme' => array( 'boost', 'classic' ), diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index ac3ff1962f1..8b1c4cb83bc 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3019,5 +3019,26 @@ privatefiles,moodle|/user/files.php'; upgrade_main_savepoint(true, 2023022000.00); } + if ($oldversion < 2023021700.01) { + // If editor_tinymce is no longer present, remove it. + if (!file_exists($CFG->dirroot . '/lib/editor/tinymce/version.php')) { + // Clean config. + uninstall_plugin('editor', 'tinymce'); + $DB->delete_records('user_preferences', [ + 'name' => 'htmleditor', + 'value' => 'tinymce', + ]); + + if ($editors = get_config('core', 'texteditors')) { + $editors = array_flip(explode(',', $editors)); + unset($editors['tinymce']); + set_config('texteditors', implode(',', array_flip($editors))); + } + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2023021700.01); + } + return true; } diff --git a/lib/editorlib.php b/lib/editorlib.php index 383f2bf6e52..2ca0195def6 100644 --- a/lib/editorlib.php +++ b/lib/editorlib.php @@ -95,7 +95,7 @@ function editors_get_enabled() { global $CFG; if (empty($CFG->texteditors)) { - $CFG->texteditors = 'atto,tinymce,textarea'; + $CFG->texteditors = 'atto,tiny,textarea'; } $active = array(); foreach(explode(',', $CFG->texteditors) as $e) { @@ -114,7 +114,7 @@ function editors_get_enabled() { /** * Returns instance of text editor * - * @param string $editorname name of editor (textarea, tinymce, ...) + * @param string $editorname name of editor (textarea, tiny, ...) * @return object|bool texeditor instance or false if does not exist */ function get_texteditor($editorname) { @@ -153,7 +153,7 @@ function editors_head_setup() { global $CFG; if (empty($CFG->texteditors)) { - $CFG->texteditors = 'atto,tinymce,textarea'; + $CFG->texteditors = 'atto,tiny,textarea'; } $active = explode(',', $CFG->texteditors); diff --git a/lib/form/editor.php b/lib/form/editor.php index c985854458a..693d44b6a98 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -35,7 +35,7 @@ require_once('templatable_form_element.php'); /** * Editor element * - * It creates preffered editor (textbox/TinyMce) form element for the format (Text/HTML) selected. + * It creates preffered editor (textbox/Tiny) form element for the format (Text/HTML) selected. * * @package core_form * @category form @@ -422,7 +422,8 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab $fpoptions['subtitle'] = $subtitle_options; } - //If editor is required and tinymce, then set required_tinymce option to initalize tinymce validation. + // TODO Remove this in MDL-77334 for Moodle 4.6. + // If editor is required and tinymce, then set required_tinymce option to initalize tinymce validation. if (($editor instanceof tinymce_texteditor) && !is_null($this->getAttribute('onchange'))) { $this->_options['required'] = true; } diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index 6852f44ffc5..29953ce5383 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -2266,7 +2266,7 @@ EOF; } // Make the provided editor the default one in $CFG->texteditors by - // moving it to the first [editor],atto,tiny,tinymce,textarea on the list. + // moving it to the first [editor],atto,tiny,textarea on the list. $list = explode(',', $CFG->texteditors); array_unshift($list, $editor); $list = array_unique($list); diff --git a/lib/tests/outputrequirementslib_test.php b/lib/tests/outputrequirementslib_test.php index 1b615b950e7..e4bdccf17df 100644 --- a/lib/tests/outputrequirementslib_test.php +++ b/lib/tests/outputrequirementslib_test.php @@ -176,10 +176,6 @@ class outputrequirementslib_test extends \advanced_testcase { $libdir = rtrim($CFG->libdir, '/'); $admin = "/{$CFG->admin}/"; // Deprecated, just for coverage purposes. - require_once($libdir . '/editor/tinymce/lib.php'); - $tiny = new \tinymce_texteditor(); - $tinyversion = $tiny->version; - // Note: $CFG->slasharguments is enabled by default; it will be a forced setting one day (MDL-62640). return [ 'Environment XML file' => [ @@ -207,16 +203,6 @@ class outputrequirementslib_test extends \advanced_testcase { 0, $wwwroot . '/lib/javascript.php?rev=1&jsfile=%2Fh5p%2Fjs%2Fembed.js' ], - 'TinyMCE internal resource' => [ - new \moodle_url('/lib/editor/tinymce/tiny_mce/' . $tinyversion . '/tiny_mce.js'), - 1, - $wwwroot . '/lib/javascript.php/1/lib/editor/tinymce/tiny_mce/' . $tinyversion . '/tiny_mce.js' - ], - 'A Moodle JS resource using the full path including the proper JS Handler' => [ - new \moodle_url($wwwroot . '/lib/javascript.php/1/lib/editor/tinymce/tiny_mce/' . $tinyversion . '/tiny_mce.js'), - 1, - $wwwroot . '/lib/javascript.php/1/lib/editor/tinymce/tiny_mce/' . $tinyversion . '/tiny_mce.js' - ], 'A custom Moodle CSS Handler' => [ new \moodle_url('/mod/data/css.php?d=1234567890'), 1, diff --git a/lib/tests/plugin_manager_test.php b/lib/tests/plugin_manager_test.php index 8eba35750ea..23f22895188 100644 --- a/lib/tests/plugin_manager_test.php +++ b/lib/tests/plugin_manager_test.php @@ -183,9 +183,9 @@ class plugin_manager_test extends \advanced_testcase { global $CFG; // Any standard plugin with subplugins is suitable. - $this->assertFileExists("$CFG->dirroot/lib/editor/tinymce", 'TinyMCE is not present.'); + $this->assertFileExists("$CFG->dirroot/lib/editor/tiny", 'TinyMCE is not present.'); - $subplugins = core_plugin_manager::instance()->get_subplugins_of_plugin('editor_tinymce'); + $subplugins = core_plugin_manager::instance()->get_subplugins_of_plugin('editor_tiny'); foreach ($subplugins as $component => $info) { $this->assertInstanceOf('\core\plugininfo\base', $info); } @@ -201,20 +201,20 @@ class plugin_manager_test extends \advanced_testcase { global $CFG; // Any standard plugin with subplugins is suitable. - $this->assertFileExists("$CFG->dirroot/lib/editor/tinymce", 'TinyMCE is not present.'); + $this->assertFileExists("$CFG->dirroot/lib/editor/tiny", 'TinyMCE is not present.'); - $parent = core_plugin_manager::instance()->get_parent_of_subplugin('tinymce'); - $this->assertSame('editor_tinymce', $parent); + $parent = core_plugin_manager::instance()->get_parent_of_subplugin('tiny'); + $this->assertSame('editor_tiny', $parent); } public function test_plugin_name() { global $CFG; // Any standard plugin is suitable. - $this->assertFileExists("$CFG->dirroot/lib/editor/tinymce", 'TinyMCE is not present.'); + $this->assertFileExists("$CFG->dirroot/lib/editor/tiny", 'TinyMCE is not present.'); - $name = core_plugin_manager::instance()->plugin_name('editor_tinymce'); - $this->assertSame(get_string('pluginname', 'editor_tinymce'), $name); + $name = core_plugin_manager::instance()->plugin_name('editor_tiny'); + $this->assertSame(get_string('pluginname', 'editor_tiny'), $name); } public function test_plugintype_name() { @@ -231,9 +231,9 @@ class plugin_manager_test extends \advanced_testcase { global $CFG; // Any standard plugin is suitable. - $this->assertFileExists("$CFG->dirroot/lib/editor/tinymce", 'TinyMCE is not present.'); + $this->assertFileExists("$CFG->dirroot/lib/editor/tiny", 'TinyMCE is not present.'); - $info = core_plugin_manager::instance()->get_plugin_info('editor_tinymce'); + $info = core_plugin_manager::instance()->get_plugin_info('editor_tiny'); $this->assertInstanceOf('\core\plugininfo\editor', $info); } diff --git a/lib/tests/weblib_test.php b/lib/tests/weblib_test.php index 202ac33cc30..c390b8518d2 100644 --- a/lib/tests/weblib_test.php +++ b/lib/tests/weblib_test.php @@ -1057,8 +1057,8 @@ EXPECTED; '/h5p/js/embed.js' ], 'A Moodle JS resource using the full path including the proper JS Handler' => [ - new \moodle_url($wwwroot . '/lib/javascript.php/1/lib/editor/tinymce/tiny_mce/M.m.p/tiny_mce.js'), - '/lib/javascript.php/1/lib/editor/tinymce/tiny_mce/M.m.p/tiny_mce.js' + new \moodle_url($wwwroot . '/lib/javascript.php/1/lib/editor/tiny/js/tinymce/tinymce.js'), + '/lib/javascript.php/1/lib/editor/tiny/js/tinymce/tinymce.js' ], ]; } @@ -1111,10 +1111,6 @@ EXPECTED; new \moodle_url('/h5p/js/embed.js'), true ], - 'A Moodle JS resource using the full path including the proper JS Handler' => [ - new \moodle_url($wwwroot . '/lib/javascript.php/1/lib/editor/tinymce/tiny_mce/M.m.p/tiny_mce.js'), - true - ], ]; } diff --git a/lib/upgrade.txt b/lib/upgrade.txt index f790a3bd2a8..7d9e1527209 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -72,6 +72,7 @@ information provided here is intended especially for developers. * The core/modal module and all their versions (SAVE_CANCEL, DELETE_CANCEL...) now has a setButtonDisable to disable or enable specific modal action buttons. This function allows developers to have modals that could only be submited if the user do some action in the modal body like ticking a checkbox or selecting an element. +* The editor_tinymce plugin has been removed from core. === 4.1 === diff --git a/theme/boost/scss/moodle/admin.scss b/theme/boost/scss/moodle/admin.scss index 30f2dc5d23d..1509efea0e8 100644 --- a/theme/boost/scss/moodle/admin.scss +++ b/theme/boost/scss/moodle/admin.scss @@ -305,8 +305,7 @@ display: block; } -#admin-spelllanguagelist textarea, -#page-admin-setting-editorsettingstinymce .form-textarea textarea { +#admin-spelllanguagelist textarea { /* rtl:ignore */ text-align: left; /* rtl:ignore */ diff --git a/theme/boost/scss/moodle/core.scss b/theme/boost/scss/moodle/core.scss index 287c875d352..e58614afa23 100644 --- a/theme/boost/scss/moodle/core.scss +++ b/theme/boost/scss/moodle/core.scss @@ -1166,22 +1166,11 @@ tr.flagged-tag a { audio.mediaplugin_html5audio { width: 300px; } -/* TinyMCE moodle media preview frame should not have padding */ -.core_media_preview.pagelayout-embedded #content { - padding: 0; -} .core_media_preview.pagelayout-embedded #maincontent { height: 0; } -body#page-lib-editor-tinymce-plugins-moodlemedia-preview { - padding: 0; - margin: 0; - min-width: 0; - background: none; -} - .path-rating .ratingtable { width: 100%; margin-bottom: 1em; diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index 9088e29ab34..0ae905fb04b 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -10836,19 +10836,9 @@ tr.flagged-tag a { audio.mediaplugin_html5audio { width: 300px; } -/* TinyMCE moodle media preview frame should not have padding */ -.core_media_preview.pagelayout-embedded #content { - padding: 0; } - .core_media_preview.pagelayout-embedded #maincontent { height: 0; } -body#page-lib-editor-tinymce-plugins-moodlemedia-preview { - padding: 0; - margin: 0; - min-width: 0; - background: none; } - .path-rating .ratingtable { width: 100%; margin-bottom: 1em; } @@ -12801,8 +12791,7 @@ blockquote { #adminsettings fieldset.error legend { display: block; } -#admin-spelllanguagelist textarea, -#page-admin-setting-editorsettingstinymce .form-textarea textarea { +#admin-spelllanguagelist textarea { /* rtl:ignore */ text-align: left; /* rtl:ignore */ diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index aaefc7fc322..8ee5ba037f8 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -10836,19 +10836,9 @@ tr.flagged-tag a { audio.mediaplugin_html5audio { width: 300px; } -/* TinyMCE moodle media preview frame should not have padding */ -.core_media_preview.pagelayout-embedded #content { - padding: 0; } - .core_media_preview.pagelayout-embedded #maincontent { height: 0; } -body#page-lib-editor-tinymce-plugins-moodlemedia-preview { - padding: 0; - margin: 0; - min-width: 0; - background: none; } - .path-rating .ratingtable { width: 100%; margin-bottom: 1em; } @@ -12801,8 +12791,7 @@ blockquote { #adminsettings fieldset.error legend { display: block; } -#admin-spelllanguagelist textarea, -#page-admin-setting-editorsettingstinymce .form-textarea textarea { +#admin-spelllanguagelist textarea { /* rtl:ignore */ text-align: left; /* rtl:ignore */ diff --git a/user/tests/externallib_test.php b/user/tests/externallib_test.php index 57637629797..387bca93f6a 100644 --- a/user/tests/externallib_test.php +++ b/user/tests/externallib_test.php @@ -1271,7 +1271,7 @@ class externallib_test extends externallib_advanced_testcase { ), array( 'name' => 'htmleditor', - 'value' => 'tinymce', + 'value' => 'tiny', 'userid' => $user2->id, ) ); @@ -1284,7 +1284,7 @@ class externallib_test extends externallib_advanced_testcase { // Get preference from DB to avoid cache. $this->assertEquals('atto', $DB->get_field('user_preferences', 'value', array('userid' => $user1->id, 'name' => 'htmleditor'))); - $this->assertEquals('tinymce', $DB->get_field('user_preferences', 'value', + $this->assertEquals('tiny', $DB->get_field('user_preferences', 'value', array('userid' => $user2->id, 'name' => 'htmleditor'))); } diff --git a/version.php b/version.php index fb683246b27..e582bffdfaf 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2023022400.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2023022800.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.2dev (Build: 20230224)'; // Human-friendly version name