Merge branch 'MDL-80257-main' of https://github.com/meirzamoodle/moodle
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,3 +1,3 @@
|
||||
define("editor_tiny/options",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.registerPlaceholderSelectors=_exports.register=_exports.getPluginOptionName=_exports.getPlaceholderSelectors=_exports.getNestedMenu=_exports.getMoodleLang=_exports.getInitialPluginConfiguration=_exports.getFilepickers=_exports.getFilePicker=_exports.getDraftItemId=_exports.getCurrentLanguage=_exports.getContextId=void 0;_exports.register=(editor,options)=>{const registerOption=editor.options.register,setOption=editor.options.set;registerOption("moodle:contextid",{processor:"number",default:0}),setOption("moodle:contextid",options.context),registerOption("moodle:filepickers",{processor:"object",default:{}}),setOption("moodle:filepickers",options.filepicker),registerOption("moodle:draftitemid",{processor:"number",default:0}),setOption("moodle:draftitemid",options.draftitemid),registerOption("moodle:currentLanguage",{processor:"string",default:"en"}),setOption("moodle:currentLanguage",options.currentLanguage),registerOption("moodle:language",{processor:"object",default:{}}),setOption("moodle:language",options.language),registerOption("moodle:placeholderSelectors",{processor:"array",default:[]}),setOption("moodle:placeholderSelectors",options.placeholderSelectors),registerOption("moodle:nestedmenu",{processor:"boolean",default:!1}),setOption("moodle:nestedmenu",options.nestedmenu)};_exports.getContextId=editor=>editor.options.get("moodle:contextid");_exports.getDraftItemId=editor=>editor.options.get("moodle:draftitemid");const getFilepickers=editor=>editor.options.get("moodle:filepickers");_exports.getFilepickers=getFilepickers;_exports.getFilePicker=(editor,type)=>getFilepickers(editor)[type];_exports.getMoodleLang=editor=>editor.options.get("moodle:language");_exports.getCurrentLanguage=editor=>editor.options.get("moodle:currentLanguage");_exports.getNestedMenu=editor=>editor.options.get("moodle:nestedmenu");_exports.getInitialPluginConfiguration=options=>{const config={};return Object.entries(options.plugins).forEach((_ref=>{var _pluginConfig$config;let[pluginName,pluginConfig]=_ref;Object.entries(null!==(_pluginConfig$config=pluginConfig.config)&&void 0!==_pluginConfig$config?_pluginConfig$config:{}).forEach((_ref2=>{let[optionName,value]=_ref2;config[getPluginOptionName(pluginName,optionName)]=value}))})),config};const getPluginOptionName=(pluginName,optionName)=>"".concat(pluginName,":").concat(optionName);_exports.getPluginOptionName=getPluginOptionName;const getPlaceholderSelectors=editor=>editor.options.get("moodle:placeholderSelectors");_exports.getPlaceholderSelectors=getPlaceholderSelectors;_exports.registerPlaceholderSelectors=(editor,selectors)=>{if(selectors.length){let existingData=getPlaceholderSelectors(editor);existingData=existingData.concat(selectors),editor.options.set("moodle:placeholderSelectors",existingData)}}}));
|
||||
define("editor_tiny/options",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.registerPlaceholderSelectors=_exports.register=_exports.getPluginOptionName=_exports.getPlaceholderSelectors=_exports.getMoodleLang=_exports.getInitialPluginConfiguration=_exports.getFilepickers=_exports.getFilePicker=_exports.getDraftItemId=_exports.getCurrentLanguage=_exports.getContextId=void 0;_exports.register=(editor,options)=>{const registerOption=editor.options.register,setOption=editor.options.set;registerOption("moodle:contextid",{processor:"number",default:0}),setOption("moodle:contextid",options.context),registerOption("moodle:filepickers",{processor:"object",default:{}}),setOption("moodle:filepickers",options.filepicker),registerOption("moodle:draftitemid",{processor:"number",default:0}),setOption("moodle:draftitemid",options.draftitemid),registerOption("moodle:currentLanguage",{processor:"string",default:"en"}),setOption("moodle:currentLanguage",options.currentLanguage),registerOption("moodle:language",{processor:"object",default:{}}),setOption("moodle:language",options.language),registerOption("moodle:placeholderSelectors",{processor:"array",default:[]}),setOption("moodle:placeholderSelectors",options.placeholderSelectors)};_exports.getContextId=editor=>editor.options.get("moodle:contextid");_exports.getDraftItemId=editor=>editor.options.get("moodle:draftitemid");const getFilepickers=editor=>editor.options.get("moodle:filepickers");_exports.getFilepickers=getFilepickers;_exports.getFilePicker=(editor,type)=>getFilepickers(editor)[type];_exports.getMoodleLang=editor=>editor.options.get("moodle:language");_exports.getCurrentLanguage=editor=>editor.options.get("moodle:currentLanguage");_exports.getInitialPluginConfiguration=options=>{const config={};return Object.entries(options.plugins).forEach((_ref=>{var _pluginConfig$config;let[pluginName,pluginConfig]=_ref;Object.entries(null!==(_pluginConfig$config=pluginConfig.config)&&void 0!==_pluginConfig$config?_pluginConfig$config:{}).forEach((_ref2=>{let[optionName,value]=_ref2;config[getPluginOptionName(pluginName,optionName)]=value}))})),config};const getPluginOptionName=(pluginName,optionName)=>"".concat(pluginName,":").concat(optionName);_exports.getPluginOptionName=getPluginOptionName;const getPlaceholderSelectors=editor=>editor.options.get("moodle:placeholderSelectors");_exports.getPlaceholderSelectors=getPlaceholderSelectors;_exports.registerPlaceholderSelectors=(editor,selectors)=>{if(selectors.length){let existingData=getPlaceholderSelectors(editor);existingData=existingData.concat(selectors),editor.options.set("moodle:placeholderSelectors",existingData)}}}));
|
||||
|
||||
//# sourceMappingURL=options.min.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -174,68 +174,6 @@ const getPlugins = ({plugins = null} = {}) => {
|
||||
return {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Nest the dropdown menu inside the parent DOM.
|
||||
*
|
||||
* The TinyMCE menu has a significant issue with the Overflow style,
|
||||
* and the Boost theme heavily uses Overflow for drawer navigation.
|
||||
* Moving the menu container into the parent editor container makes it work correctly.
|
||||
*
|
||||
* @param {object} editor
|
||||
*/
|
||||
const nestMenu = (editor) => {
|
||||
const container = editor.getContainer();
|
||||
const menuContainer = document.querySelector('body > .tox.tox-tinymce-aux');
|
||||
container.parentNode.appendChild(menuContainer);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fix the Tiny menu position if the editor is in fullscreen mode on the Boost theme.
|
||||
*
|
||||
* The boost theme makes the TinyMCE editor rendered in a scrollable container,
|
||||
* scrolling the editor’s container will cause TinyMCE UI elements to be detached from the anchor.
|
||||
* Therefore, to keep the tinyMCE menu in the correct position,
|
||||
* adjustments must be made on the page drawers style.
|
||||
*
|
||||
* @param {object} params
|
||||
* @param {Boolean} params.open True if editor in fullscreen mode, otherwise false.
|
||||
*/
|
||||
const fixMenuPositionIfInFullsreen = (params) => {
|
||||
if (params.open) {
|
||||
// Keep the menu remains visible and properly aligned.
|
||||
document.querySelector('.tox-fullscreen').style.overflow = 'unset';
|
||||
}
|
||||
|
||||
const pageWithDrawers = document.querySelector('#page.drawers');
|
||||
if (pageWithDrawers) {
|
||||
pageWithDrawers.style.overflow = params.open ? "unset" : "";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fix the dialogue window positioning issue of TinyMCE editor in Safari browsers.
|
||||
*
|
||||
* When using TinyMCE editor in Safari browsers, a problem may occur where the dialogue
|
||||
* windows (such as modal dialogs) overlap with page drawers due to a specific behavior
|
||||
* in Safari's rendering. This function addresses the issue by adjusting the CSS overflow
|
||||
* property of the page drawers, ensuring they do not obscure the dialogue windows.
|
||||
*
|
||||
* @param {object} params
|
||||
* @param {object} params.browser Browser environment.
|
||||
* @param {object} params.fsplugin Fullscreen plugin.
|
||||
* @param {Boolean} params.open True if the dialogue window opens, otherwise false.
|
||||
*/
|
||||
const fixDialoguePositionIfOpen = (params) => {
|
||||
// To avoid modification the existing overflow value that has been set fixMenuPositionIfInFullsreen(),
|
||||
// the fix only applied if the editor not in fullscreen mode.
|
||||
if (params.browser.isSafari() && !params.fsplugin.isFullscreen()) {
|
||||
const pageWithDrawers = document.querySelector('#page.drawers');
|
||||
if (pageWithDrawers) {
|
||||
pageWithDrawers.style.overflow = params.open ? "unset" : "";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adjust the editor size base on the target element.
|
||||
*
|
||||
@@ -359,6 +297,11 @@ const getStandardConfig = (target, tinyMCE, options, plugins) => {
|
||||
// eslint-disable-next-line camelcase
|
||||
entity_encoding: "raw",
|
||||
|
||||
// Enable support for editors in scrollable containers.
|
||||
// https://www.tiny.cloud/docs/tinymce/6/ui-mode-configuration-options/#ui_mode
|
||||
// eslint-disable-next-line camelcase
|
||||
ui_mode: 'split',
|
||||
|
||||
setup: (editor) => {
|
||||
Options.register(editor, options);
|
||||
|
||||
@@ -377,32 +320,6 @@ const getStandardConfig = (target, tinyMCE, options, plugins) => {
|
||||
adjustEditorSize(editor, target);
|
||||
});
|
||||
|
||||
editor.on('PostRender', function() {
|
||||
// Nest menu if set.
|
||||
if (options.nestedmenu) {
|
||||
nestMenu(editor);
|
||||
}
|
||||
});
|
||||
|
||||
// The Boost and Classic theme cause issues if editor is in fullscreen mode.
|
||||
// The problem was resolved by changing the overflow value to related elements.
|
||||
editor.on('FullscreenStateChanged', function(e) {
|
||||
fixMenuPositionIfInFullsreen({
|
||||
open: e.state
|
||||
});
|
||||
});
|
||||
|
||||
// The Boost theme uses Overflow=auto in the course index drawer,
|
||||
// it causes the dialogue window to be not correctly displayed in Safari browser.
|
||||
// The problem was resolved by changing the overflow value to the drawer.
|
||||
editor.on('OpenWindow CloseWindow', function(e) {
|
||||
fixDialoguePositionIfOpen({
|
||||
browser: tinyMCE.Env.browser,
|
||||
fsplugin: editor.plugins.fullscreen,
|
||||
open: e.type == "openwindow"
|
||||
});
|
||||
});
|
||||
|
||||
target.addEventListener('form:editorUpdated', function() {
|
||||
updateEditorState(editor, target);
|
||||
});
|
||||
|
||||
@@ -27,7 +27,6 @@ const filePickers = 'moodle:filepickers';
|
||||
const optionsMoodleLang = 'moodle:language';
|
||||
const currentLanguage = 'moodle:currentLanguage';
|
||||
const optionPlaceholderSelectors = 'moodle:placeholderSelectors';
|
||||
const nestedMenu = 'moodle:nestedmenu';
|
||||
|
||||
export const register = (editor, options) => {
|
||||
const registerOption = editor.options.register;
|
||||
@@ -69,12 +68,6 @@ export const register = (editor, options) => {
|
||||
"default": [],
|
||||
});
|
||||
setOption(optionPlaceholderSelectors, options.placeholderSelectors);
|
||||
|
||||
registerOption(nestedMenu, {
|
||||
processor: 'boolean',
|
||||
"default": false,
|
||||
});
|
||||
setOption(nestedMenu, options.nestedmenu);
|
||||
};
|
||||
|
||||
export const getContextId = (editor) => editor.options.get(optionContextId);
|
||||
@@ -83,7 +76,6 @@ export const getFilepickers = (editor) => editor.options.get(filePickers);
|
||||
export const getFilePicker = (editor, type) => getFilepickers(editor)[type];
|
||||
export const getMoodleLang = (editor) => editor.options.get(optionsMoodleLang);
|
||||
export const getCurrentLanguage = (editor) => editor.options.get(currentLanguage);
|
||||
export const getNestedMenu = (editor) => editor.options.get(nestedMenu);
|
||||
|
||||
/**
|
||||
* Get a set of namespaced options for all defined plugins.
|
||||
|
||||
@@ -194,9 +194,6 @@ class editor extends \texteditor {
|
||||
|
||||
// Plugin configuration.
|
||||
'plugins' => $this->manager->get_plugin_configuration($context, $options, $fpoptions, $this),
|
||||
|
||||
// Nest menu inside parent DOM.
|
||||
'nestedmenu' => true,
|
||||
];
|
||||
|
||||
if (defined('BEHAT_SITE_RUNNING') && BEHAT_SITE_RUNNING) {
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
.jsenabled .tox-tinymce-aux {
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.jsenabled .tox-shadowhost.tox-fullscreen,
|
||||
.jsenabled .tox.tox-tinymce.tox-fullscreen {
|
||||
z-index: 1050;
|
||||
|
||||
Reference in New Issue
Block a user