@wiris/mathtype-html-integration-devkit
Advanced tools
Comparing version 1.16.1 to 1.16.2
{ | ||
"name": "@wiris/mathtype-html-integration-devkit", | ||
"version": "1.16.1", | ||
"version": "1.16.2", | ||
"description": "Allows to integrate MathType Web into any JavaScript HTML WYSIWYG rich text editor.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -140,9 +140,2 @@ import Configuration from './configuration'; | ||
this.integrationModel = null; | ||
/** | ||
* Options object containing any configuration values to be used by the content manager. | ||
* @type {Object} | ||
*/ | ||
this.options = contentManagerAttributes.options || {}; | ||
} | ||
@@ -446,3 +439,3 @@ | ||
* Sets an empty MathML as {@link ContentManager.editor} content. | ||
* This will open the MT/CT editor with the hand mode. | ||
* This will open the MT/CT editor with the hand mode. | ||
* It adds dir rtl in case of it's activated. | ||
@@ -454,3 +447,3 @@ */ | ||
if (isMobile || this.options.forcedHandMode) { | ||
if (isMobile || this.integrationModel.forcedHandMode) { | ||
// For mobile devices or forced hand mode, set an empty annotation MATHML to maintain the editor in Hand mode. | ||
@@ -503,3 +496,3 @@ const mathML = `<math${isRTL ? ' dir="rtl"' : ''}><semantics><annotation encoding="application/json">[]</annotation></semantics></math>`; | ||
if (this.options.forcedHandMode) { | ||
if (this.integrationModel.forcedHandMode) { | ||
this.hideHandModeButton(); | ||
@@ -530,7 +523,7 @@ | ||
* Hides the hand <-> keyboard mode switch. | ||
* | ||
* | ||
* This method relies completely on the classes used on different HTML elements within the editor itself, meaning | ||
* any change on those classes will make this code stop working properly. | ||
* | ||
* On top of that, some of those classes are changed on runtime (for example, the one that makes some buttons change). | ||
* | ||
* On top of that, some of those classes are changed on runtime (for example, the one that makes some buttons change). | ||
* This forces us to use some delayed code (this is, a timeout) to make sure everything exists when we need it. | ||
@@ -570,3 +563,3 @@ * @param {*} forced (boolean) Forces the user to stay in Hand mode by hiding the keyboard mode button. | ||
* It will open any formula written in Keyboard mode with the hand mode with the default hand trace. | ||
* | ||
* | ||
* @param {String} mathml The original KeyBoard MathML | ||
@@ -585,3 +578,3 @@ * @param {Object} editor The editor object. | ||
// Logic to get the hand traces and open the formula in hand mode. | ||
// Logic to get the hand traces and open the formula in hand mode. | ||
// This logic comes from the editor. | ||
@@ -591,3 +584,3 @@ const handEditor = editor.hand; | ||
const handCoordinates = editor.editorModel.getHandStrokes(); | ||
handEditor.setStrokes(handCoordinates); | ||
handEditor.setStrokes(handCoordinates); | ||
handEditor.fitStrokes(true); | ||
@@ -599,3 +592,3 @@ editor.openHand(); | ||
* Waits until the hand editor object exists. | ||
* @param {Obect} editor The editor object. | ||
* @param {Obect} editor The editor object. | ||
*/ | ||
@@ -602,0 +595,0 @@ async waitForHand(editor) { |
@@ -422,2 +422,4 @@ import Parser from './parser'; | ||
placeCaretAfterNode(node) { | ||
if (node === null) return; | ||
this.integrationModel.getSelection(); | ||
@@ -574,3 +576,3 @@ const nodeDocument = node.ownerDocument; | ||
*/ | ||
openModalDialog(target, isIframe, editorOptions = {}) { | ||
openModalDialog(target, isIframe) { | ||
@@ -737,3 +739,2 @@ // Count the time since the editor is open | ||
contentManagerAttributes.environment = this.environment; | ||
contentManagerAttributes.options = editorOptions || {}; | ||
@@ -740,0 +741,0 @@ if (this.modalDialog == null) { |
@@ -50,6 +50,3 @@ // eslint-disable-next-line no-unused-vars, import/named | ||
*/ | ||
this.serviceProviderProperties = {}; | ||
if ('serviceProviderProperties' in integrationModelProperties) { | ||
this.serviceProviderProperties = integrationModelProperties.serviceProviderProperties; | ||
} | ||
this.serviceProviderProperties = integrationModelProperties.serviceProviderProperties ?? {}; | ||
@@ -95,6 +92,3 @@ /** | ||
*/ | ||
this.callbackMethodArguments = {}; | ||
if ('callbackMethodArguments' in integrationModelProperties) { | ||
this.callbackMethodArguments = integrationModelProperties.callbackMethodArguments; | ||
} | ||
this.callbackMethodArguments = integrationModelProperties.callbackMethodArguments ?? {}; | ||
@@ -105,6 +99,3 @@ /** | ||
*/ | ||
this.environment = {}; | ||
if ('environment' in integrationModelProperties) { | ||
this.environment = integrationModelProperties.environment; | ||
} | ||
this.environment = integrationModelProperties.environment ?? {}; | ||
@@ -123,6 +114,3 @@ /** | ||
*/ | ||
this.editorObject = null; | ||
if ('editorObject' in integrationModelProperties) { | ||
this.editorObject = integrationModelProperties.editorObject; | ||
} | ||
this.editorObject = integrationModelProperties.editorObject ?? null; | ||
@@ -132,6 +120,3 @@ /** | ||
*/ | ||
this.rtl = false; | ||
if ('rtl' in integrationModelProperties) { | ||
this.rtl = integrationModelProperties.rtl; | ||
} | ||
this.rtl = integrationModelProperties.rtl ?? false; | ||
@@ -141,8 +126,10 @@ /** | ||
*/ | ||
this.managesLanguage = false; | ||
if ('managesLanguage' in integrationModelProperties) { | ||
this.managesLanguage = integrationModelProperties.managesLanguage; | ||
} | ||
this.managesLanguage = integrationModelProperties.managesLanguage ?? false; | ||
/** | ||
* Specify if editor will open in hand mode only | ||
*/ | ||
this.forcedHandMode = integrationModelProperties?.integrationParameters?.forcedHandMode ?? false; | ||
/** | ||
* Indicates if an image is selected. Needed to resize the image to the original size in case | ||
@@ -178,4 +165,2 @@ * the image is resized. | ||
} | ||
this.editorOptions = integrationModelProperties.editorOptions || {}; | ||
} | ||
@@ -554,3 +539,3 @@ | ||
this.core.editionProperties.isNewElement = true; | ||
this.core.openModalDialog(this.target, this.isIframe, this.editorOptions); | ||
this.core.openModalDialog(this.target, this.isIframe); | ||
} else { | ||
@@ -569,3 +554,3 @@ let modal = document.getElementById("wrs_modal_offline"); | ||
this.core.editionProperties.isNewElement = false; | ||
this.core.openModalDialog(this.target, this.isIframe, this.editorOptions); | ||
this.core.openModalDialog(this.target, this.isIframe); | ||
} else { | ||
@@ -572,0 +557,0 @@ let modal = document.getElementById("wrs_modal_offline"); |
@@ -407,3 +407,3 @@ /* eslint-disable no-bitwise */ | ||
// Sanitize html code without removing the <semantics> and <annotation> tags. | ||
html = DOMPurify.sanitize(html, { ADD_TAGS: ['semantics', 'annotation'], ALLOWED_ATTR: ['mathvariant', 'class', 'linebreak', 'open', 'close']}); | ||
html = DOMPurify.sanitize(html, { ADD_TAGS: ['semantics', 'annotation'], ADD_ATTR: ['linebreak', 'indentalign']}); | ||
// Readd old annotation content. | ||
@@ -410,0 +410,0 @@ return html.replace(annotationRegex, annotation); |
1788777
10907