MDL-77308 core: Remove editor_tiny from core

This commit is contained in:
Andrew Nicols
2023-03-09 15:28:35 +08:00
parent 0c0f6bffd8
commit f58a71baab
19 changed files with 53 additions and 98 deletions
-1
View File
@@ -20,7 +20,6 @@
*~
#
/config.php
/lib/editor/tinymce/extra/tools/temp/
/tags
/TAGS
/cscope.*
-6
View File
@@ -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);
}
}
-1
View File
@@ -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',
@@ -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"
+6 -13
View File
@@ -25,12 +25,6 @@
* @copyright 2011 David Mudrak <[email protected]>
* @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'
),
+21
View File
@@ -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;
}
+3 -3
View File
@@ -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);
+3 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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);
-14
View File
@@ -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,
+10 -10
View File
@@ -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);
}
+2 -6
View File
@@ -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
],
];
}
+1
View File
@@ -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 ===
+1 -2
View File
@@ -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 */
-11
View File
@@ -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;
+1 -12
View File
@@ -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 */
+1 -12
View File
@@ -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 */
+2 -2
View File
@@ -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')));
}
+1 -1
View File
@@ -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