MDL-75078 editor_tiny: Improve configuration specification

Part of MDL-75966
This commit is contained in:
Andrew Nicols
2022-11-10 19:52:52 +08:00
parent 05000e3e8b
commit 603c50e1be
16 changed files with 527 additions and 114 deletions
+19 -1
View File
@@ -171,10 +171,28 @@ class editor extends \texteditor {
// File picker options.
'filepicker' => $fpoptions,
'currentLanguage' => current_language(),
// Language options.
'language' => [
'currentlang' => current_language(),
'installed' => get_string_manager()->get_list_of_translations(true),
'available' => get_string_manager()->get_list_of_languages()
],
// Plugin configuration.
'plugins' => $this->manager->get_plugin_configuration($context, $options, $fpoptions),
'plugins' => $this->manager->get_plugin_configuration($context, $options, $fpoptions, $this),
];
foreach ($fpoptions as $fp) {
// Guess the draftitemid for the editor.
// Note: This is the best we can do at the moment.
if (!empty($fp->itemid)) {
$config->draftitemid = $fp->itemid;
break;
}
}
$configoptions = json_encode(convert_to_array($config));
// Note: This is not ideal but the editor does not have control over any HTML output.