@wiris/mathtype-ckeditor5 7.28.1 → 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 +5 -6
- package/package.json +3 -4
- package/src/integration.js +4 -0
- package/src/plugin.js +44 -38
package/README.md
CHANGED
|
@@ -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,7 +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.
|
|
43
|
-
}
|
|
44
|
-
"gitHead": "91307cd78406db4b4e4f53cc4828361162c9c405"
|
|
42
|
+
"@wiris/mathtype-html-integration-devkit": "1.8.0"
|
|
43
|
+
}
|
|
45
44
|
}
|
package/src/integration.js
CHANGED
|
@@ -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
|
@@ -133,51 +133,57 @@ export default class MathType extends Plugin {
|
|
|
133
133
|
_addViews(integration) {
|
|
134
134
|
const { editor } = this;
|
|
135
135
|
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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);
|
|
141
|
+
|
|
142
|
+
// View is enabled iff command is enabled
|
|
143
|
+
view.bind('isEnabled').to(editor.commands.get('MathType'), 'isEnabled');
|
|
144
|
+
|
|
145
|
+
view.set({
|
|
146
|
+
label: StringManager.get('insert_math'),
|
|
147
|
+
icon: mathIcon,
|
|
148
|
+
tooltip: true,
|
|
149
|
+
});
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
// Callback executed once the image is clicked.
|
|
152
|
+
view.on('execute', () => {
|
|
153
|
+
editor.execute('MathType', {
|
|
154
|
+
integration, // Pass integration as parameter
|
|
155
|
+
});
|
|
153
156
|
});
|
|
154
|
-
});
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
return view;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
158
161
|
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
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);
|
|
162
167
|
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
// View is enabled iff command is enabled
|
|
169
|
+
view.bind('isEnabled').to(editor.commands.get('ChemType'), 'isEnabled');
|
|
165
170
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
+
view.set({
|
|
172
|
+
label: StringManager.get('insert_chem'),
|
|
173
|
+
icon: chemIcon,
|
|
174
|
+
tooltip: true,
|
|
175
|
+
});
|
|
171
176
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
// Callback executed once the image is clicked.
|
|
178
|
+
view.on('execute', () => {
|
|
179
|
+
editor.execute('ChemType', {
|
|
180
|
+
integration, // Pass integration as parameter
|
|
181
|
+
});
|
|
176
182
|
});
|
|
177
|
-
});
|
|
178
183
|
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
return view;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
181
187
|
|
|
182
188
|
// Observer for the double click event
|
|
183
189
|
editor.editing.view.addObserver(ClickObserver);
|
|
@@ -335,8 +341,8 @@ export default class MathType extends Plugin {
|
|
|
335
341
|
we must create a new EmptyElement which is independent of the
|
|
336
342
|
DataProcessor being used by this editor instance */
|
|
337
343
|
return viewWriter.createEmptyElement('img', imgElement.getAttributes(), {
|
|
338
|
-
renderUnsafeAttributes: [
|
|
339
|
-
}
|
|
344
|
+
renderUnsafeAttributes: ['src'],
|
|
345
|
+
});
|
|
340
346
|
}
|
|
341
347
|
|
|
342
348
|
// Model -> Editing view
|