MDL-78251 editor_tiny: Update TinyMCE to 6.6.2
Originally I changed the compiled output of TinyMCE from es2015 to es6 to try and allow our own requirejs system to serve the content. This is a change in the TinyMCE repository (or our copy of it). Unfortunately this turned out to not be possible, but I never got around to updating the configuration to stop doing so. Whilst working on this issue, I've removed this change to module compilation, which brings us closer in line to Tiny core, and simplifies the upgrade process.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* TinyMCE version 6.3.2 (2023-02-22)
|
||||
* TinyMCE version 6.6.2 (2023-08-09)
|
||||
*/
|
||||
|
||||
(function () {
|
||||
@@ -10,6 +10,8 @@
|
||||
const isNullable = a => a === null || a === undefined;
|
||||
const isNonNullable = a => !isNullable(a);
|
||||
|
||||
const noop = () => {
|
||||
};
|
||||
const constant = value => {
|
||||
return () => {
|
||||
return value;
|
||||
@@ -81,7 +83,7 @@
|
||||
}
|
||||
getOrDie(message) {
|
||||
if (!this.tag) {
|
||||
throw new Error(message ?? 'Called getOrDie on None');
|
||||
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
||||
} else {
|
||||
return this.value;
|
||||
}
|
||||
@@ -1222,7 +1224,7 @@
|
||||
Prism.languages.css = {
|
||||
'comment': /\/\*[\s\S]*?\*\//,
|
||||
'atrule': {
|
||||
pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
|
||||
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
||||
inside: {
|
||||
'rule': /^@[\w-]+/,
|
||||
'selector-function-argument': {
|
||||
@@ -1319,7 +1321,8 @@
|
||||
'operator': {
|
||||
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
||||
lookbehind: true
|
||||
}
|
||||
},
|
||||
'constant': /\b[A-Z][A-Z_\d]+\b/
|
||||
});
|
||||
Prism.languages.insertBefore('java', 'string', {
|
||||
'triple-quoted-string': {
|
||||
@@ -1549,7 +1552,10 @@
|
||||
pattern: /^=/,
|
||||
alias: 'attr-equals'
|
||||
},
|
||||
/"|'/
|
||||
{
|
||||
pattern: /^(\s*)["']|["']$/,
|
||||
lookbehind: true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -2300,7 +2306,7 @@
|
||||
type: 'panel',
|
||||
items: [
|
||||
{
|
||||
type: 'selectbox',
|
||||
type: 'listbox',
|
||||
name: 'language',
|
||||
label: 'Language',
|
||||
items: languages
|
||||
@@ -2378,10 +2384,11 @@
|
||||
if (unprocessedCodeSamples.length) {
|
||||
editor.undoManager.transact(() => {
|
||||
global.each(unprocessedCodeSamples, elm => {
|
||||
var _a;
|
||||
global.each(dom.select('br', elm), elm => {
|
||||
dom.replace(editor.getDoc().createTextNode('\n'), elm);
|
||||
});
|
||||
elm.innerHTML = dom.encode(elm.textContent ?? '');
|
||||
elm.innerHTML = dom.encode((_a = elm.textContent) !== null && _a !== void 0 ? _a : '');
|
||||
get(editor).highlightElement(elm);
|
||||
dom.setAttrib(elm, 'data-mce-highlighted', true);
|
||||
elm.className = trim(elm.className);
|
||||
@@ -2391,9 +2398,10 @@
|
||||
});
|
||||
editor.on('PreInit', () => {
|
||||
editor.parser.addNodeFilter('pre', nodes => {
|
||||
var _a;
|
||||
for (let i = 0, l = nodes.length; i < l; i++) {
|
||||
const node = nodes[i];
|
||||
const isCodeSample = node.attr('class') ?? ''.indexOf('language-') !== -1;
|
||||
const isCodeSample = ((_a = node.attr('class')) !== null && _a !== void 0 ? _a : '').indexOf('language-') !== -1;
|
||||
if (isCodeSample) {
|
||||
node.attr('contenteditable', 'false');
|
||||
node.attr('data-mce-highlighted', 'false');
|
||||
@@ -2403,6 +2411,17 @@
|
||||
});
|
||||
};
|
||||
|
||||
const onSetupEditable = (editor, onChanged = noop) => api => {
|
||||
const nodeChanged = () => {
|
||||
api.setEnabled(editor.selection.isEditable());
|
||||
onChanged(api);
|
||||
};
|
||||
editor.on('NodeChange', nodeChanged);
|
||||
nodeChanged();
|
||||
return () => {
|
||||
editor.off('NodeChange', nodeChanged);
|
||||
};
|
||||
};
|
||||
const isCodeSampleSelection = editor => {
|
||||
const node = editor.selection.getStart();
|
||||
return editor.dom.is(node, 'pre[class*="language-"]');
|
||||
@@ -2413,18 +2432,15 @@
|
||||
icon: 'code-sample',
|
||||
tooltip: 'Insert/edit code sample',
|
||||
onAction,
|
||||
onSetup: api => {
|
||||
const nodeChangeHandler = () => {
|
||||
api.setActive(isCodeSampleSelection(editor));
|
||||
};
|
||||
editor.on('NodeChange', nodeChangeHandler);
|
||||
return () => editor.off('NodeChange', nodeChangeHandler);
|
||||
}
|
||||
onSetup: onSetupEditable(editor, api => {
|
||||
api.setActive(isCodeSampleSelection(editor));
|
||||
})
|
||||
});
|
||||
editor.ui.registry.addMenuItem('codesample', {
|
||||
text: 'Code sample...',
|
||||
icon: 'code-sample',
|
||||
onAction
|
||||
onAction,
|
||||
onSetup: onSetupEditable(editor)
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user