@wiris/mathtype-ckeditor5 8.7.2 → 8.8.1

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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/plugin.js +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiris/mathtype-ckeditor5",
3
- "version": "8.7.2",
3
+ "version": "8.8.1",
4
4
  "description": "MathType Web for CKEditor5 editor",
5
5
  "keywords": [
6
6
  "chem",
@@ -35,10 +35,10 @@
35
35
  "build": "exit 0"
36
36
  },
37
37
  "dependencies": {
38
- "@ckeditor/ckeditor5-core": ">=23.0.0",
39
- "@ckeditor/ckeditor5-engine": ">=23.0.0",
40
- "@ckeditor/ckeditor5-ui": ">=23.0.0",
41
- "@ckeditor/ckeditor5-widget": ">=23.0.0",
42
- "@wiris/mathtype-html-integration-devkit": "1.14.2"
38
+ "@ckeditor/ckeditor5-core": "^38.0.0",
39
+ "@ckeditor/ckeditor5-engine": "^38.0.0",
40
+ "@ckeditor/ckeditor5-ui": "^38.0.0",
41
+ "@ckeditor/ckeditor5-widget": "^38.0.0",
42
+ "@wiris/mathtype-html-integration-devkit": "1.16.0"
43
43
  }
44
44
  }
package/src/plugin.js CHANGED
@@ -438,7 +438,11 @@ export default class MathType extends Plugin {
438
438
  const regexp = /<math(.*?)<\/math>/gm;
439
439
 
440
440
  // Get all MathML formulas and store them in an array.
441
- let formulas = [...data.matchAll(regexp)];
441
+ // Using the conditional operator on data.main because the data patameter has different types depeding on:
442
+ // editor.data.set can be used directly or by the source editing plugin.
443
+ // With the source editor plugin, data is an object with the key `main` wich contains the source code string.
444
+ // When using the editor.data.set method, the data is a string with the content to be set to the editor.
445
+ let formulas = Object.values(data)[0] ? [...Object.values(data)[0].matchAll(regexp)] : [...data.matchAll(regexp)];
442
446
 
443
447
  // Loop to find LaTeX formulas and replace the MathML for the LaTeX notation.
444
448
  formulas.forEach((formula) => {