@wiris/mathtype-ckeditor5 7.28.0 → 7.31.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 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](http://docs.wiris.com/en/mathtype/mathtype_web/start)
65
- * [Introductory tutorials](http://docs.wiris.com/en/mathtype/mathtype_web/intro_tutorials)
66
- * [Service customization](http://docs.wiris.com/en/mathtype/mathtype_web/integrations/config-table)
67
- * [Testing](http://docs.wiris.com/en/mathtype/mathtype_web/integrations/html/plugins-test)
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](http://www.wiris.com/mathtype/privacy-policy) 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://wiris.com/en/privacy-policy) still applies to MathType users.
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.28.0",
3
+ "version": "7.31.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.7.0"
43
- },
44
- "gitHead": "70e87055b311f5558100e551aa771aea9b5b527d"
42
+ "@wiris/mathtype-html-integration-devkit": "1.8.1"
43
+ }
45
44
  }
@@ -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
- // Add button for the formula editor
137
- editor.ui.componentFactory.add('MathType', (locale) => {
138
- const view = new ButtonView(locale);
139
-
140
- // View is enabled iff command is enabled
141
- view.bind('isEnabled').to(editor.commands.get('MathType'), 'isEnabled');
142
-
143
- view.set({
144
- label: StringManager.get('insert_math'),
145
- icon: mathIcon,
146
- tooltip: true,
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
- // Callback executed once the image is clicked.
150
- view.on('execute', () => {
151
- editor.execute('MathType', {
152
- integration, // Pass integration as parameter
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
- return view;
157
- });
158
+ return view;
159
+ });
160
+ }
158
161
 
159
- // Add button for the chemistry formula editor
160
- editor.ui.componentFactory.add('ChemType', (locale) => {
161
- const view = new ButtonView(locale);
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
- // View is enabled iff command is enabled
164
- view.bind('isEnabled').to(editor.commands.get('ChemType'), 'isEnabled');
168
+ // View is enabled iff command is enabled
169
+ view.bind('isEnabled').to(editor.commands.get('ChemType'), 'isEnabled');
165
170
 
166
- view.set({
167
- label: StringManager.get('insert_chem'),
168
- icon: chemIcon,
169
- tooltip: true,
170
- });
171
+ view.set({
172
+ label: StringManager.get('insert_chem'),
173
+ icon: chemIcon,
174
+ tooltip: true,
175
+ });
171
176
 
172
- // Callback executed once the image is clicked.
173
- view.on('execute', () => {
174
- editor.execute('ChemType', {
175
- integration, // Pass integration as parameter
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
- return view;
180
- });
184
+ return view;
185
+ });
186
+ }
181
187
 
182
188
  // Observer for the double click event
183
189
  editor.editing.view.addObserver(ClickObserver);
@@ -256,7 +262,6 @@ export default class MathType extends Plugin {
256
262
  const modelNode = isLatex
257
263
  ? writer.createText(Parser.initParse(formula, editor.config.get('language')))
258
264
  : writer.createElement('mathml', { formula });
259
- modelNode.data = formula;
260
265
 
261
266
  // Find allowed parent for element that we are going to insert.
262
267
  // If current parent does not allow to insert element but one of the ancestors does
@@ -335,8 +340,8 @@ export default class MathType extends Plugin {
335
340
  we must create a new EmptyElement which is independent of the
336
341
  DataProcessor being used by this editor instance */
337
342
  return viewWriter.createEmptyElement('img', imgElement.getAttributes(), {
338
- renderUnsafeAttributes: [ 'src' ]
339
- } );
343
+ renderUnsafeAttributes: ['src'],
344
+ });
340
345
  }
341
346
 
342
347
  // Model -> Editing view