@wiris/mathtype-ckeditor5 7.31.0 → 8.1.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 +13 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiris/mathtype-ckeditor5",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.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
|
@@ -143,7 +143,7 @@ export default class MathType extends Plugin {
|
|
|
143
143
|
view.bind('isEnabled').to(editor.commands.get('MathType'), 'isEnabled');
|
|
144
144
|
|
|
145
145
|
view.set({
|
|
146
|
-
label: StringManager.get('insert_math'),
|
|
146
|
+
label: StringManager.get('insert_math', editor.config.get('language')),
|
|
147
147
|
icon: mathIcon,
|
|
148
148
|
tooltip: true,
|
|
149
149
|
});
|
|
@@ -169,7 +169,7 @@ export default class MathType extends Plugin {
|
|
|
169
169
|
view.bind('isEnabled').to(editor.commands.get('ChemType'), 'isEnabled');
|
|
170
170
|
|
|
171
171
|
view.set({
|
|
172
|
-
label: StringManager.get('insert_chem'),
|
|
172
|
+
label: StringManager.get('insert_chem', editor.config.get('language')),
|
|
173
173
|
icon: chemIcon,
|
|
174
174
|
tooltip: true,
|
|
175
175
|
});
|
|
@@ -254,7 +254,7 @@ export default class MathType extends Plugin {
|
|
|
254
254
|
let formula = processor.toData(viewDocumentFragment) || '';
|
|
255
255
|
|
|
256
256
|
// And obtain the complete formula
|
|
257
|
-
formula = `<math${mathAttributes}>${formula}</math
|
|
257
|
+
formula = Util.htmlSanitize(`<math${mathAttributes}>${formula}</math>`);
|
|
258
258
|
|
|
259
259
|
/* Model node that contains what's going to actually be inserted. This can be either:
|
|
260
260
|
- A <mathml> element with a formula attribute set to the given formula, or
|
|
@@ -324,7 +324,9 @@ export default class MathType extends Plugin {
|
|
|
324
324
|
|
|
325
325
|
const mathUIElement = createViewImage(modelItem, { writer: viewWriter }); // eslint-disable-line no-use-before-define
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
if (mathUIElement) {
|
|
328
|
+
viewWriter.insert(viewWriter.createPositionAt(widgetElement, 0), mathUIElement);
|
|
329
|
+
}
|
|
328
330
|
|
|
329
331
|
return toWidget(widgetElement, viewWriter);
|
|
330
332
|
}
|
|
@@ -339,9 +341,13 @@ export default class MathType extends Plugin {
|
|
|
339
341
|
/* Although we use the HtmlDataProcessor to obtain the attributes,
|
|
340
342
|
we must create a new EmptyElement which is independent of the
|
|
341
343
|
DataProcessor being used by this editor instance */
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
344
|
+
if (imgElement) {
|
|
345
|
+
return viewWriter.createEmptyElement('img', imgElement.getAttributes(), {
|
|
346
|
+
renderUnsafeAttributes: ['src'],
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return null;
|
|
345
351
|
}
|
|
346
352
|
|
|
347
353
|
// Model -> Editing view
|