@wiris/mathtype-ckeditor5 8.8.2 → 8.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiris/mathtype-ckeditor5",
3
- "version": "8.8.2",
3
+ "version": "8.8.3",
4
4
  "description": "MathType Web for CKEditor5 editor",
5
5
  "keywords": [
6
6
  "chem",
@@ -39,6 +39,6 @@
39
39
  "@ckeditor/ckeditor5-engine": "^38.0.0",
40
40
  "@ckeditor/ckeditor5-ui": "^38.0.0",
41
41
  "@ckeditor/ckeditor5-widget": "^38.0.0",
42
- "@wiris/mathtype-html-integration-devkit": "1.16.1"
42
+ "@wiris/mathtype-html-integration-devkit": "1.16.2"
43
43
  }
44
44
  }
package/src/plugin.js CHANGED
@@ -24,8 +24,8 @@ import StringManager from '@wiris/mathtype-html-integration-devkit/src/stringman
24
24
  import { MathTypeCommand, ChemTypeCommand } from './commands';
25
25
  import CKEditor5Integration from './integration';
26
26
 
27
- import mathIcon from '../theme/icons/formula.svg';
28
- import chemIcon from '../theme/icons/chem.svg';
27
+ import mathIcon from '../theme/icons/ckeditor5-formula.svg';
28
+ import chemIcon from '../theme/icons/ckeditor5-chem.svg';
29
29
 
30
30
  import packageInfo from '../package.json';
31
31
 
@@ -55,7 +55,7 @@ export default class MathType extends Plugin {
55
55
  this._addSchema();
56
56
 
57
57
  // Add the downcast and upcast converters
58
- this._addConverters();
58
+ this._addConverters(integration);
59
59
 
60
60
  // Expose the WirisPlugin variable to the window
61
61
  this._exposeWiris();
@@ -76,9 +76,9 @@ export default class MathType extends Plugin {
76
76
  const { editor } = this;
77
77
 
78
78
  /**
79
- * Integration model constructor attributes.
80
- * @type {integrationModelProperties}
81
- */
79
+ * Integration model constructor attributes.
80
+ * @type {integrationModelProperties}
81
+ */
82
82
  const integrationProperties = {};
83
83
  integrationProperties.environment = {};
84
84
  integrationProperties.environment.editor = 'CKEditor5';
@@ -144,9 +144,8 @@ export default class MathType extends Plugin {
144
144
 
145
145
  // View is enabled iff command is enabled
146
146
  view.bind('isEnabled').to(editor.commands.get('MathType'), 'isEnabled');
147
-
148
147
  view.set({
149
- label: StringManager.get('insert_math', editor.config.get('language')),
148
+ label: StringManager.get('insert_math', integration.getLanguage()),
150
149
  icon: mathIcon,
151
150
  tooltip: true,
152
151
  });
@@ -172,7 +171,7 @@ export default class MathType extends Plugin {
172
171
  view.bind('isEnabled').to(editor.commands.get('ChemType'), 'isEnabled');
173
172
 
174
173
  view.set({
175
- label: StringManager.get('insert_chem', editor.config.get('language')),
174
+ label: StringManager.get('insert_chem', integration.getLanguage()),
176
175
  icon: chemIcon,
177
176
  tooltip: true,
178
177
  });
@@ -207,7 +206,7 @@ export default class MathType extends Plugin {
207
206
  /**
208
207
  * Add the downcast and upcast converters
209
208
  */
210
- _addConverters() {
209
+ _addConverters(integration) {
211
210
  const { editor } = this;
212
211
 
213
212
  // Editing view -> Model
@@ -267,7 +266,7 @@ export default class MathType extends Plugin {
267
266
  - A <mathml> element with a formula attribute set to the given formula, or
268
267
  - If the original <math> had a LaTeX annotation, then the annotation surrounded by "$$...$$" */
269
268
  const modelNode = isLatex
270
- ? writer.createText(Parser.initParse(formula, editor.config.get('language')))
269
+ ? writer.createText(Parser.initParse(formula, integration.getLanguage()))
271
270
  : writer.createElement('mathml', { formula });
272
271
 
273
272
  // Find allowed parent for element that we are going to insert.
@@ -342,7 +341,7 @@ export default class MathType extends Plugin {
342
341
  const htmlDataProcessor = new HtmlDataProcessor(viewWriter.document);
343
342
 
344
343
  const mathString = modelItem.getAttribute('formula').replaceAll('ref="<"', 'ref="&lt;"');
345
- const imgHtml = Parser.initParse(mathString, editor.config.get('language'));
344
+ const imgHtml = Parser.initParse(mathString, integration.getLanguage());
346
345
  const imgElement = htmlDataProcessor.toView(imgHtml).getChild(0);
347
346
 
348
347
  /* Although we use the HtmlDataProcessor to obtain the attributes,
@@ -415,7 +414,7 @@ export default class MathType extends Plugin {
415
414
  */
416
415
  editor.data.get = (options) => {
417
416
  let output = get.bind(editor.data)(options);
418
-
417
+
419
418
  // CKEditor 5 replaces all the time the &lt; and &gt; for < and >, which our render can't understand.
420
419
  // We replace the values inserted for CKEditro5 to be able to render the formulas with the mentioned characters.
421
420
  output = output.replaceAll('"<"', '"&lt;"')
@@ -452,10 +451,10 @@ export default class MathType extends Plugin {
452
451
  modifiedData = modifiedData.replace(mathml, latex);
453
452
  }
454
453
  });
455
-
454
+
456
455
  // Run the setData code from CKEditor5 with the modified string.
457
- set.bind(editor.data)(modifiedData);
458
- };
456
+ set.bind(editor.data)(modifiedData);
457
+ };
459
458
  }
460
459
 
461
460
  /**
File without changes