@wiris/mathtype-ckeditor5 8.13.4 → 8.15.0

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.
@@ -3,7 +3,7 @@ import { ButtonView } from 'ckeditor5';
3
3
  import { ClickObserver, XmlDataProcessor, ViewUpcastWriter, HtmlDataProcessor } from 'ckeditor5';
4
4
  import { Widget, viewToModelPositionOutsideModelElement, toWidget } from 'ckeditor5';
5
5
 
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 */
6
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
7
7
 
8
8
  const {
9
9
  entries,
@@ -32,12 +32,18 @@ if (!seal) {
32
32
  };
33
33
  }
34
34
  if (!apply) {
35
- apply = function apply(fun, thisValue, args) {
36
- return fun.apply(thisValue, args);
35
+ apply = function apply(func, thisArg) {
36
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
37
+ args[_key - 2] = arguments[_key];
38
+ }
39
+ return func.apply(thisArg, args);
37
40
  };
38
41
  }
39
42
  if (!construct) {
40
- construct = function construct(Func, args) {
43
+ construct = function construct(Func) {
44
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
45
+ args[_key2 - 1] = arguments[_key2];
46
+ }
41
47
  return new Func(...args);
42
48
  };
43
49
  }
@@ -66,8 +72,8 @@ function unapply(func) {
66
72
  if (thisArg instanceof RegExp) {
67
73
  thisArg.lastIndex = 0;
68
74
  }
69
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
70
- args[_key - 1] = arguments[_key];
75
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
76
+ args[_key3 - 1] = arguments[_key3];
71
77
  }
72
78
  return apply(func, thisArg, args);
73
79
  };
@@ -78,12 +84,12 @@ function unapply(func) {
78
84
  * @param func - The constructor function to be wrapped and called.
79
85
  * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
80
86
  */
81
- function unconstruct(func) {
87
+ function unconstruct(Func) {
82
88
  return function () {
83
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
84
- args[_key2] = arguments[_key2];
89
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
90
+ args[_key4] = arguments[_key4];
85
91
  }
86
- return construct(func, args);
92
+ return construct(Func, args);
87
93
  };
88
94
  }
89
95
  /**
@@ -182,8 +188,8 @@ function lookupGetter(object, prop) {
182
188
  return fallbackValue;
183
189
  }
184
190
 
185
- const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
186
- const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
191
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
192
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
187
193
  const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
188
194
  // List of SVG elements that are disallowed by default.
189
195
  // We still need to know them so that we can do namespace
@@ -196,8 +202,8 @@ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mgly
196
202
  const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
197
203
  const text = freeze(['#text']);
198
204
 
199
- const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
200
- const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
205
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
206
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
201
207
  const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
202
208
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
203
209
 
@@ -295,7 +301,7 @@ const _createHooksMap = function _createHooksMap() {
295
301
  function createDOMPurify() {
296
302
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
297
303
  const DOMPurify = root => createDOMPurify(root);
298
- DOMPurify.version = '3.2.6';
304
+ DOMPurify.version = '3.3.1';
299
305
  DOMPurify.removed = [];
300
306
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
301
307
  // Not running in a browser, provide a factory function
@@ -406,6 +412,21 @@ function createDOMPurify() {
406
412
  let FORBID_TAGS = null;
407
413
  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
408
414
  let FORBID_ATTR = null;
415
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
416
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
417
+ tagCheck: {
418
+ writable: true,
419
+ configurable: false,
420
+ enumerable: true,
421
+ value: null
422
+ },
423
+ attributeCheck: {
424
+ writable: true,
425
+ configurable: false,
426
+ enumerable: true,
427
+ value: null
428
+ }
429
+ }));
409
430
  /* Decide if ARIA attributes are okay */
410
431
  let ALLOW_ARIA_ATTR = true;
411
432
  /* Decide if custom data attributes are okay */
@@ -598,16 +619,24 @@ function createDOMPurify() {
598
619
  }
599
620
  /* Merge configuration parameters */
600
621
  if (cfg.ADD_TAGS) {
601
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
602
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
622
+ if (typeof cfg.ADD_TAGS === 'function') {
623
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
624
+ } else {
625
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
626
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
627
+ }
628
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
603
629
  }
604
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
605
630
  }
