@wiris/mathtype-ckeditor5 8.3.0 → 8.4.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/plugin.js +9 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiris/mathtype-ckeditor5",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "description": "MathType Web for CKEditor5 editor",
5
5
  "keywords": [
6
6
  "chem",
@@ -39,6 +39,6 @@
39
39
  "@ckeditor/ckeditor5-engine": ">=23.0.0",
40
40
  "@ckeditor/ckeditor5-ui": ">=23.0.0",
41
41
  "@ckeditor/ckeditor5-widget": ">=23.0.0",
42
- "@wiris/mathtype-html-integration-devkit": "1.12.0"
42
+ "@wiris/mathtype-html-integration-devkit": "1.12.2"
43
43
  }
44
44
  }
package/src/plugin.js CHANGED
@@ -65,7 +65,7 @@ export default class MathType extends Plugin {
65
65
  * Inherited from Plugin class: Executed when CKEditor5 is destroyed
66
66
  */
67
67
  destroy() { // eslint-disable-line class-methods-use-this
68
- currentInstance.removeEvents();
68
+ currentInstance.destroy();
69
69
  }
70
70
 
71
71
  /**
@@ -337,7 +337,7 @@ export default class MathType extends Plugin {
337
337
  function createViewImage(modelItem, { writer: viewWriter }) {
338
338
  const htmlDataProcessor = new HtmlDataProcessor(viewWriter.document);
339
339
 
340
- const mathString = modelItem.getAttribute('formula');
340
+ const mathString = modelItem.getAttribute('formula').replace('ref="<"', 'ref="&lt;"');
341
341
  const imgHtml = Parser.initParse(mathString, editor.config.get('language'));
342
342
  const imgElement = htmlDataProcessor.toView(imgHtml).getChild(0);
343
343
 
@@ -366,10 +366,10 @@ export default class MathType extends Plugin {
366
366
  });
367
367
 
368
368
  /**
369
- * Makes a copy of the given view node.
370
- * @param {module:engine/view/node~Node} sourceNode Node to copy.
371
- * @returns {module:engine/view/node~Node} Copy of the node.
372
- */
369
+ * Makes a copy of the given view node.
370
+ * @param {module:engine/view/node~Node} sourceNode Node to copy.
371
+ * @returns {module:engine/view/node~Node} Copy of the node.
372
+ */
373
373
  function clone(viewWriter, sourceNode) {
374
374
  if (sourceNode.is('text')) {
375
375
  return viewWriter.createText(sourceNode.data);
@@ -392,11 +392,6 @@ export default class MathType extends Plugin {
392
392
 
393
393
  let mathString = Parser.endParseSaveMode(modelItem.getAttribute('formula'));
394
394
 
395
- // Remove the traces from Hand. This code should be removed once PLUGINS-1307 is solved.
396
- if (!Configuration.get('saveHandTraces')) {
397
- mathString = MathML.removeAnnotation(mathString, 'application/json');
398
- }
399
-
400
395
  const sourceMathElement = htmlDataProcessor.toView(mathString).getChild(0);
401
396
 
402
397
  return clone(viewWriter, sourceMathElement);
@@ -412,10 +407,10 @@ export default class MathType extends Plugin {
412
407
  const { get } = editor.data;
413
408
 
414
409
  /**
415
- * Hack to transform $$latex$$ into <math> in editor.getData()'s output.
416
- */
410
+ * Hack to transform $$latex$$ into <math> in editor.getData()'s output.
411
+ */
417
412
  editor.data.get = (options) => {
418
- const output = get.bind(editor.data)(options);
413
+ let output = get.bind(editor.data)(options);
419
414
  return Parser.endParse(output);
420
415
  };
421
416
  }