@wiris/mathtype-ckeditor5 8.14.0 → 8.15.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.js +32 -7
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.umd.js +32 -7
- package/dist/browser/index.umd.js.map +1 -1
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/integration.js +8 -3
- package/src/plugin.js +24 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
})(this, (function (exports, ckeditor5) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
|
-
/*! @license DOMPurify 3.3.
|
|
8
|
+
/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
|
|
9
9
|
|
|
10
10
|
const {
|
|
11
11
|
entries,
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
function createDOMPurify() {
|
|
304
304
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
305
305
|
const DOMPurify = root => createDOMPurify(root);
|
|
306
|
-
DOMPurify.version = '3.3.
|
|
306
|
+
DOMPurify.version = '3.3.1';
|
|
307
307
|
DOMPurify.removed = [];
|
|
308
308
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
309
309
|
// Not running in a browser, provide a factory function
|
|
@@ -649,6 +649,12 @@
|
|
|
649
649
|
}
|
|
650
650
|
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
651
651
|
}
|
|
652
|
+
if (cfg.ADD_FORBID_CONTENTS) {
|
|
653
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
654
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
655
|
+
}
|
|
656
|
+
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
657
|
+
}
|
|
652
658
|
/* Add #text in case KEEP_CONTENT is set to true */
|
|
653
659
|
if (KEEP_CONTENT) {
|
|
654
660
|
ALLOWED_TAGS['#text'] = true;
|
|
@@ -9742,6 +9748,8 @@
|
|
|
9742
9748
|
* Opens formula editor to editing an existing formula. Can be overwritten in order to make some
|
|
9743
9749
|
* actions from integration part before the formula is edited.
|
|
9744
9750
|
*/ openExistingFormulaEditor() {
|
|
9751
|
+
// Recover owner integration instance.
|
|
9752
|
+
WirisPlugin.currentInstance = this;
|
|
9745
9753
|
if (window.navigator.onLine) {
|
|
9746
9754
|
this.core.editionProperties.isNewElement = false;
|
|
9747
9755
|
this.core.openModalDialog(this.target, this.isIframe);
|
|
@@ -11263,7 +11271,9 @@
|
|
|
11263
11271
|
// Remove selection
|
|
11264
11272
|
if (!viewSelection.isCollapsed) {
|
|
11265
11273
|
for (const range of viewSelection.getRanges()){
|
|
11266
|
-
|
|
11274
|
+
const modelRange = this.editorObject.editing.mapper.toModelRange(range);
|
|
11275
|
+
const modelSelection = this.editorObject.model.createSelection(modelRange);
|
|
11276
|
+
this.editorObject.model.deleteContent(modelSelection);
|
|
11267
11277
|
}
|
|
11268
11278
|
}
|
|
11269
11279
|
// Set carret after the formula
|
|
@@ -11279,7 +11289,7 @@
|
|
|
11279
11289
|
if (mathml) {
|
|
11280
11290
|
this.editorObject.model.insertObject(modelElementNew, position);
|
|
11281
11291
|
}
|
|
11282
|
-
|
|
11292
|
+
this.editorObject.model.deleteContent(this.editorObject.model.createSelection(modelElementOld, 'on'));
|
|
11283
11293
|
}
|
|
11284
11294
|
// eslint-disable-next-line consistent-return
|
|
11285
11295
|
return modelElementNew;
|
|
@@ -11350,7 +11360,8 @@
|
|
|
11350
11360
|
range = writer.createRange(startPosition, endPosition);
|
|
11351
11361
|
}
|
|
11352
11362
|
}
|
|
11353
|
-
|
|
11363
|
+
const modelSelection = this.editorObject.model.createSelection(range);
|
|
11364
|
+
this.editorObject.model.deleteContent(modelSelection);
|
|
11354
11365
|
writer.insertText(`$$${returnObject.latex}$$`, startNode.getAttributes(), startPosition);
|
|
11355
11366
|
});
|
|
11356
11367
|
} else {
|
|
@@ -11471,7 +11482,7 @@
|
|
|
11471
11482
|
|
|
11472
11483
|
var chemIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 40.3 49.5\" style=\"enable-background:new 0 0 40.3 49.5;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:#A4CF61;}\n</style>\n<path class=\"st0\" d=\"M39.2,12.1c0-1.9-1.1-3.6-2.7-4.4L24.5,0.9l0,0c-0.7-0.4-1.5-0.6-2.4-0.6c-0.9,0-1.7,0.2-2.4,0.6l0,0L2.3,10.8\n\tl0,0C0.9,11.7,0,13.2,0,14.9h0v19.6h0c0,1.7,0.9,3.3,2.3,4.1l0,0l17.4,9.9l0,0c0.7,0.4,1.5,0.6,2.4,0.6c0.9,0,1.7-0.2,2.4-0.6l0,0\n\tl12.2-6.9h0c1.5-0.8,2.6-2.5,2.6-4.3c0-2.7-2.2-4.9-4.9-4.9c-0.9,0-1.8,0.3-2.5,0.7l0,0l-9.7,5.6l-12.3-7V17.8l12.3-7l9.9,5.7l0,0\n\tc0.7,0.4,1.5,0.6,2.4,0.6C37,17,39.2,14.8,39.2,12.1\"/>\n</svg>\n";
|
|
11473
11484
|
|
|
11474
|
-
var version = "8.
|
|
11485
|
+
var version = "8.15.0";
|
|
11475
11486
|
var packageInfo = {
|
|
11476
11487
|
version: version};
|
|
11477
11488
|
|
|
@@ -11491,7 +11502,9 @@
|
|
|
11491
11502
|
const integration = this._addIntegration();
|
|
11492
11503
|
currentInstance = integration;
|
|
11493
11504
|
// Add the MathType and ChemType commands to the editor
|
|
11494
|
-
this._addCommands();
|
|
11505
|
+
this._addCommands(integration);
|
|
11506
|
+
// Add the track changes feature integration
|
|
11507
|
+
this._addTrackChangesIntegration(integration);
|
|
11495
11508
|
// Add the buttons for MathType and ChemType
|
|
11496
11509
|
this._addViews(integration);
|
|
11497
11510
|
// Registers the <mathml> element in the schema
|
|
@@ -11931,6 +11944,18 @@
|
|
|
11931
11944
|
Latex
|
|
11932
11945
|
};
|
|
11933
11946
|
}
|
|
11947
|
+
_addTrackChangesIntegration(integration) {
|
|
11948
|
+
const { editor } = this;
|
|
11949
|
+
if (editor.plugins.has("TrackChangesEditing")) {
|
|
11950
|
+
const trackChangesEditing = editor.plugins.get("TrackChangesEditing");
|
|
11951
|
+
// Makes MathType and ChemType buttons available when editor is in the track changes mode
|
|
11952
|
+
trackChangesEditing.enableCommand("MathType");
|
|
11953
|
+
trackChangesEditing.enableCommand("ChemType");
|
|
11954
|
+
// Adds custom label replacing the default 'mathml'.
|
|
11955
|
+
// Handles both singular and plural forms.
|
|
11956
|
+
trackChangesEditing.descriptionFactory.registerElementLabel("mathml", (quantity)=>(quantity > 1 ? quantity + ' ' : '') + StringManager.get(quantity > 1 ? "formulas" : "formula", integration.getLanguage()));
|
|
11957
|
+
}
|
|
11958
|
+
}
|
|
11934
11959
|
}
|
|
11935
11960
|
|
|
11936
11961
|
exports.CKEditor5Integration = CKEditor5Integration;
|