@wiris/mathtype-tinymce6 8.2.6 → 8.3.1

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.
@@ -44,7 +44,7 @@ export class TinyMceIntegration extends IntegrationModel {
44
44
  const baseURL = tinymce.baseURL.substr(0, pos + search.length);
45
45
  return `${baseURL}/plugins/tiny_mce_wiris/tinymce/`;
46
46
  } if (this.isExternal) {
47
- const externalUrl = this.editorObject.getParam('external_plugins').tiny_mce_wiris;
47
+ const externalUrl = this.editorObject.options.get('external_plugins').tiny_mce_wiris;
48
48
  return externalUrl.substring(0, externalUrl.lastIndexOf('/') + 1);
49
49
  }
50
50
  return `${tinymce.baseURL}/plugins/tiny_mce_wiris/`;
@@ -70,14 +70,14 @@ export class TinyMceIntegration extends IntegrationModel {
70
70
  getLanguage() {
71
71
  const editorSettings = this.editorObject;
72
72
  try {
73
- return editorSettings.getParam('mathTypeParameters').editorParameters.language;
73
+ return editorSettings.options.get('mathTypeParameters').editorParameters.language;
74
74
  } catch (e) { console.error(); }
75
75
  // Get the deprecated wirisformulaeditorlang
76
- if (editorSettings.getParam('wirisformulaeditorlang')) {
76
+ if (editorSettings.options.get('wirisformulaeditorlang')) {
77
77
  console.warn('Deprecated property wirisformulaeditorlang. Use mathTypeParameters on instead.');
78
- return editorSettings.getParam('wirisformulaeditorlang');
78
+ return editorSettings.options.get('wirisformulaeditorlang');
79
79
  }
80
- const langParam = this.editorObject.getParam('language');
80
+ const langParam = this.editorObject.options.get('language');
81
81
  return langParam || super.getLanguage();
82
82
  }
83
83
 
@@ -185,15 +185,22 @@ export const currentInstance = null;
185
185
  // eslint-disable-next-line no-undef
186
186
  integrationModelProperties.configurationService = M.cfg.wwwroot + '/filter/wiris/integration/configurationjs.php'; // eslint-disable-line prefer-template
187
187
  }
188
- if (typeof (editor.getParam('wiriscontextpath')) !== 'undefined') {
189
- integrationModelProperties.configurationService = Util.concatenateUrl(editor.getParam('wiriscontextpath'), integrationModelProperties.configurationService);
190
- `${editor.getParam('wiriscontextpath')}/${integrationModelProperties.configurationService}`; // eslint-disable-line no-unused-expressions
191
- console.warn('Deprecated property wiriscontextpath. Use mathTypeParameters on instead.', editor.opts.wiriscontextpath);
188
+ if (typeof (editor.options.get('wiriscontextpath')) !== 'undefined') {
189
+ integrationModelProperties.configurationService = Util.concatenateUrl(editor.options.get('wiriscontextpath'), integrationModelProperties.configurationService);
190
+ `${editor.options.get('wiriscontextpath')}/${integrationModelProperties.configurationService}`; // eslint-disable-line no-unused-expressions
191
+ console.warn('Deprecated property wiriscontextpath. Use mathTypeParameters instead.', editor.opts.wiriscontextpath);
192
192
  }
193
193
 
194
194
  // Overriding MathType integration parameters.
195
- if (typeof (editor.getParam('mathTypeParameters')) !== 'undefined') {
196
- integrationModelProperties.integrationParameters = editor.getParam('mathTypeParameters');
195
+
196
+ // Register our custom parameters inside TinyMCE's options
197
+ editor.options.register('mathTypeParameters', {
198
+ processor: 'object',
199
+ default: {},
200
+ });
201
+
202
+ if (editor.options.isRegistered('mathTypeParameters')) {
203
+ integrationModelProperties.integrationParameters = editor.options.get('mathTypeParameters');
197
204
  }
198
205
 
199
206
  integrationModelProperties.scriptName = 'plugin.min.js';
@@ -209,9 +216,9 @@ export const currentInstance = null;
209
216
  // However, as TinyMCE is not initialized at this point the HTML target is not created.
210
217
  // Here we create the target as null and onInit object the target is updated.
211
218
  integrationModelProperties.target = null;
212
- const isExternalPlugin = typeof (editor.getParam('external_plugins')) !== 'undefined' && 'tiny_mce_wiris' in editor.getParam('external_plugins');
219
+ const isExternalPlugin = typeof (editor.options.get('external_plugins')) !== 'undefined' && 'tiny_mce_wiris' in editor.options.get('external_plugins');
213
220
  integrationModelProperties.isExternal = isExternalPlugin;
214
- integrationModelProperties.rtl = (editor.getParam('directionality') === 'rtl');
221
+ integrationModelProperties.rtl = (editor.options.get('directionality') === 'rtl');
215
222
 
216
223
  // GenericIntegration instance.
217
224
  const tinyMceIntegrationInstance = new TinyMceIntegration(integrationModelProperties);
@@ -228,8 +235,8 @@ export const currentInstance = null;
228
235
  }
229
236
  integrationInstance.setEditorObject(editor);
230
237
  integrationInstance.listeners.fire('onTargetReady', {});
231
- if ('wiriseditorparameters' in editor) {
232
- Configuration.update('editorParameters', editor.wiriseditorparameters);
238
+ if (editor.options.isRegistered('mathTypeParameters')) {
239
+ Configuration.update('editorParameters', editor.options.get('mathTypeParameters'));
233
240
  }
234
241
 
235
242
  // Prevent TinyMCE attributes insertion.
@@ -259,7 +266,7 @@ export const currentInstance = null;
259
266
  const content = editor.getContent();
260
267
  // We set content in html because other tiny plugins need data-mce
261
268
  // and this is not possible with raw format.
262
- editor.setContent(Parser.initParse(content, editor.getParam('language')), { format: 'html' });
269
+ editor.setContent(Parser.initParse(content, editor.options.get('language')), { format: 'html' });
263
270
  // This clean undoQueue for prevent onChange and Dirty state.
264
271
  editor.undoManager.clear();
265
272
  // Init parsing OK. If a setContent method is called
@@ -288,7 +295,7 @@ export const currentInstance = null;
288
295
  }
289
296
 
290
297
  const onSave = function (editor, params) { // eslint-disable-line no-shadow
291
- params.content = Parser.endParse(params.content, editor.getParam('language'));
298
+ params.content = Parser.endParse(params.content, editor.options.get('language'));
292
299
  };
293
300
 
294
301
  if ('onSaveContent' in editor) {
@@ -310,13 +317,13 @@ export const currentInstance = null;
310
317
  if ('onBeforeSetContent' in editor) {
311
318
  editor.onBeforeSetContent.add((e, params) => {
312
319
  if (WirisPlugin.instances[editor.id].initParsed) {
313
- params.content = Parser.initParse(params.content, editor.getParam('language'));
320
+ params.content = Parser.initParse(params.content, editor.options.get('language'));
314
321
  }
315
322
  });
316
323
  } else {
317
324
  editor.on('beforeSetContent', (params) => {
318
325
  if (WirisPlugin.instances[editor.id].initParsed) {
319
- params.content = Parser.initParse(params.content, editor.getParam('language'));
326
+ params.content = Parser.initParse(params.content, editor.options.get('language'));
320
327
  }
321
328
  });
322
329
  }
@@ -361,7 +368,7 @@ export const currentInstance = null;
361
368
  });
362
369
 
363
370
  // Get editor language code
364
- let lang_code = editor.getParam('language');
371
+ let lang_code = editor.options.get('language');
365
372
  lang_code = (lang_code.split("-")[0]).split("_")[0];
366
373
 
367
374
  // MathType button.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiris/mathtype-tinymce6",
3
- "version": "8.2.6",
3
+ "version": "8.3.1",
4
4
  "description": "MathType Web for TinyMCE6 editor",
5
5
  "keywords": [
6
6
  "chem",
@@ -32,7 +32,7 @@
32
32
  "prepack": "npm install && npm run build"
33
33
  },
34
34
  "dependencies": {
35
- "@wiris/mathtype-html-integration-devkit": "1.11.4"
35
+ "@wiris/mathtype-html-integration-devkit": "1.12.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@babel/core": "^7.15.0",