@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
package/dist/browser/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ButtonView } from 'ckeditor5';
|
|
|
3
3
|
import { ClickObserver, XmlDataProcessor, ViewUpcastWriter, HtmlDataProcessor } from 'ckeditor5';
|
|
4
4
|
import { Widget, viewToModelPositionOutsideModelElement, toWidget } from 'ckeditor5';
|
|
5
5
|
|
|
6
|
-
/*! @license DOMPurify 3.3.
|
|
6
|
+
/*! @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 */
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
entries,
|
|
@@ -301,7 +301,7 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
301
301
|
function createDOMPurify() {
|
|
302
302
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
303
303
|
const DOMPurify = root => createDOMPurify(root);
|
|
304
|
-
DOMPurify.version = '3.3.
|
|
304
|
+
DOMPurify.version = '3.3.1';
|
|
305
305
|
DOMPurify.removed = [];
|
|
306
306
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
307
307
|
// Not running in a browser, provide a factory function
|
|
@@ -647,6 +647,12 @@ function createDOMPurify() {
|
|
|
647
647
|
}
|
|
648
648
|
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
649
649
|
}
|
|
650
|
+
if (cfg.ADD_FORBID_CONTENTS) {
|
|
651
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
652
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
653
|
+
}
|
|
654
|
+
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
655
|
+
}
|
|
650
656
|
/* Add #text in case KEEP_CONTENT is set to true */
|
|
651
657
|
if (KEEP_CONTENT) {
|
|
652
658
|
ALLOWED_TAGS['#text'] = true;
|
|
@@ -9740,6 +9746,8 @@ var warnIcon = "<svg width=\"16\" height=\"14\" viewBox=\"0 0 16 14\" fill=\"non
|
|
|
9740
9746
|
* Opens formula editor to editing an existing formula. Can be overwritten in order to make some
|
|
9741
9747
|
* actions from integration part before the formula is edited.
|
|
9742
9748
|
*/ openExistingFormulaEditor() {
|
|
9749
|
+
// Recover owner integration instance.
|
|
9750
|
+
WirisPlugin.currentInstance = this;
|
|
9743
9751
|
if (window.navigator.onLine) {
|
|
9744
9752
|
this.core.editionProperties.isNewElement = false;
|
|
9745
9753
|
this.core.openModalDialog(this.target, this.isIframe);
|
|
@@ -11261,7 +11269,9 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
|
|
|
11261
11269
|
// Remove selection
|
|
11262
11270
|
if (!viewSelection.isCollapsed) {
|
|
11263
11271
|
for (const range of viewSelection.getRanges()){
|
|
11264
|
-
|
|
11272
|
+
const modelRange = this.editorObject.editing.mapper.toModelRange(range);
|
|
11273
|
+
const modelSelection = this.editorObject.model.createSelection(modelRange);
|
|
11274
|
+
this.editorObject.model.deleteContent(modelSelection);
|
|
11265
11275
|
}
|
|
11266
11276
|
}
|
|
11267
11277
|
// Set carret after the formula
|
|
@@ -11277,7 +11287,7 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
|
|
|
11277
11287
|
if (mathml) {
|
|
11278
11288
|
this.editorObject.model.insertObject(modelElementNew, position);
|
|
11279
11289
|
}
|
|
11280
|
-
|
|
11290
|
+
this.editorObject.model.deleteContent(this.editorObject.model.createSelection(modelElementOld, 'on'));
|
|
11281
11291
|
}
|
|
11282
11292
|
// eslint-disable-next-line consistent-return
|
|
11283
11293
|
return modelElementNew;
|
|
@@ -11348,7 +11358,8 @@ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
|
|
|
11348
11358
|
range = writer.createRange(startPosition, endPosition);
|
|
11349
11359
|
}
|
|
11350
11360
|
}
|
|
11351
|
-
|
|
11361
|
+
const modelSelection = this.editorObject.model.createSelection(range);
|
|
11362
|
+
this.editorObject.model.deleteContent(modelSelection);
|
|
11352
11363
|
writer.insertText(`$$${returnObject.latex}$$`, startNode.getAttributes(), startPosition);
|
|
11353
11364
|
});
|
|
11354
11365
|
} else {
|
|
@@ -11469,7 +11480,7 @@ var mathIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adob
|
|
|
11469
11480
|
|
|
11470
11481
|
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";
|
|
11471
11482
|
|
|
11472
|
-
var version = "8.
|
|
11483
|
+
var version = "8.15.0";
|
|
11473
11484
|
var packageInfo = {
|
|
11474
11485
|
version: version};
|
|
11475
11486
|
|
|
@@ -11489,7 +11500,9 @@ class MathType extends Plugin {
|
|
|
11489
11500
|
const integration = this._addIntegration();
|
|
11490
11501
|
currentInstance = integration;
|
|
11491
11502
|
// Add the MathType and ChemType commands to the editor
|
|
11492
|
-
this._addCommands();
|
|
11503
|
+
this._addCommands(integration);
|
|
11504
|
+
// Add the track changes feature integration
|
|
11505
|
+
this._addTrackChangesIntegration(integration);
|
|
11493
11506
|
// Add the buttons for MathType and ChemType
|
|
11494
11507
|
this._addViews(integration);
|
|
11495
11508
|
// Registers the <mathml> element in the schema
|
|
@@ -11929,6 +11942,18 @@ class MathType extends Plugin {
|
|
|
11929
11942
|
Latex
|
|
11930
11943
|
};
|
|
11931
11944
|
}
|
|
11945
|
+
_addTrackChangesIntegration(integration) {
|
|
11946
|
+
const { editor } = this;
|
|
11947
|
+
if (editor.plugins.has("TrackChangesEditing")) {
|
|
11948
|
+
const trackChangesEditing = editor.plugins.get("TrackChangesEditing");
|
|
11949
|
+
// Makes MathType and ChemType buttons available when editor is in the track changes mode
|
|
11950
|
+
trackChangesEditing.enableCommand("MathType");
|
|
11951
|
+
trackChangesEditing.enableCommand("ChemType");
|
|
11952
|
+
// Adds custom label replacing the default 'mathml'.
|
|
11953
|
+
// Handles both singular and plural forms.
|
|
11954
|
+
trackChangesEditing.descriptionFactory.registerElementLabel("mathml", (quantity)=>(quantity > 1 ? quantity + ' ' : '') + StringManager.get(quantity > 1 ? "formulas" : "formula", integration.getLanguage()));
|
|
11955
|
+
}
|
|
11956
|
+
}
|
|
11932
11957
|
}
|
|
11933
11958
|
|
|
11934
11959
|
export { CKEditor5Integration, ChemTypeCommand, MathTypeCommand, MathType as default };
|