606
631
  if (cfg.ADD_ATTR) {
607
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
608
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
632
+ if (typeof cfg.ADD_ATTR === 'function') {
633
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
634
+ } else {
635
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
636
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
637
+ }
638
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
609
639
  }
610
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
611
640
  }
612
641
  if (cfg.ADD_URI_SAFE_ATTR) {
613
642
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
@@ -618,6 +647,12 @@ function createDOMPurify() {
618
647
  }
619
648
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
620
649
  }
650
+ if (cfg.ADD_FORBID_CONTENTS) {
651
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
652
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
653
+ }
654
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
655
+ }
621
656
  /* Add #text in case KEEP_CONTENT is set to true */
622
657
  if (KEEP_CONTENT) {
623
658
  ALLOWED_TAGS['#text'] = true;
@@ -915,7 +950,7 @@ function createDOMPurify() {
915
950
  return true;
916
951
  }
917
952
  /* Remove element if anything forbids its presence */
918
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
953
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
919
954
  /* Check if we have a custom element to handle */
920
955
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
921
956
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -987,12 +1022,12 @@ function createDOMPurify() {
987
1022
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
988
1023
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
989
1024
  We don't need to check the value; it's always URI safe. */
990
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1025
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
991
1026
  if (
992
1027
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
993
1028
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
994
1029
  // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
995
- _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
1030
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
996
1031
  // Alternative, second condition checks if it's an `is`-attribute, AND
997
1032
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
998
1033
  lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
@@ -1071,7 +1106,12 @@ function createDOMPurify() {
1071
1106
  value = SANITIZE_NAMED_PROPS_PREFIX + value;
1072
1107
  }
1073
1108
  /* Work around a security issue with comments inside attributes */
1074
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
1109
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
1110
+ _removeAttribute(name, currentNode);
1111
+ continue;
1112
+ }
1113
+ /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
1114
+ if (lcName === 'attributename' && stringMatch(value, 'href')) {
1075
1115
  _removeAttribute(name, currentNode);
1076
1116
  continue;
1077
1117
  }
@@ -3455,6 +3495,13 @@ var translations = {
3455
3495
  }
3456
3496
  }
3457
3497
  /**
3498
+ * A map from event target to event handlers so we can remove the event
3499
+ * listeners in removeElementEvents
3500
+ *
3501
+ * @type {Map<EventTarget, Object>}
3502
+ * @static
3503
+ */ static elementEventsMap = new Map();
3504
+ /**
3458
3505
  * Adds the a callback function, for a certain event target, to the following event types:
3459
3506
  * - dblclick
3460
3507
  * - mousedown
@@ -3465,24 +3512,29 @@ var translations = {
3465
3512
  * @param {Function} mouseupHandler - function to run when on mouseup event.
3466
3513
  * @static
3467
3514
  */ static addElementEvents(eventTarget, doubleClickHandler, mousedownHandler, mouseupHandler) {
3515
+ // Make sure not to leak event listeners if we've already added events to
3516
+ // this element
3517
+ Util.removeElementEvents(eventTarget);
3518
+ let entry = {};
3519
+ Util.elementEventsMap.set(eventTarget, entry);
3468
3520
  if (doubleClickHandler) {
3469
- this.callbackDblclick = (event)=>{
3521
+ entry.callbackDblclick = (event)=>{
3470
3522
  const realEvent = event || window.event;
3471
3523
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3472
3524
  doubleClickHandler(element, realEvent);
3473
3525
  };
3474
- Util.addEvent(eventTarget, "dblclick", this.callbackDblclick);
3526
+ Util.addEvent(eventTarget, "dblclick", entry.callbackDblclick);
3475
3527
  }
3476
3528
  if (mousedownHandler) {
3477
- this.callbackMousedown = (event)=>{
3529
+ entry.callbackMousedown = (event)=>{
3478
3530
  const realEvent = event || window.event;
3479
3531
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3480
3532
  mousedownHandler(element, realEvent);
3481
3533
  };
3482
- Util.addEvent(eventTarget, "mousedown", this.callbackMousedown);
3534
+ Util.addEvent(eventTarget, "mousedown", entry.callbackMousedown);
3483
3535
  }
3484
3536
  if (mouseupHandler) {
3485
- this.callbackMouseup = (event)=>{
3537
+ entry.callbackMouseup = (event)=>{
3486
3538
  const realEvent = event || window.event;
3487
3539
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3488
3540
  mouseupHandler(element, realEvent);
@@ -3491,8 +3543,8 @@ var translations = {
3491
3543
  // while the mouse is outside the editor text field.
3492
3544
  // This is a workaround: we trigger the event independently of where the mouse
3493
3545
  // is when we release its button.
3494
- Util.addEvent(document, "mouseup", this.callbackMouseup);
3495
- Util.addEvent(eventTarget, "mouseup", this.callbackMouseup);
3546
+ Util.addEvent(document, "mouseup", entry.callbackMouseup);
3547
+ Util.addEvent(eventTarget, "mouseup", entry.callbackMouseup);
3496
3548
  }
3497
3549
  }
3498
3550
  /**
@@ -3503,10 +3555,15 @@ var translations = {
3503
3555
  * @param {EventTarget} eventTarget - event target.
3504
3556
  * @static
3505
3557
  */ static removeElementEvents(eventTarget) {
3506
- Util.removeEvent(eventTarget, "dblclick", this.callbackDblclick);
3507
- Util.removeEvent(eventTarget, "mousedown", this.callbackMousedown);
3508
- Util.removeEvent(document, "mouseup", this.callbackMouseup);
3509
- Util.removeEvent(eventTarget, "mouseup", this.callbackMouseup);
3558
+ let entry = Util.elementEventsMap.get(eventTarget);
3559
+ if (!entry) {
3560
+ return;
3561
+ }
3562
+ Util.elementEventsMap.delete(eventTarget);
3563
+ Util.removeEvent(eventTarget, "dblclick", entry.callbackDblclick);
3564
+ Util.removeEvent(eventTarget, "mousedown", entry.callbackMousedown);
3565
+ Util.removeEvent(document, "mouseup", entry.callbackMouseup);
3566
+ Util.removeEvent(eventTarget, "mouseup", entry.callbackMouseup);
3510
3567
  }
3511
3568
  /**
3512
3569
  * Adds a class name to a HTMLElement.
@@ -7230,11 +7287,11 @@ const { unprotect, protect } = focusProtection();
7230
7287
  this.closeDiv.setAttribute("role", "button");
7231
7288
  this.closeDiv.setAttribute("tabindex", 3);
7232
7289
  // Apply styles and events after the creation as createElement doesn't process them correctly
7233
- let generalStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeIcon)})`;
7234
- let hoverStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeHoverIcon)})`;
7235
- this.closeDiv.setAttribute("style", generalStyle);
7236
- this.closeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7237
- this.closeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7290
+ const generalStyleClose = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeIcon)})`;
7291
+ const hoverStyleClose = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeHoverIcon)})`;
7292
+ this.closeDiv.setAttribute("style", generalStyleClose);
7293
+ this.closeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleClose);
7294
+ this.closeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleClose);
7238
7295
  // To identifiy the element in automated testing
7239
7296
  this.closeDiv.setAttribute("data-testid", "mtcteditor-close-button");
7240
7297
  attributes = {};
@@ -7244,11 +7301,11 @@ const { unprotect, protect } = focusProtection();
7244
7301
  this.stackDiv = Util.createElement("a", attributes);
7245
7302
  this.stackDiv.setAttribute("role", "button");
7246
7303
  this.stackDiv.setAttribute("tabindex", 2);
7247
- generalStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsIcon)})`;
7248
- hoverStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsHoverIcon)})`;
7249
- this.stackDiv.setAttribute("style", generalStyle);
7250
- this.stackDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7251
- this.stackDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7304
+ const generalStyleStack = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsIcon)})`;
7305
+ const hoverStyleStack = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsHoverIcon)})`;
7306
+ this.stackDiv.setAttribute("style", generalStyleStack);
7307
+ this.stackDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleStack);
7308
+ this.stackDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleStack);
7252
7309
  // To identifiy the element in automated testing
7253
7310
  this.stackDiv.setAttribute("data-testid", "mtcteditor-fullscreen-disable-button");
7254
7311
  attributes = {};
@@ -7258,11 +7315,11 @@ const { unprotect, protect } = focusProtection();
7258
7315
  this.maximizeDiv = Util.createElement("a", attributes);
7259
7316
  this.maximizeDiv.setAttribute("role", "button");
7260
7317
  this.maximizeDiv.setAttribute("tabindex", 2);
7261
- generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsIcon)})`;
7262
- hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsHoverIcon)})`;
7263
- this.maximizeDiv.setAttribute("style", generalStyle);
7264
- this.maximizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7265
- this.maximizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7318
+ const generalStyleMaximize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsIcon)})`;
7319
+ const hoverStyleMaximize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsHoverIcon)})`;
7320
+ this.maximizeDiv.setAttribute("style", generalStyleMaximize);
7321
+ this.maximizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleMaximize);
7322
+ this.maximizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleMaximize);
7266
7323
  // To identifiy the element in automated testing
7267
7324
  this.maximizeDiv.setAttribute("data-testid", "mtcteditor-fullscreen-enable-button");
7268
7325
  attributes = {};
@@ -7272,11 +7329,11 @@ const { unprotect, protect } = focusProtection();
7272
7329
  this.minimizeDiv = Util.createElement("a", attributes);
7273
7330
  this.minimizeDiv.setAttribute("role", "button");
7274
7331
  this.minimizeDiv.setAttribute("tabindex", 1);
7275
- generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7276
- hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7277
- this.minimizeDiv.setAttribute("style", generalStyle);
7278
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7279
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7332
+ const generalStyleMinimize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7333
+ const hoverStyleMinimize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7334
+ this.minimizeDiv.setAttribute("style", generalStyleMinimize);
7335
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleMinimize);
7336
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleMinimize);
7280
7337
  // To identify the element in automated testing
7281
7338
  this.minimizeDiv.setAttribute("data-testid", "mtcteditor-minimize-button");
7282
7339
  attributes = {};
@@ -7828,8 +7885,8 @@ const { unprotect, protect } = focusProtection();
7828
7885
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7829
7886
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7830
7887
  this.minimizeDiv.setAttribute("style", generalStyle);
7831
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7832
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7888
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7889
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7833
7890
  this.restoreModalProperties();
7834
7891
  if (typeof this.resizerBR !== "undefined" && typeof this.resizerTL !== "undefined") {
7835
7892
  this.setResizeButtonsVisibility();
@@ -7871,8 +7928,8 @@ const { unprotect, protect } = focusProtection();
7871
7928
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(maxIcon)})`;
7872
7929
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(maxHoverIcon)})`;
7873
7930
  this.minimizeDiv.setAttribute("style", generalStyle);
7874
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7875
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7931
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7932
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7876
7933
  }
7877
7934
  }
7878
7935
  /**
@@ -7899,8 +7956,8 @@ const { unprotect, protect } = focusProtection();
7899
7956
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7900
7957
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7901
7958
  this.minimizeDiv.setAttribute("style", generalStyle);
7902
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7903
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7959
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7960
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7904
7961
  // Set size to 80% screen with a max size.
7905
7962
  this.setSize(parseInt(window.innerHeight * 0.8, 10), parseInt(window.innerWidth * 0.8, 10));
7906
7963
  if (this.container.clientHeight > 700) {
@@ -9689,6 +9746,8 @@ var warnIcon = "<svg width=\"16\" height=\"14\" viewBox=\"0 0 16 14\" fill=\"non
9689
9746
  * Opens formula editor to editing an existing formula. Can be overwritten in order to make some
9690
9747
  * actions from integration part before the formula is edited.
9691
9748
  */ openExistingFormulaEditor() {
9749
+ // Recover owner integration instance.
9750
+ WirisPlugin.currentInstance = this;
9692
9751
  if (window.navigator.onLine) {
9693
9752
  this.core.editionProperties.isNewElement = false;
9694
9753
  this.core.openModalDialog(this.target, this.isIframe);
@@ -9765,7 +9824,8 @@ var warnIcon = "<svg width=\"16\" height=\"14\" viewBox=\"0 0 16 14\" fill=\"non
9765
9824
  Util.addElementEvents(eventTarget, (element, event)=>{
9766
9825
  this.doubleClickHandler(element, event);
9767
9826
  // Avoid creating the double click listener more than once for each element.
9768
- event.stopImmediatePropagation();
9827
+ // This also allows CKEditor4 to add their own double click listener.
9828
+ event.preventDefault();
9769
9829
  }, (element, event)=>{
9770
9830
  this.mousedownHandler(element, event);
9771
9831
  }, (element, event)=>{
@@ -11105,11 +11165,10 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
11105
11165
  const languageObject = this.editorObject.config.get("language");
11106
11166
  if (languageObject != null) {
11107
11167
  if (typeof languageObject === "object") {
11108
- // eslint-disable-next-line no-prototype-builtins
11109
- if (languageObject.hasOwnProperty("ui")) {
11168
+ if (Object.prototype.hasOwnProperty.call(languageObject, "ui")) {
11110
11169
  return languageObject.ui;
11111
11170
  }
11112
- return languageObject;
11171
+ return this.editorObject.locale.uiLanguage;
11113
11172
  }
11114
11173
  return languageObject;
11115
11174
  }
@@ -11210,7 +11269,9 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
11210
11269
  // Remove selection
11211
11270
  if (!viewSelection.isCollapsed) {
11212
11271
  for (const range of viewSelection.getRanges()){
11213
- writer.remove(this.editorObject.editing.mapper.toModelRange(range));
11272
+ const modelRange = this.editorObject.editing.mapper.toModelRange(range);
11273
+ const modelSelection = this.editorObject.model.createSelection(modelRange);
11274
+ this.editorObject.model.deleteContent(modelSelection);
11214
11275
  }
11215
11276
  }
11216
11277
  // Set carret after the formula
@@ -11226,7 +11287,7 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
11226
11287
  if (mathml) {
11227
11288
  this.editorObject.model.insertObject(modelElementNew, position);
11228
11289
  }
11229
- writer.remove(modelElementOld);
11290
+ this.editorObject.model.deleteContent(this.editorObject.model.createSelection(modelElementOld, 'on'));
11230
11291
  }
11231
11292
  // eslint-disable-next-line consistent-return
11232
11293
  return modelElementNew;
@@ -11297,7 +11358,8 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
11297
11358
  range = writer.createRange(startPosition, endPosition);
11298
11359
  }
11299
11360
  }
11300
- writer.remove(range);
11361
+ const modelSelection = this.editorObject.model.createSelection(range);
11362
+ this.editorObject.model.deleteContent(modelSelection);
11301
11363
  writer.insertText(`$$${returnObject.latex}$$`, startNode.getAttributes(), startPosition);
11302
11364
  });
11303
11365
  } else {
@@ -11418,7 +11480,7 @@ var mathIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adob
11418
11480
 
11419
11481
  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";
11420
11482
 
11421
- var version = "8.13.4";
11483
+ var version = "8.15.0";
11422
11484
  var packageInfo = {
11423
11485
  version: version};
11424
11486
 
@@ -11438,7 +11500,9 @@ class MathType extends Plugin {
11438
11500
  const integration = this._addIntegration();
11439
11501
  currentInstance = integration;
11440
11502
  // Add the MathType and ChemType commands to the editor
11441
- this._addCommands();
11503
+ this._addCommands(integration);
11504
+ // Add the track changes feature integration
11505
+ this._addTrackChangesIntegration(integration);
11442
11506
  // Add the buttons for MathType and ChemType
11443
11507
  this._addViews(integration);
11444
11508
  // Registers the <mathml> element in the schema
@@ -11878,6 +11942,18 @@ class MathType extends Plugin {
11878
11942
  Latex
11879
11943
  };
11880
11944
  }
11945
+ _addTrackChangesIntegration(integration) {
11946
+ const { editor } = this;
11947
+ if (editor.plugins.has("TrackChangesEditing")) {
11948
+ const trackChangesEditing = editor.plugins.get("TrackChangesEditing");
11949
+ // Makes MathType and ChemType buttons available when editor is in the track changes mode
11950
+ trackChangesEditing.enableCommand("MathType");
11951
+ trackChangesEditing.enableCommand("ChemType");
11952
+ // Adds custom label replacing the default 'mathml'.
11953
+ // Handles both singular and plural forms.
11954
+ trackChangesEditing.descriptionFactory.registerElementLabel("mathml", (quantity)=>(quantity > 1 ? quantity + ' ' : '') + StringManager.get(quantity > 1 ? "formulas" : "formula", integration.getLanguage()));
11955
+ }
11956
+ }
11881
11957
  }
11882
11958
 
11883
11959
  export { CKEditor5Integration, ChemTypeCommand, MathTypeCommand, MathType as default };