@wiris/mathtype-ckeditor5 8.13.3 → 8.14.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.0 | (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.0/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.0';
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);
@@ -915,7 +944,7 @@ function createDOMPurify() {
915
944
  return true;
916
945
  }
917
946
  /* Remove element if anything forbids its presence */
918
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
947
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
919
948
  /* Check if we have a custom element to handle */
920
949
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
921
950
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -987,12 +1016,12 @@ function createDOMPurify() {
987
1016
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
988
1017
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
989
1018
  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]) {
1019
+ 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
1020
  if (
992
1021
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
993
1022
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
994
1023
  // 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)) ||
1024
+ _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
1025
  // Alternative, second condition checks if it's an `is`-attribute, AND
997
1026
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
998
1027
  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 +1100,12 @@ function createDOMPurify() {
1071
1100
  value = SANITIZE_NAMED_PROPS_PREFIX + value;
1072
1101
  }
1073
1102
  /* Work around a security issue with comments inside attributes */
1074
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
1103
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
1104
+ _removeAttribute(name, currentNode);
1105
+ continue;
1106
+ }
1107
+ /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
1108
+ if (lcName === 'attributename' && stringMatch(value, 'href')) {
1075
1109
  _removeAttribute(name, currentNode);
1076
1110
  continue;
1077
1111
  }
@@ -3455,6 +3489,13 @@ var translations = {
3455
3489
  }
3456
3490
  }
