@wiris/mathtype-ckeditor5 7.27.2 → 7.29.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/README.md +6 -7
- package/package.json +2 -2
- package/src/integration.js +5 -1
- package/src/plugin.js +50 -36
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ This npm module uses remotely hosted services to render MathML data. In case of
|
|
|
53
53
|
|
|
54
54
|
In order to display mathematical formulas on the target page, i.e. the page where content produced by the HTML editor will be visible, the target page needs to include the [MathType script](https://docs.wiris.com/en/mathtype/mathtype_web/integrations/mathml-mode#add_a_script_to_head). For example for the default setting this would be:
|
|
55
55
|
```html
|
|
56
|
-
<script src="https://wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image"></script>
|
|
56
|
+
<script src="https://www.wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image"></script>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
## Documentation
|
|
@@ -61,11 +61,10 @@ In order to display mathematical formulas on the target page, i.e. the page wher
|
|
|
61
61
|
To find out more information about MathType, please go to the following documentation:
|
|
62
62
|
|
|
63
63
|
[comment]: <> (TODO: link to install instructions)
|
|
64
|
-
* [MathType documentation](
|
|
65
|
-
* [Introductory tutorials](
|
|
66
|
-
* [Service customization](
|
|
67
|
-
* [Testing](
|
|
68
|
-
|
|
64
|
+
* [MathType documentation](https://docs.wiris.com/en/mathtype/mathtype_web/start?utm_source=npmjs&utm_medium=referral)
|
|
65
|
+
* [Introductory tutorials](https://docs.wiris.com/en/mathtype/mathtype_web/intro_tutorials?utm_source=npmjs&utm_medium=referral)
|
|
66
|
+
* [Service customization](https://docs.wiris.com/en/mathtype/mathtype_web/integrations/config-table?utm_source=npmjs&utm_medium=referral)
|
|
67
|
+
* [Testing](https://docs.wiris.com/en/mathtype/mathtype_web/integrations/html/plugins-test?utm_source=npmjs&utm_medium=referral)
|
|
69
68
|
## Privacy policy
|
|
70
69
|
|
|
71
|
-
The [MathType Privacy Policy](
|
|
70
|
+
The [MathType Privacy Policy](https://www.wiris.com/en/mathtype-privacy-policy/?utm_source=npmjs&utm_medium=referral) covers the data processing operations for the MathType users. It is an addendum of the company’s general Privacy Policy and the [general Privacy Policy](https://www.wiris.com/en/privacy-policy?utm_source=npmjs&utm_medium=referral) still applies to MathType users.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiris/mathtype-ckeditor5",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.29.0",
|
|
4
4
|
"description": "MathType Web for CKEditor5 editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chem",
|
|
@@ -39,6 +39,6 @@
|
|
|
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.8.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/src/integration.js
CHANGED
|
@@ -43,7 +43,7 @@ export default class CKEditor5Integration extends IntegrationModel {
|
|
|
43
43
|
// eslint-disable-next-line no-prototype-builtins
|
|
44
44
|
if (languageObject.hasOwnProperty('ui')) {
|
|
45
45
|
return languageObject.ui;
|
|
46
|
-
} return
|
|
46
|
+
} return languageObject;
|
|
47
47
|
}
|
|
48
48
|
return languageObject;
|
|
49
49
|
}
|
|
@@ -162,6 +162,10 @@ export default class CKEditor5Integration extends IntegrationModel {
|
|
|
162
162
|
writer.remove(this.editorObject.editing.mapper.toModelRange(range));
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
|
|
166
|
+
// Set carret after the formula
|
|
167
|
+
const position = this.editorObject.model.createPositionAfter(modelElementNew);
|
|
168
|
+
writer.setSelection(position);
|
|
165
169
|
} else {
|
|
166
170
|
const img = core.editionProperties.temporalImage;
|
|
167
171
|
const viewElement = this.editorObject.editing.view.domConverter.domToView(img).parent;
|
package/src/plugin.js
CHANGED
|
@@ -18,6 +18,7 @@ import Configuration from '@wiris/mathtype-html-integration-devkit/src/configura
|
|
|
18
18
|
import Listeners from '@wiris/mathtype-html-integration-devkit/src/listeners';
|
|
19
19
|
import MathML from '@wiris/mathtype-html-integration-devkit/src/mathml';
|
|
20
20
|
import Latex from '@wiris/mathtype-html-integration-devkit/src/latex';
|
|
21
|
+
import StringManager from '@wiris/mathtype-html-integration-devkit/src/stringmanager';
|
|
21
22
|
|
|
22
23
|
// Local imports
|
|
23
24
|
import { MathTypeCommand, ChemTypeCommand } from './commands';
|
|
@@ -58,6 +59,13 @@ export default class MathType extends Plugin {
|
|
|
58
59
|
this._exposeWiris();
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Inherited from Plugin class: Executed when CKEditor5 is destroyed
|
|
64
|
+
*/
|
|
65
|
+
destroy() { // eslint-disable-line class-methods-use-this
|
|
66
|
+
currentInstance.removeEvents();
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
/**
|
|
62
70
|
* Create the MathType API Integration object
|
|
63
71
|
* @returns {CKEditor5Integration} the integration object
|
|
@@ -125,51 +133,57 @@ export default class MathType extends Plugin {
|
|
|
125
133
|
_addViews(integration) {
|
|
126
134
|
const { editor } = this;
|
|
127
135
|
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
// Check if MathType editor is enabled
|
|
137
|
+
if (Configuration.get('editorEnabled')) {
|
|
138
|
+
// Add button for the formula editor
|
|
139
|
+
editor.ui.componentFactory.add('MathType', (locale) => {
|
|
140
|
+
const view = new ButtonView(locale);
|
|
131
141
|
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
// View is enabled iff command is enabled
|
|
143
|
+
view.bind('isEnabled').to(editor.commands.get('MathType'), 'isEnabled');
|
|
134
144
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
145
|
+
view.set({
|
|
146
|
+
label: StringManager.get('insert_math'),
|
|
147
|
+
icon: mathIcon,
|
|
148
|
+
tooltip: true,
|
|
149
|
+
});
|
|
140
150
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
// Callback executed once the image is clicked.
|
|
152
|
+
view.on('execute', () => {
|
|
153
|
+
editor.execute('MathType', {
|
|
154
|
+
integration, // Pass integration as parameter
|
|
155
|
+
});
|
|
145
156
|
});
|
|
146
|
-
});
|
|
147
157
|
|
|
148
|
-
|
|
149
|
-
|
|
158
|
+
return view;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
150
161
|
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
162
|
+
// Check if ChemType editor is enabled
|
|
163
|
+
if (Configuration.get('chemEnabled')) {
|
|
164
|
+
// Add button for the chemistry formula editor
|
|
165
|
+
editor.ui.componentFactory.add('ChemType', (locale) => {
|
|
166
|
+
const view = new ButtonView(locale);
|
|
154
167
|
|
|
155
|
-
|
|
156
|
-
|
|
168
|
+
// View is enabled iff command is enabled
|
|
169
|
+
view.bind('isEnabled').to(editor.commands.get('ChemType'), 'isEnabled');
|
|
157
170
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
171
|
+
view.set({
|
|
172
|
+
label: StringManager.get('insert_chem'),
|
|
173
|
+
icon: chemIcon,
|
|
174
|
+
tooltip: true,
|
|
175
|
+
});
|
|
163
176
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
// Callback executed once the image is clicked.
|
|
178
|
+
view.on('execute', () => {
|
|
179
|
+
editor.execute('ChemType', {
|
|
180
|
+
integration, // Pass integration as parameter
|
|
181
|
+
});
|
|
168
182
|
});
|
|
169
|
-
});
|
|
170
183
|
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
return view;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
173
187
|
|
|
174
188
|
// Observer for the double click event
|
|
175
189
|
editor.editing.view.addObserver(ClickObserver);
|
|
@@ -327,8 +341,8 @@ export default class MathType extends Plugin {
|
|
|
327
341
|
we must create a new EmptyElement which is independent of the
|
|
328
342
|
DataProcessor being used by this editor instance */
|
|
329
343
|
return viewWriter.createEmptyElement('img', imgElement.getAttributes(), {
|
|
330
|
-
renderUnsafeAttributes: [
|
|
331
|
-
}
|
|
344
|
+
renderUnsafeAttributes: ['src'],
|
|
345
|
+
});
|
|
332
346
|
}
|
|
333
347
|
|
|
334
348
|
// Model -> Editing view
|