Merge branch 'MDL-83668-405' of https://github.com/srobotta/moodle into MOODLE_405_STABLE

This commit is contained in:
Jun Pataleta 2025-01-07 13:56:42 +08:00
commit 212dbbade5
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
7 changed files with 16 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -257,7 +257,7 @@ const getStandardConfig = (target, tinyMCE, options, plugins) => {
// Add specific rules to the valid elements.
// eslint-disable-next-line camelcase
extended_valid_elements: 'script[*],p[*],i[*]',
extended_valid_elements: options.extended_valid_elements,
// Disable XSS Sanitisation.
// We do this in PHP.

View File

@ -178,6 +178,7 @@ class editor extends \texteditor {
'currentLanguage' => current_language(),
'branding' => property_exists($siteconfig, 'branding') ? !empty($siteconfig->branding) : true,
'extended_valid_elements' => $siteconfig->extended_valid_elements ?? 'script[*],p[*],i[*]',
// Language options.
'language' => [

View File

@ -28,6 +28,8 @@ $string['settings'] = 'General settings';
$string['privacy:reason'] = 'The TinyMCE editor does not store any preferences or user data.';
$string['branding'] = 'TinyMCE branding';
$string['branding_desc'] = 'Support TinyMCE by displaying the logo in the bottom corner of the text editor. The logo links to the TinyMCE website.';
$string['extended_valid_elements'] = 'Extended valid elements';
$string['extended_valid_elements_desc'] = 'This allows you to use additional HTML elements and attributes in the editor.';
$string['plugin_enabled'] = '{$a} enabled.';
$string['plugin_disabled'] = '{$a} disabled.';
$string['subplugintype_tiny'] = 'TinyMCE plugin';

View File

@ -43,6 +43,15 @@ if ($ADMIN->fulltree) {
);
$settings->add($setting);
$setting = new admin_setting_configtext(
'editor_tiny/extended_valid_elements',
new lang_string('extended_valid_elements', 'editor_tiny'),
new lang_string('extended_valid_elements_desc', 'editor_tiny'),
'script[*],p[*],i[*]'
);
$settings->add($setting);
}
// Note: We add editortiny to the settings page here manually rather than deferring to the plugininfo class.

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024100700; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024100701; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024100100;
$plugin->component = 'editor_tiny'; // Full name of the plugin (used for diagnostics).