@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 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](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.27.2",
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.6.1"
42
+ "@wiris/mathtype-html-integration-devkit": "1.8.0"
43
43
  }
44
44
  }
@@ -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 super.getLanguage();
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
- // Add button for the formula editor
129
- editor.ui.componentFactory.add('MathType', (locale) => {
130
- const view = new ButtonView(locale);
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
- // View is enabled iff command is enabled
133
- view.bind('isEnabled').to(editor.commands.get('MathType'), 'isEnabled');
142
+ // View is enabled iff command is enabled
143
+ view.bind('isEnabled').to(editor.commands.get('MathType'), 'isEnabled');
134
144
 
135
- view.set({
136
- label: 'Insert a math equation - MathType',
137
- icon: mathIcon,
138
- tooltip: true,
139
- });
145
+ view.set({
146
+ label: StringManager.get('insert_math'),
147
+ icon: mathIcon,
148
+ tooltip: true,
149
+ });
140
150
 
141
- // Callback executed once the image is clicked.
142
- view.on('execute', () => {
143
- editor.execute('MathType', {
144
- 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
+ });
145
156
  });
146
- });
147
157
 
148
- return view;
149
- });
158
+ return view;
159
+ });
160
+ }
150
161
 
151
- // Add button for the chemistry formula editor
152
- editor.ui.componentFactory.add('ChemType', (locale) => {
153
- 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);
154
167
 
155
- // View is enabled iff command is enabled
156
- 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');
157
170
 
158
- view.set({
159
- label: 'Insert a chemistry formula - ChemType',
160
- icon: chemIcon,
161
- tooltip: true,
162
- });
171
+ view.set({
172
+ label: StringManager.get('insert_chem'),
173
+ icon: chemIcon,
174
+ tooltip: true,
175
+ });
163
176
 
164
- // Callback executed once the image is clicked.
165
- view.on('execute', () => {
166
- editor.execute('ChemType', {
167
- 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
+ });
168
182
  });
169
- });
170
183
 
171
- return view;
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: [ 'src' ]
331
- } );
344
+ renderUnsafeAttributes: ['src'],
345
+ });
332
346
  }
333
347
 
334
348
  // Model -> Editing view