3457
3491
  /**
3492
+ * A map from event target to event handlers so we can remove the event
3493
+ * listeners in removeElementEvents
3494
+ *
3495
+ * @type {Map<EventTarget, Object>}
3496
+ * @static
3497
+ */ static elementEventsMap = new Map();
3498
+ /**
3458
3499
  * Adds the a callback function, for a certain event target, to the following event types:
3459
3500
  * - dblclick
3460
3501
  * - mousedown
@@ -3465,24 +3506,29 @@ var translations = {
3465
3506
  * @param {Function} mouseupHandler - function to run when on mouseup event.
3466
3507
  * @static
3467
3508
  */ static addElementEvents(eventTarget, doubleClickHandler, mousedownHandler, mouseupHandler) {
3509
+ // Make sure not to leak event listeners if we've already added events to
3510
+ // this element
3511
+ Util.removeElementEvents(eventTarget);
3512
+ let entry = {};
3513
+ Util.elementEventsMap.set(eventTarget, entry);
3468
3514
  if (doubleClickHandler) {
3469
- this.callbackDblclick = (event)=>{
3515
+ entry.callbackDblclick = (event)=>{
3470
3516
  const realEvent = event || window.event;
3471
3517
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3472
3518
  doubleClickHandler(element, realEvent);
3473
3519
  };
3474
- Util.addEvent(eventTarget, "dblclick", this.callbackDblclick);
3520
+ Util.addEvent(eventTarget, "dblclick", entry.callbackDblclick);
3475
3521
  }
3476
3522
  if (mousedownHandler) {
3477
- this.callbackMousedown = (event)=>{
3523
+ entry.callbackMousedown = (event)=>{
3478
3524
  const realEvent = event || window.event;
3479
3525
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3480
3526
  mousedownHandler(element, realEvent);
3481
3527
  };
3482
- Util.addEvent(eventTarget, "mousedown", this.callbackMousedown);
3528
+ Util.addEvent(eventTarget, "mousedown", entry.callbackMousedown);
3483
3529
  }
3484
3530
  if (mouseupHandler) {
3485
- this.callbackMouseup = (event)=>{
3531
+ entry.callbackMouseup = (event)=>{
3486
3532
  const realEvent = event || window.event;
3487
3533
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3488
3534
  mouseupHandler(element, realEvent);
@@ -3491,8 +3537,8 @@ var translations = {
3491
3537
  // while the mouse is outside the editor text field.
3492
3538
  // This is a workaround: we trigger the event independently of where the mouse
3493
3539
  // is when we release its button.
3494
- Util.addEvent(document, "mouseup", this.callbackMouseup);
3495
- Util.addEvent(eventTarget, "mouseup", this.callbackMouseup);
3540
+ Util.addEvent(document, "mouseup", entry.callbackMouseup);
3541
+ Util.addEvent(eventTarget, "mouseup", entry.callbackMouseup);
3496
3542
  }
3497
3543
  }
3498
3544
  /**
@@ -3503,10 +3549,15 @@ var translations = {
3503
3549
  * @param {EventTarget} eventTarget - event target.
3504
3550
  * @static
3505
3551
  */ 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);
3552
+ let entry = Util.elementEventsMap.get(eventTarget);
3553
+ if (!entry) {
3554
+ return;
3555
+ }
3556
+ Util.elementEventsMap.delete(eventTarget);
3557
+ Util.removeEvent(eventTarget, "dblclick", entry.callbackDblclick);
3558
+ Util.removeEvent(eventTarget, "mousedown", entry.callbackMousedown);
3559
+ Util.removeEvent(document, "mouseup", entry.callbackMouseup);
3560
+ Util.removeEvent(eventTarget, "mouseup", entry.callbackMouseup);
3510
3561
  }
3511
3562
  /**
3512
3563
  * Adds a class name to a HTMLElement.
@@ -7230,11 +7281,11 @@ const { unprotect, protect } = focusProtection();
7230
7281
  this.closeDiv.setAttribute("role", "button");
7231
7282
  this.closeDiv.setAttribute("tabindex", 3);
7232
7283
  // 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}";`);
7284
+ const generalStyleClose = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeIcon)})`;
7285
+ const hoverStyleClose = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeHoverIcon)})`;
7286
+ this.closeDiv.setAttribute("style", generalStyleClose);
7287
+ this.closeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleClose);
7288
+ this.closeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleClose);
7238
7289
  // To identifiy the element in automated testing
7239
7290
  this.closeDiv.setAttribute("data-testid", "mtcteditor-close-button");
7240
7291
  attributes = {};
@@ -7244,11 +7295,11 @@ const { unprotect, protect } = focusProtection();
7244
7295
  this.stackDiv = Util.createElement("a", attributes);
7245
7296
  this.stackDiv.setAttribute("role", "button");
7246
7297
  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}";`);
7298
+ const generalStyleStack = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsIcon)})`;
7299
+ const hoverStyleStack = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsHoverIcon)})`;
7300
+ this.stackDiv.setAttribute("style", generalStyleStack);
7301
+ this.stackDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleStack);
7302
+ this.stackDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleStack);
7252
7303
  // To identifiy the element in automated testing
7253
7304
  this.stackDiv.setAttribute("data-testid", "mtcteditor-fullscreen-disable-button");
7254
7305
  attributes = {};
@@ -7258,11 +7309,11 @@ const { unprotect, protect } = focusProtection();
7258
7309
  this.maximizeDiv = Util.createElement("a", attributes);
7259
7310
  this.maximizeDiv.setAttribute("role", "button");
7260
7311
  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}";`);
7312
+ const generalStyleMaximize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsIcon)})`;
7313
+ const hoverStyleMaximize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsHoverIcon)})`;
7314
+ this.maximizeDiv.setAttribute("style", generalStyleMaximize);
7315
+ this.maximizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleMaximize);
7316
+ this.maximizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleMaximize);
7266
7317
  // To identifiy the element in automated testing
7267
7318
  this.maximizeDiv.setAttribute("data-testid", "mtcteditor-fullscreen-enable-button");
7268
7319
  attributes = {};
@@ -7272,11 +7323,11 @@ const { unprotect, protect } = focusProtection();
7272
7323
  this.minimizeDiv = Util.createElement("a", attributes);
7273
7324
  this.minimizeDiv.setAttribute("role", "button");
7274
7325
  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}";`);
7326
+ const generalStyleMinimize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7327
+ const hoverStyleMinimize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7328
+ this.minimizeDiv.setAttribute("style", generalStyleMinimize);
7329
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleMinimize);
7330
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleMinimize);
7280
7331
  // To identify the element in automated testing
7281
7332
  this.minimizeDiv.setAttribute("data-testid", "mtcteditor-minimize-button");
7282
7333
  attributes = {};
@@ -7828,8 +7879,8 @@ const { unprotect, protect } = focusProtection();
7828
7879
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7829
7880
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7830
7881
  this.minimizeDiv.setAttribute("style", generalStyle);
7831
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7832
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7882
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7883
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7833
7884
  this.restoreModalProperties();
7834
7885
  if (typeof this.resizerBR !== "undefined" && typeof this.resizerTL !== "undefined") {
7835
7886
  this.setResizeButtonsVisibility();
@@ -7871,8 +7922,8 @@ const { unprotect, protect } = focusProtection();
7871
7922
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(maxIcon)})`;
7872
7923
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(maxHoverIcon)})`;
7873
7924
  this.minimizeDiv.setAttribute("style", generalStyle);
7874
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7875
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7925
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7926
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7876
7927
  }
7877
7928
  }
7878
7929
  /**
@@ -7899,8 +7950,8 @@ const { unprotect, protect } = focusProtection();
7899
7950
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7900
7951
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7901
7952
  this.minimizeDiv.setAttribute("style", generalStyle);
7902
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7903
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7953
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7954
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7904
7955
  // Set size to 80% screen with a max size.
7905
7956
  this.setSize(parseInt(window.innerHeight * 0.8, 10), parseInt(window.innerWidth * 0.8, 10));
7906
7957
  if (this.container.clientHeight > 700) {
@@ -9765,7 +9816,8 @@ var warnIcon = "<svg width=\"16\" height=\"14\" viewBox=\"0 0 16 14\" fill=\"non
9765
9816
  Util.addElementEvents(eventTarget, (element, event)=>{
9766
9817
  this.doubleClickHandler(element, event);
9767
9818
  // Avoid creating the double click listener more than once for each element.
9768
- event.stopImmediatePropagation();
9819
+ // This also allows CKEditor4 to add their own double click listener.
9820
+ event.preventDefault();
9769
9821
  }, (element, event)=>{
9770
9822
  this.mousedownHandler(element, event);
9771
9823
  }, (element, event)=>{
@@ -11105,11 +11157,10 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
11105
11157
  const languageObject = this.editorObject.config.get("language");
11106
11158
  if (languageObject != null) {
11107
11159
  if (typeof languageObject === "object") {
11108
- // eslint-disable-next-line no-prototype-builtins
11109
- if (languageObject.hasOwnProperty("ui")) {
11160
+ if (Object.prototype.hasOwnProperty.call(languageObject, "ui")) {
11110
11161
  return languageObject.ui;
11111
11162
  }
11112
- return languageObject;
11163
+ return this.editorObject.locale.uiLanguage;
11113
11164
  }
11114
11165
  return languageObject;
11115
11166
  }
@@ -11418,7 +11469,7 @@ var mathIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adob
11418
11469
 
11419
11470
  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
11471
 
11421
- var version = "8.13.3";
11472
+ var version = "8.14.0";
11422
11473
  var packageInfo = {
11423
11474
  version: version};
11424
11475
 
@@ -11655,6 +11706,32 @@ class MathType extends Plugin {
11655
11706
  if (viewItem.getClassNames().next().value !== "Wirisformula") {
11656
11707
  return;
11657
11708
  }
11709
+ // The following code ensures that the element's name, attributes, and classes are consumed.
11710
+ // This means that they are marked as handled so that other parts of the system or plugins don't process them again.
11711
+ // Check if we can consume the element name.
11712
+ if (!consumable.test(viewItem, {
11713
+ name: true
11714
+ })) {
11715
+ return;
11716
+ }
11717
+ // Consume the name, attributes, and classes so nothing else processes it.
11718
+ consumable.consume(viewItem, {
11719
+ name: true
11720
+ });
11721
+ for (const attrName of viewItem.getAttributes()){
11722
+ consumable.consume(viewItem, {
11723
+ attributes: [
11724
+ attrName
11725
+ ]
11726
+ });
11727
+ }
11728
+ for (const className of viewItem.getClassNames()){
11729
+ consumable.consume(viewItem, {
11730
+ classes: [
11731
+ className
11732
+ ]
11733
+ });
11734
+ }
11658
11735
  const mathAttributes = [
11659
11736
  ...viewItem.getAttributes()
11660
11737
  ].map(([key, value])=>` ${key}="${value}"`).join("");
@@ -11690,6 +11767,9 @@ class MathType extends Plugin {
11690
11767
  // Otherwise just continue after inserted element.
11691
11768
  data.modelCursor = data.modelRange.end;
11692
11769
  }
11770
+ }, // Ensures MathType processes the Wiris formulas before other plugins, preventing conflicts.
11771
+ {
11772
+ priority: "high"
11693
11773
  });
11694
11774
  /**
11695
11775
  * Whether the given view <math> element has a LaTeX annotation element.