@wiris/mathtype-ckeditor5 8.13.2 → 8.13.4

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.
@@ -1,6 +1,6 @@
1
1
  import { Command, Plugin } from 'ckeditor5';
2
2
  import { ButtonView } from 'ckeditor5';
3
- import { ClickObserver, XmlDataProcessor, UpcastWriter, HtmlDataProcessor } from 'ckeditor5';
3
+ import { ClickObserver, XmlDataProcessor, ViewUpcastWriter, HtmlDataProcessor } from 'ckeditor5';
4
4
  import { Widget, viewToModelPositionOutsideModelElement, toWidget } from 'ckeditor5';
5
5
 
6
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 */
@@ -11418,7 +11418,7 @@ var mathIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adob
11418
11418
 
11419
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";
11420
11420
 
11421
- var version = "8.13.2";
11421
+ var version = "8.13.4";
11422
11422
  var packageInfo = {
11423
11423
  version: version};
11424
11424
 
@@ -11601,7 +11601,7 @@ class MathType extends Plugin {
11601
11601
  const processor = new XmlDataProcessor(editor.editing.view.document);
11602
11602
  // Only god knows why the following line makes viewItem lose all of its children,
11603
11603
  // so we obtain isLatex before doing this because we need viewItem's children for that.
11604
- const upcastWriter = new UpcastWriter(editor.editing.view.document);
11604
+ const upcastWriter = new ViewUpcastWriter(editor.editing.view.document);
11605
11605
  const viewDocumentFragment = upcastWriter.createDocumentFragment(viewItem.getChildren());
11606
11606
  // and obtain the attributes of <math> too!
11607
11607
  const mathAttributes = [
@@ -11655,6 +11655,32 @@ class MathType extends Plugin {
11655
11655
  if (viewItem.getClassNames().next().value !== "Wirisformula") {
11656
11656
  return;
11657
11657
  }
11658
+ // The following code ensures that the element's name, attributes, and classes are consumed.
11659
+ // This means that they are marked as handled so that other parts of the system or plugins don't process them again.
11660
+ // Check if we can consume the element name.
11661
+ if (!consumable.test(viewItem, {
11662
+ name: true
11663
+ })) {
11664
+ return;
11665
+ }
11666
+ // Consume the name, attributes, and classes so nothing else processes it.
11667
+ consumable.consume(viewItem, {
11668
+ name: true
11669
+ });
11670
+ for (const attrName of viewItem.getAttributes()){
11671
+ consumable.consume(viewItem, {
11672
+ attributes: [
11673
+ attrName
11674
+ ]
11675
+ });
11676
+ }
11677
+ for (const className of viewItem.getClassNames()){
11678
+ consumable.consume(viewItem, {
11679
+ classes: [
11680
+ className
11681
+ ]
11682
+ });
11683
+ }
11658
11684
  const mathAttributes = [
11659
11685
  ...viewItem.getAttributes()
11660
11686
  ].map(([key, value])=>` ${key}="${value}"`).join("");
@@ -11690,6 +11716,9 @@ class MathType extends Plugin {
11690
11716
  // Otherwise just continue after inserted element.
11691
11717
  data.modelCursor = data.modelRange.end;
11692
11718
  }
11719
+ }, // Ensures MathType processes the Wiris formulas before other plugins, preventing conflicts.
11720
+ {
11721
+ priority: "high"
11693
11722
  });
11694
11723
  /**
11695
11724
  * Whether the given view <math> element has a LaTeX annotation element.