@wiris/mathtype-ckeditor5 7.31.0 → 8.0.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/package.json +3 -3
- package/src/plugin.js +15 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiris/mathtype-ckeditor5",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "MathType Web for CKEditor5 editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chem",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
],
|
|
33
33
|
"main": "src/plugin.js",
|
|
34
34
|
"scripts": {
|
|
35
|
-
"
|
|
35
|
+
"build": "exit 0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ckeditor/ckeditor5-core": ">=23.0.0",
|
|
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.
|
|
42
|
+
"@wiris/mathtype-html-integration-devkit": "1.9.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/src/plugin.js
CHANGED
|
@@ -256,6 +256,11 @@ export default class MathType extends Plugin {
|
|
|
256
256
|
// And obtain the complete formula
|
|
257
257
|
formula = `<math${mathAttributes}>${formula}</math>`;
|
|
258
258
|
|
|
259
|
+
// Skip if mathml contains a XSS injection
|
|
260
|
+
if (Util.containsXSS(formula)) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
259
264
|
/* Model node that contains what's going to actually be inserted. This can be either:
|
|
260
265
|
- A <mathml> element with a formula attribute set to the given formula, or
|
|
261
266
|
- If the original <math> had a LaTeX annotation, then the annotation surrounded by "$$...$$" */
|
|
@@ -324,7 +329,9 @@ export default class MathType extends Plugin {
|
|
|
324
329
|
|
|
325
330
|
const mathUIElement = createViewImage(modelItem, { writer: viewWriter }); // eslint-disable-line no-use-before-define
|
|
326
331
|
|
|
327
|
-
|
|
332
|
+
if (mathUIElement) {
|
|
333
|
+
viewWriter.insert(viewWriter.createPositionAt(widgetElement, 0), mathUIElement);
|
|
334
|
+
}
|
|
328
335
|
|
|
329
336
|
return toWidget(widgetElement, viewWriter);
|
|
330
337
|
}
|
|
@@ -339,9 +346,13 @@ export default class MathType extends Plugin {
|
|
|
339
346
|
/* Although we use the HtmlDataProcessor to obtain the attributes,
|
|
340
347
|
we must create a new EmptyElement which is independent of the
|
|
341
348
|
DataProcessor being used by this editor instance */
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
349
|
+
if (imgElement) {
|
|
350
|
+
return viewWriter.createEmptyElement('img', imgElement.getAttributes(), {
|
|
351
|
+
renderUnsafeAttributes: ['src'],
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return null;
|
|
345
356
|
}
|
|
346
357
|
|
|
347
358
|
// Model -> Editing view
|