@wiris/mathtype-ckeditor5 8.13.1 → 8.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +133 -27
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.umd.js +132 -26
- package/dist/browser/index.umd.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/plugin.js +4 -4
package/dist/browser/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Command, Plugin } from 'ckeditor5';
|
|
2
2
|
import { ButtonView } from 'ckeditor5';
|
|
3
|
-
import { ClickObserver, XmlDataProcessor,
|
|
3
|
+
import { ClickObserver, XmlDataProcessor, ViewUpcastWriter, HtmlDataProcessor } from 'ckeditor5';
|
|
4
4
|
import { Widget, viewToModelPositionOutsideModelElement, toWidget } from 'ckeditor5';
|
|
5
5
|
|
|
6
|
-
/*! @license DOMPurify 3.2.
|
|
6
|
+
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
entries,
|
|
@@ -63,6 +63,9 @@ const typeErrorCreate = unconstruct(TypeError);
|
|
|
63
63
|
*/
|
|
64
64
|
function unapply(func) {
|
|
65
65
|
return function (thisArg) {
|
|
66
|
+
if (thisArg instanceof RegExp) {
|
|
67
|
+
thisArg.lastIndex = 0;
|
|
68
|
+
}
|
|
66
69
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
67
70
|
args[_key - 1] = arguments[_key];
|
|
68
71
|
}
|
|
@@ -204,7 +207,7 @@ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
|
204
207
|
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
|
|
205
208
|
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
|
|
206
209
|
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
207
|
-
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
210
|
+
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
208
211
|
);
|
|
209
212
|
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
210
213
|
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
@@ -292,7 +295,7 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
292
295
|
function createDOMPurify() {
|
|
293
296
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
294
297
|
const DOMPurify = root => createDOMPurify(root);
|
|
295
|
-
DOMPurify.version = '3.2.
|
|
298
|
+
DOMPurify.version = '3.2.6';
|
|
296
299
|
DOMPurify.removed = [];
|
|
297
300
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
298
301
|
// Not running in a browser, provide a factory function
|
|
@@ -531,8 +534,8 @@ function createDOMPurify() {
|
|
|
531
534
|
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
532
535
|
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
533
536
|
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
534
|
-
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
535
|
-
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
537
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
538
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
536
539
|
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
537
540
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
538
541
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
@@ -897,7 +900,7 @@ function createDOMPurify() {
|
|
|
897
900
|
allowedTags: ALLOWED_TAGS
|
|
898
901
|
});
|
|
899
902
|
/* Detect mXSS attempts abusing namespace confusion */
|
|
900
|
-
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
903
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
901
904
|
_forceRemove(currentNode);
|
|
902
905
|
return true;
|
|
903
906
|
}
|
|
@@ -1049,7 +1052,8 @@ function createDOMPurify() {
|
|
|
1049
1052
|
value: attrValue
|
|
1050
1053
|
} = attr;
|
|
1051
1054
|
const lcName = transformCaseFunc(name);
|
|
1052
|
-
|
|
1055
|
+
const initValue = attrValue;
|
|
1056
|
+
let value = name === 'value' ? initValue : stringTrim(initValue);
|
|
1053
1057
|
/* Execute a hook if present */
|
|
1054
1058
|
hookEvent.attrName = lcName;
|
|
1055
1059
|
hookEvent.attrValue = value;
|
|
@@ -1075,10 +1079,9 @@ function createDOMPurify() {
|
|
|
1075
1079
|
if (hookEvent.forceKeepAttr) {
|
|
1076
1080
|
continue;
|
|
1077
1081
|
}
|
|
1078
|
-
/* Remove attribute */
|
|
1079
|
-
_removeAttribute(name, currentNode);
|
|
1080
1082
|
/* Did the hooks approve of the attribute? */
|
|
1081
1083
|
if (!hookEvent.keepAttr) {
|
|
1084
|
+
_removeAttribute(name, currentNode);
|
|
1082
1085
|
continue;
|
|
1083
1086
|
}
|
|
1084
1087
|
/* Work around a security issue in jQuery 3.0 */
|
|
@@ -1095,6 +1098,7 @@ function createDOMPurify() {
|
|
|
1095
1098
|
/* Is `value` valid for this attribute? */
|
|
1096
1099
|
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
1097
1100
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
1101
|
+
_removeAttribute(name, currentNode);
|
|
1098
1102
|
continue;
|
|
1099
1103
|
}
|
|
1100
1104
|
/* Handle attributes that require Trusted Types */
|
|
@@ -1115,19 +1119,23 @@ function createDOMPurify() {
|
|
|
1115
1119
|
}
|
|
1116
1120
|
}
|
|
1117
1121
|
/* Handle invalid data-* attribute set by try-catching it */
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1122
|
+
if (value !== initValue) {
|
|
1123
|
+
try {
|
|
1124
|
+
if (namespaceURI) {
|
|
1125
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
1126
|
+
} else {
|
|
1127
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
1128
|
+
currentNode.setAttribute(name, value);
|
|
1129
|
+
}
|
|
1130
|
+
if (_isClobbered(currentNode)) {
|
|
1131
|
+
_forceRemove(currentNode);
|
|
1132
|
+
} else {
|
|
1133
|
+
arrayPop(DOMPurify.removed);
|
|
1134
|
+
}
|
|
1135
|
+
} catch (_) {
|
|
1136
|
+
_removeAttribute(name, currentNode);
|
|
1129
1137
|
}
|
|
1130
|
-
}
|
|
1138
|
+
}
|
|
1131
1139
|
}
|
|
1132
1140
|
/* Execute a hook if present */
|
|
1133
1141
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
@@ -6275,7 +6283,8 @@ class ContentManager {
|
|
|
6275
6283
|
this.editor = window.com.wiris.jsEditor.JsEditor.newInstance(this.editorAttributes);
|
|
6276
6284
|
this.editor.insertInto(this.modalDialogInstance.contentContainer);
|
|
6277
6285
|
this.editor.focus();
|
|
6278
|
-
|
|
6286
|
+
// `editor.action("rtl");` toggles the RTL mode based on the current state, it doesn't just switch to RTL.
|
|
6287
|
+
if (this.modalDialogInstance.rtl && !this.editor.getEditorModel().isRTL()) {
|
|
6279
6288
|
this.editor.action("rtl");
|
|
6280
6289
|
}
|
|
6281
6290
|
// Setting div in rtl in case of it's activated.
|
|
@@ -7034,6 +7043,82 @@ class Event {
|
|
|
7034
7043
|
}
|
|
7035
7044
|
}
|
|
7036
7045
|
|
|
7046
|
+
/**
|
|
7047
|
+
* This module provides protection against external focus management scripts
|
|
7048
|
+
* that might interfere with the MathType editor modal.
|
|
7049
|
+
*/ /**
|
|
7050
|
+
* focusProtection function creates and returns methods to prevent external scripts from
|
|
7051
|
+
* interfering with the focus of the MathType modal dialog.
|
|
7052
|
+
*
|
|
7053
|
+
* @returns {Object} An object with protect and unprotect methods.
|
|
7054
|
+
*/ const focusProtection = ()=>{
|
|
7055
|
+
/**
|
|
7056
|
+
* Initialize focus protection on the given modal element.
|
|
7057
|
+
*
|
|
7058
|
+
* @param {HTMLElement} modalElement - The modal element to protect
|
|
7059
|
+
* @param {HTMLElement} overlayElement - The overlay element of the modal (not used in current implementation)
|
|
7060
|
+
* @param {HTMLElement} editorElement - The editor element inside the modal
|
|
7061
|
+
*/ const protect = (modalElement, overlayElement, editorElement)=>{
|
|
7062
|
+
if (!modalElement || !overlayElement || !editorElement) {
|
|
7063
|
+
console.warn("FocusProtection: Missing required elements");
|
|
7064
|
+
return;
|
|
7065
|
+
}
|
|
7066
|
+
// Apply the focus protection
|
|
7067
|
+
overrideFocusBehavior(modalElement, editorElement);
|
|
7068
|
+
};
|
|
7069
|
+
/**
|
|
7070
|
+
* Apply focus protection by overriding focus-related methods
|
|
7071
|
+
*
|
|
7072
|
+
* @param {HTMLElement} modalElement - The modal element
|
|
7073
|
+
* @param {HTMLElement} editorElement - The editor element to keep focused
|
|
7074
|
+
* @private
|
|
7075
|
+
*/ const overrideFocusBehavior = (modalElement, editorElement)=>{
|
|
7076
|
+
// Store original focus methods to be able to restore them
|
|
7077
|
+
const originalElementFocus = HTMLElement.prototype.focus;
|
|
7078
|
+
const originalElementBlur = HTMLElement.prototype.blur;
|
|
7079
|
+
// Override the focus method for all elements
|
|
7080
|
+
HTMLElement.prototype.focus = function(...args) {
|
|
7081
|
+
// If the modal is open and this is not part of the modal, prevent focus
|
|
7082
|
+
if (modalElement.style.display !== "none" && !modalElement.contains(this) && this !== document.body) {
|
|
7083
|
+
// If some external script is trying to focus another element, prevent it
|
|
7084
|
+
// and restore focus to the editor
|
|
7085
|
+
if (editorElement) {
|
|
7086
|
+
// Use the original focus method to avoid infinite recursion
|
|
7087
|
+
originalElementFocus.apply(editorElement, args);
|
|
7088
|
+
}
|
|
7089
|
+
return;
|
|
7090
|
+
}
|
|
7091
|
+
// Otherwise, allow the focus to happen
|
|
7092
|
+
originalElementFocus.apply(this, args);
|
|
7093
|
+
};
|
|
7094
|
+
// Store the methods to remove them when the modal is closed
|
|
7095
|
+
modalElement.originalElementFocus = originalElementFocus;
|
|
7096
|
+
modalElement.originalElementBlur = originalElementBlur;
|
|
7097
|
+
};
|
|
7098
|
+
/**
|
|
7099
|
+
* Remove focus protection from the modal
|
|
7100
|
+
*
|
|
7101
|
+
* @param {HTMLElement} modalElement - The modal element to unprotect
|
|
7102
|
+
*/ const unprotect = (modalElement)=>{
|
|
7103
|
+
if (!modalElement) {
|
|
7104
|
+
return;
|
|
7105
|
+
}
|
|
7106
|
+
// Restore original focus methods
|
|
7107
|
+
if (modalElement.originalElementFocus) {
|
|
7108
|
+
HTMLElement.prototype.focus = modalElement.originalElementFocus;
|
|
7109
|
+
delete modalElement.originalElementFocus;
|
|
7110
|
+
}
|
|
7111
|
+
if (modalElement.originalElementBlur) {
|
|
7112
|
+
HTMLElement.prototype.blur = modalElement.originalElementBlur;
|
|
7113
|
+
delete modalElement.originalElementBlur;
|
|
7114
|
+
}
|
|
7115
|
+
};
|
|
7116
|
+
return {
|
|
7117
|
+
protect,
|
|
7118
|
+
unprotect
|
|
7119
|
+
};
|
|
7120
|
+
};
|
|
7121
|
+
|
|
7037
7122
|
var closeIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:cc=\"http://creativecommons.org/ns#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n viewBox=\"0 0 13.76 13.76\"\n height=\"13.76\"\n width=\"13.76\"\n id=\"svg3783\"\n version=\"1.1\">\n <metadata\n id=\"metadata3789\">\n <rdf:RDF>\n <cc:Work\n rdf:about=\"\">\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n <dc:title></dc:title>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs\n id=\"defs3787\" />\n <image\n y=\"0\"\n x=\"0\"\n id=\"image3791\"\n xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAArCAYAAADhXXHAAAAACXBIWXMAAC4jAAAuIwF4pT92AAAB\nvklEQVRYw83Z23GDMBAF0AsNhBIowSVQgjuISnAJKSEdZNOBS6CDOBUkqSC4gs2PyGhAQg92se4M\n4w8bccYW2hVumBmRdAB6ADfopQcw2SOYNoIkAL8APgB8AzgLI0/2S/iy1xkt3B9m9h0dM9/YHxM4\nJ/c4MfPkGX+y763OyYVKgUPQTXAJdC84Bg2CS6Gl4FSoF7wHmgvOhbrgzsW+8L4YJegccrEj749R\ngs7ZXGdz8wbAeNbREcDTzrHvblEgBbAUFACuy6JALJeL0E/P9sbvmBnNojcgAM+oJ58AhrlnWM5Z\nA+C9RmiokakBvIJuNTLSc7hojqY0Mo8EB6Ep2CPBm9BU7BHgKDQHqwlOguZiNcDJ0JLe4FV4iaLY\nJjF16dLqnoob+EdDs8A1QJPBtUCTwDVBo+DaoJvgNvBIR6rDl9wirbA1QIPgVgl6VwHb+dAr7Jkk\nS/Pg3mCkVOslxxV9yBFqSqTA/3N2Utkzye3pftw5OxzQ5tHeddcdzGj3o4VgClUwowgtAVOs3BpF\naA6YUnsDowhNAVNu12UUoVtgCn2+ifxp1wO42Ner4KPR5dJ2tsse2ZLvTQxbVf4AmC2z7WnSvpIA\nAAAASUVORK5CYII=\n\"\n style=\"image-rendering:optimizeQuality\"\n preserveAspectRatio=\"none\"\n height=\"13.76\"\n width=\"13.76\" />\n</svg>\n";
|
|
7038
7123
|
|
|
7039
7124
|
var closeHoverIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:cc=\"http://creativecommons.org/ns#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n viewBox=\"0 0 13.76 13.76\"\n height=\"13.76\"\n width=\"13.76\"\n id=\"svg2\"\n version=\"1.1\">\n <metadata\n id=\"metadata8\">\n <rdf:RDF>\n <cc:Work\n rdf:about=\"\">\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n <dc:title></dc:title>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs\n id=\"defs6\" />\n <image\n y=\"0\"\n x=\"0\"\n id=\"image10\"\n xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAArCAYAAADhXXHAAAAACXBIWXMAAC4jAAAuIwF4pT92AAAB\n2ElEQVRYw9XZoXPCMBTH8S+5KfDzQ29606CH3/SmQTO96aGHHn/F0Himh8eDZSblQknSJH2F0DtE\nQw8+12vyfulr7XY7LuW4qvj+DugD18AC+AE2woa+/mz07y9cF7Y8d7YPDEtjK2AsCB4BvdLYHPi0\nXawioAA3wAfQaQiKHhuFYl1QSbAL6gWrSKgEuArqBKsEaB1wKNQKVsasHybcpRhwLNQED0zsoMbz\nFwJOhWL6Cmzd2e0D14Wi1/k9di2wFNnAEtBifd9jv4GtIPgaeBOCAkzLFayr/6idWSSY6DJ8sHT9\n6VK6zRFqKwo5gQ+grnKbA/gI6gsy5wRboT7sucBOaBX21GAvNAR7KnAlNBTbNDgIGoMtwO/C0Gko\nNBZbN525tk+dJrAj4F4YGxXgVQS019DkCgarM0OjwCoDaDBYZQINAquMoJVglRnUC1YZQp1g1RB0\nJryn65jYJ0HoRGPHguDX8hsZ6VAiGX4eUrJBbHqSArdN7LLBmCcBnpvYWfHWo6E8Wge8Ar7Kj8E4\nARwcnBPBB20BE7uJBMdAU8BH/YvyBAsFp0BjwNZGi201qALXgYaAnR0hX2upAzwDj/p8raFL5I4u\n8ALc6vNfvc+ztq5al9Rh/AfwZZ/LmlMllAAAAABJRU5ErkJggg==\n\"\n style=\"image-rendering:optimizeQuality\"\n preserveAspectRatio=\"none\"\n height=\"13.76\"\n width=\"13.76\" />\n</svg>\n";
|
|
@@ -7055,6 +7140,7 @@ var maxIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<sv
|
|
|
7055
7140
|
var maxHoverIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:cc=\"http://creativecommons.org/ns#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n viewBox=\"0 0 13.44 13.76\"\n height=\"13.76\"\n width=\"13.44\"\n id=\"svg22\"\n version=\"1.1\">\n <metadata\n id=\"metadata28\">\n <rdf:RDF>\n <cc:Work\n rdf:about=\"\">\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n <dc:title></dc:title>\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <defs\n id=\"defs26\" />\n <image\n y=\"0\"\n x=\"0\"\n id=\"image30\"\n xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAArCAYAAAAOnxr+AAAACXBIWXMAAC4jAAAuIwF4pT92AAAA\nvUlEQVRYw+3ZsQ3CMBCF4d8WFekZgBqWIDUDZACmYBQWYIn0pGYAegZIexROERHRIBTdhXeVy08+\nyT4/JzMjQmWCVBjoarSugK0z3/0degKODjeyBy5Am8ysARrnnT8nM7sCa+fQLgdAAlQ6ngQVVFBB\nfzeUTK6t8VAwU328ztV6QQUVVFBBBRVUUEG9Ds41sJvZs/8GelDrlw7tAjhvmZLo9o6RD4bEGUp+\nX1My/I0T4HN4rrcASf9M/wp9ASNzIKYYz2hAAAAAAElFTkSuQmCC\n\"\n style=\"image-rendering:optimizeQuality\"\n preserveAspectRatio=\"none\"\n height=\"13.76\"\n width=\"13.44\" />\n</svg>\n";
|
|
7056
7141
|
|
|
7057
7142
|
// eslint-disable-next-line max-classes-per-file
|
|
7143
|
+
const { unprotect, protect } = focusProtection();
|
|
7058
7144
|
/**
|
|
7059
7145
|
* @typedef {Object} DeviceProperties
|
|
7060
7146
|
* @property {String} DeviceProperties.orientation - Indicates of the orientation of the device.
|
|
@@ -7498,12 +7584,28 @@ var maxHoverIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
|
|
|
7498
7584
|
}
|
|
7499
7585
|
if (!ContentManager.isEditorLoaded()) {
|
|
7500
7586
|
const listener = Listeners.newListener("onLoad", ()=>{
|
|
7501
|
-
this.
|
|
7587
|
+
this.displayEditor();
|
|
7502
7588
|
});
|
|
7503
7589
|
this.contentManager.addListener(listener);
|
|
7504
7590
|
} else {
|
|
7505
|
-
this.
|
|
7591
|
+
this.displayEditor();
|
|
7592
|
+
}
|
|
7593
|
+
}
|
|
7594
|
+
/**
|
|
7595
|
+
* Prepares and displays the editor in the modal.
|
|
7596
|
+
*
|
|
7597
|
+
* This method is responsible for displaying the MathType editor inside the modal container.
|
|
7598
|
+
*
|
|
7599
|
+
* For Moodle environments, it applies focus protection to prevent external scripts
|
|
7600
|
+
* from hijacking focus away from the editor while it's open. This is particularly
|
|
7601
|
+
* important in Moodle which may have its own focus management scripts.
|
|
7602
|
+
* @returns {void}
|
|
7603
|
+
*/ displayEditor() {
|
|
7604
|
+
if (this.contentManager.integrationModel.isMoodle) {
|
|
7605
|
+
protect(this.container, this.overlay, this.contentContainer);
|
|
7506
7606
|
}
|
|
7607
|
+
// Initialize and open the editor using the contentManager.
|
|
7608
|
+
this.contentManager.onOpen(this);
|
|
7507
7609
|
}
|
|
7508
7610
|
/**
|
|
7509
7611
|
* Closes the modal.
|
|
@@ -7512,6 +7614,8 @@ var maxHoverIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
|
|
|
7512
7614
|
* If a close trigger is defined, it tracks the telemetry event 'CLOSED_MTCT_EDITOR' with the trigger.
|
|
7513
7615
|
* @returns {Promise<void>} A promise that resolves when the modal is closed.
|
|
7514
7616
|
*/ async close(trigger) {
|
|
7617
|
+
// Remove focus protection before closing
|
|
7618
|
+
unprotect(this.container);
|
|
7515
7619
|
this.removeClass("wrs_maximized");
|
|
7516
7620
|
this.removeClass("wrs_minimized");
|
|
7517
7621
|
this.removeClass("wrs_stack");
|
|
@@ -7534,6 +7638,8 @@ var maxHoverIcon = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
|
|
|
7534
7638
|
/**
|
|
7535
7639
|
* Closes modal window and destroys the object.
|
|
7536
7640
|
*/ destroy() {
|
|
7641
|
+
// Remove focus protection before destroying
|
|
7642
|
+
unprotect(this.container);
|
|
7537
7643
|
// Close modal window.
|
|
7538
7644
|
this.close();
|
|
7539
7645
|
// Remove listeners and destroy the object.
|
|
@@ -11312,7 +11418,7 @@ var mathIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adob
|
|
|
11312
11418
|
|
|
11313
11419
|
var chemIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 40.3 49.5\" style=\"enable-background:new 0 0 40.3 49.5;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:#A4CF61;}\n</style>\n<path class=\"st0\" d=\"M39.2,12.1c0-1.9-1.1-3.6-2.7-4.4L24.5,0.9l0,0c-0.7-0.4-1.5-0.6-2.4-0.6c-0.9,0-1.7,0.2-2.4,0.6l0,0L2.3,10.8\n\tl0,0C0.9,11.7,0,13.2,0,14.9h0v19.6h0c0,1.7,0.9,3.3,2.3,4.1l0,0l17.4,9.9l0,0c0.7,0.4,1.5,0.6,2.4,0.6c0.9,0,1.7-0.2,2.4-0.6l0,0\n\tl12.2-6.9h0c1.5-0.8,2.6-2.5,2.6-4.3c0-2.7-2.2-4.9-4.9-4.9c-0.9,0-1.8,0.3-2.5,0.7l0,0l-9.7,5.6l-12.3-7V17.8l12.3-7l9.9,5.7l0,0\n\tc0.7,0.4,1.5,0.6,2.4,0.6C37,17,39.2,14.8,39.2,12.1\"/>\n</svg>\n";
|
|
11314
11420
|
|
|
11315
|
-
var version = "8.13.
|
|
11421
|
+
var version = "8.13.3";
|
|
11316
11422
|
var packageInfo = {
|
|
11317
11423
|
version: version};
|
|
11318
11424
|
|
|
@@ -11495,7 +11601,7 @@ class MathType extends Plugin {
|
|
|
11495
11601
|
const processor = new XmlDataProcessor(editor.editing.view.document);
|
|
11496
11602
|
// Only god knows why the following line makes viewItem lose all of its children,
|
|
11497
11603
|
// so we obtain isLatex before doing this because we need viewItem's children for that.
|
|
11498
|
-
const upcastWriter = new
|
|
11604
|
+
const upcastWriter = new ViewUpcastWriter(editor.editing.view.document);
|
|
11499
11605
|
const viewDocumentFragment = upcastWriter.createDocumentFragment(viewItem.getChildren());
|
|
11500
11606
|
// and obtain the attributes of <math> too!
|
|
11501
11607
|
const mathAttributes = [
|