@wiris/mathtype-ckeditor5 8.11.1 → 8.12.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.
- package/dist/browser/index-editor.css +23 -102
- package/dist/browser/index.css +41 -111
- package/dist/browser/index.css.map +1 -1
- package/dist/browser/index.js +1344 -1965
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.umd.js +10630 -11251
- package/dist/browser/index.umd.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/plugin.js +9 -8
package/src/plugin.js
CHANGED
|
@@ -91,7 +91,7 @@ export default class MathType extends Plugin {
|
|
|
91
91
|
// etc
|
|
92
92
|
|
|
93
93
|
// There are platforms like Drupal that initialize CKEditor but they hide or remove the container element.
|
|
94
|
-
// To avoid a wrong
|
|
94
|
+
// To avoid a wrong behavior, this integration only starts if the workspace container exists.
|
|
95
95
|
let integration;
|
|
96
96
|
if (integrationProperties.target) {
|
|
97
97
|
// Instance of the integration associated to this editor instance
|
|
@@ -393,7 +393,7 @@ export default class MathType extends Plugin {
|
|
|
393
393
|
const formula = modelItem.getAttribute("formula");
|
|
394
394
|
const htmlContent = modelItem.getAttribute("htmlContent");
|
|
395
395
|
|
|
396
|
-
if(!formula && !htmlContent){
|
|
396
|
+
if (!formula && !htmlContent) {
|
|
397
397
|
return null;
|
|
398
398
|
}
|
|
399
399
|
|
|
@@ -401,7 +401,7 @@ export default class MathType extends Plugin {
|
|
|
401
401
|
|
|
402
402
|
if (htmlContent) {
|
|
403
403
|
imgElement = htmlDataProcessor.toView(htmlContent).getChild(0);
|
|
404
|
-
} else if(formula) {
|
|
404
|
+
} else if (formula) {
|
|
405
405
|
const mathString = formula.replaceAll('ref="<"', 'ref="<"');
|
|
406
406
|
|
|
407
407
|
const imgHtml = Parser.initParse(mathString, integration.getLanguage());
|
|
@@ -412,9 +412,9 @@ export default class MathType extends Plugin {
|
|
|
412
412
|
}
|
|
413
413
|
|
|
414
414
|
/* Although we use the HtmlDataProcessor to obtain the attributes,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
* we must create a new EmptyElement which is independent of the
|
|
416
|
+
* DataProcessor being used by this editor instance
|
|
417
|
+
*/
|
|
418
418
|
if (imgElement) {
|
|
419
419
|
return viewWriter.createEmptyElement("img", imgElement.getAttributes(), {
|
|
420
420
|
renderUnsafeAttributes: ["src"],
|
|
@@ -463,7 +463,8 @@ export default class MathType extends Plugin {
|
|
|
463
463
|
const htmlDataProcessor = new HtmlDataProcessor(viewWriter.document);
|
|
464
464
|
|
|
465
465
|
// Load img element
|
|
466
|
-
let mathString =
|
|
466
|
+
let mathString =
|
|
467
|
+
modelItem.getAttribute("htmlContent") || Parser.endParseSaveMode(modelItem.getAttribute("formula"));
|
|
467
468
|
|
|
468
469
|
const sourceMathElement = htmlDataProcessor.toView(mathString).getChild(0);
|
|
469
470
|
|
|
@@ -523,7 +524,7 @@ export default class MathType extends Plugin {
|
|
|
523
524
|
// If we found a formula image, we should find MathML data, and then substitute the entire image.
|
|
524
525
|
const regexp = /«math\b[^»]*»(.*?)«\/math»/g;
|
|
525
526
|
const safexml = formula.match(regexp);
|
|
526
|
-
if(safexml !== null) {
|
|
527
|
+
if (safexml !== null) {
|
|
527
528
|
let decodeXML = MathML.safeXmlDecode(safexml[0]);
|
|
528
529
|
modifiedData = modifiedData.replace(formula, decodeXML);
|
|
529
530
|
}
|