@wiris/mathtype-viewer 8.11.0 → 8.12.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/dist/WIRISplugins.js +1 -1
- package/dist/WIRISplugins.js.LICENSE.txt +1 -1
- package/dist/latex.d.ts.map +1 -1
- package/dist/mathml.d.ts.map +1 -1
- package/dist/properties.d.ts +10 -4
- package/dist/properties.d.ts.map +1 -1
- package/docs/spec.md +1 -0
- package/package.json +2 -2
- package/src/latex.ts +56 -24
- package/src/mathml.spec.ts +0 -1
- package/src/mathml.ts +19 -2
- package/src/properties.ts +35 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! @license DOMPurify 3.
|
|
1
|
+
/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */
|
package/dist/latex.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../src/latex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY1C,wBAAsB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../src/latex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY1C,wBAAsB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,iBAc1E"}
|
package/dist/mathml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathml.d.ts","sourceRoot":"","sources":["../src/mathml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"mathml.d.ts","sourceRoot":"","sources":["../src/mathml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwE1C,wBAAsB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAsC3F;AAgED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIvD"}
|
package/dist/properties.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
type Viewer = "none" | "image" | "mathml" | "latex";
|
|
2
|
-
type
|
|
2
|
+
type StringifiedBoolean = "true" | "false";
|
|
3
3
|
export interface Config {
|
|
4
4
|
editorServicesRoot: string;
|
|
5
5
|
editorServicesExtension: string;
|
|
6
6
|
backendConfig: {
|
|
7
|
-
wirispluginperformance:
|
|
7
|
+
wirispluginperformance: StringifiedBoolean;
|
|
8
8
|
wiriseditormathmlattribute: string;
|
|
9
9
|
wiriscustomheaders: object;
|
|
10
|
+
wiriseditorparselatex: StringifiedBoolean;
|
|
10
11
|
};
|
|
11
12
|
dpi: number;
|
|
12
13
|
element: string;
|
|
13
14
|
lang: string;
|
|
14
15
|
viewer: Viewer;
|
|
15
16
|
zoom: number;
|
|
17
|
+
ignored_containers: string | null;
|
|
16
18
|
}
|
|
17
19
|
export declare class Properties {
|
|
18
20
|
private static instance;
|
|
@@ -37,10 +39,14 @@ export declare class Properties {
|
|
|
37
39
|
set zoom(zoom: number);
|
|
38
40
|
get element(): string;
|
|
39
41
|
set element(element: string);
|
|
40
|
-
get wirispluginperformance():
|
|
41
|
-
set wirispluginperformance(wirispluginperformance:
|
|
42
|
+
get wirispluginperformance(): StringifiedBoolean;
|
|
43
|
+
set wirispluginperformance(wirispluginperformance: StringifiedBoolean);
|
|
42
44
|
get wiriseditormathmlattribute(): string;
|
|
43
45
|
set wiriseditormathmlattribute(wiriseditormathmlattribute: string);
|
|
46
|
+
get wiriseditorparselatex(): StringifiedBoolean;
|
|
47
|
+
set wiriseditorparselatex(wiriseditorparselatex: StringifiedBoolean);
|
|
48
|
+
get ignored_containers(): string | null;
|
|
49
|
+
set ignored_containers(ignored_containers: string);
|
|
44
50
|
}
|
|
45
51
|
export {};
|
|
46
52
|
//# sourceMappingURL=properties.d.ts.map
|
package/dist/properties.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAIA,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AACpD,KAAK,
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAIA,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AACpD,KAAK,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAAC;AAK3C,MAAM,WAAW,MAAM;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,aAAa,EAAE;QACb,sBAAsB,EAAE,kBAAkB,CAAC;QAC3C,0BAA0B,EAAE,MAAM,CAAC;QACnC,kBAAkB,EAAE,MAAM,CAAC;QAC3B,qBAAqB,EAAE,kBAAkB,CAAC;KAC3C,CAAC;IACF,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAyBD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAElD,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAkB;IAG7C,MAAM,EAAE,MAAM,CAAiB;IAM/B,OAAO;WAEM,WAAW,IAAI,OAAO,CAAC,UAAU,CAAC;YAWjC,UAAU;IA6CxB,OAAO,CAAC,aAAa;YAwCP,aAAa;IAwB3B,IAAI,kBAAkB,IAAI,MAAM,CAE/B;IAED,IAAI,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAGhD;IAED,IAAI,uBAAuB,IAAI,MAAM,CAEpC;IAED,IAAI,uBAAuB,CAAC,uBAAuB,EAAE,MAAM,EAG1D;IAWD,IAAI,IAAI,IAAI,MAAM,CAGjB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAGpB;IAQD,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAGxB;IAQD,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,EAGlB;IAQD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAGpB;IAQD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,EAG1B;IAQD,IAAI,sBAAsB,IAAI,kBAAkB,CAE/C;IAED,IAAI,sBAAsB,CAAC,sBAAsB,EAAE,kBAAkB,EAGpE;IAQD,IAAI,0BAA0B,IAAI,MAAM,CAIvC;IAED,IAAI,0BAA0B,CAAC,0BAA0B,EAAE,MAAM,EAGhE;IAED,IAAI,qBAAqB,IAAI,kBAAkB,CAE9C;IAED,IAAI,qBAAqB,CAAC,qBAAqB,EAAE,kBAAkB,EAGlE;IAED,IAAI,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAEtC;IAED,IAAI,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAGhD;CACF"}
|
package/docs/spec.md
CHANGED
|
@@ -106,6 +106,7 @@ The following table contains a specification of each of the properties.
|
|
|
106
106
|
| wiriseditormathmlattribute | The name of the HTML element attribute that will be used in the rendered img elements in order to store the original MathML. According to the HTML spec, it must begin with “data-” [ https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-* ]. | Backend | data-\* | data-mathml |
|
|
107
107
|
| wirispluginperformance | Whether to use the browser cache to render formulas. | Backend | true, false | true |
|
|
108
108
|
| wirisimageformat | Whether to return PNG or SVG formulas. | Backend | svg, png | svg |
|
|
109
|
+
| wiriseditorparselatex | Whether to parse LaTeX expressions or not. | Backend | true, false | true |
|
|
109
110
|
| editorServicesRoot | The URL base for the showimage and createimage integration services. If distributed together with the backend services, this URL is determined by the backend technology. If distributed with npm, it takes as a default value the integration services from wiris.net. In any case, this parameter can be set manually in the frontend. | Frontend | URL | https://www.wiris.net/demo/plugins/app/ |
|
|
110
111
|
| viewer | What should the viewer render exactly. none: do nothing image: render both MathML and LaTeX formulas mathml: render only MathML latex: render only LaTeX | Frontend | none, image, mathml, latex (mod capitalization) | none |
|
|
111
112
|
| element | A querySelector string that identifies the element in which the viewer should act. | Frontend | | document |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiris/mathtype-viewer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"author": "Integrations",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@wiris/mathtype-html-integration-devkit": "1.17.
|
|
19
|
+
"@wiris/mathtype-html-integration-devkit": "1.17.6"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@babel/preset-typescript": "^7.24.1",
|
package/src/latex.ts
CHANGED
|
@@ -12,10 +12,15 @@ interface LatexPosition {
|
|
|
12
12
|
* @param {HTMLElement} root - Any DOM element that can contain MathML.
|
|
13
13
|
*/
|
|
14
14
|
export async function renderLatex(properties: Properties, root: HTMLElement) {
|
|
15
|
+
// Prevent rendering LaTeX when the parameter wiriseditorparselatex is set to false.
|
|
16
|
+
if (properties.wiriseditorparselatex === "false") {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
if (properties.viewer !== "image" && properties.viewer !== "latex") {
|
|
16
21
|
return;
|
|
17
22
|
}
|
|
18
|
-
const latexNodes = findLatexTextNodes(root);
|
|
23
|
+
const latexNodes = findLatexTextNodes(root, properties.ignored_containers);
|
|
19
24
|
|
|
20
25
|
for (const latexNode of latexNodes) {
|
|
21
26
|
await replaceLatexInTextNode(properties, latexNode);
|
|
@@ -36,55 +41,82 @@ async function replaceLatexInTextNode(properties: Properties, node: Node) {
|
|
|
36
41
|
if (nextLatexPosition) {
|
|
37
42
|
// Get left non LaTeX text.
|
|
38
43
|
const leftText: string = textContent.substring(pos, nextLatexPosition.start);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
if (leftText) {
|
|
45
|
+
const leftTextNode = document.createTextNode(leftText);
|
|
46
|
+
// Create a node with left text.
|
|
47
|
+
node.parentNode?.insertBefore(leftTextNode, node);
|
|
48
|
+
}
|
|
43
49
|
|
|
44
50
|
// Get LaTeX text.
|
|
45
51
|
const latex = textContent.substring(nextLatexPosition.start + "$$".length, nextLatexPosition.end);
|
|
46
|
-
// Convert LaTeX to
|
|
52
|
+
// Convert LaTeX to MathML.
|
|
47
53
|
const response = await latexToMathml(latex, properties.editorServicesRoot, properties.editorServicesExtension);
|
|
48
|
-
// Insert
|
|
54
|
+
// Insert MathML node.
|
|
49
55
|
const fragment = document.createRange().createContextualFragment(response.text);
|
|
50
|
-
|
|
51
56
|
node.parentNode?.insertBefore(fragment, node);
|
|
52
|
-
node.nodeValue = node.nodeValue.substring(nextLatexPosition.start, nextLatexPosition.end);
|
|
53
57
|
|
|
58
|
+
// Update pos to search for next LaTeX instance.
|
|
54
59
|
pos = nextLatexPosition.end + "$$".length;
|
|
55
60
|
} else {
|
|
56
|
-
//
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
// If no more LaTeX found, append the rest of the text as a new text node and break the loop.
|
|
62
|
+
const remainingText = textContent.substring(pos);
|
|
63
|
+
if (remainingText) {
|
|
64
|
+
const remainingTextNode = document.createTextNode(remainingText);
|
|
65
|
+
node.parentNode?.insertBefore(remainingTextNode, node);
|
|
66
|
+
}
|
|
67
|
+
break; // Exit the loop as we've processed all text.
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
// Delete original text node.
|
|
70
|
+
// Remove the original node after processing.
|
|
66
71
|
node.parentNode?.removeChild(node);
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
75
|
+
* Finds and returns an array of text nodes containing LaTeX expressions.
|
|
76
|
+
*
|
|
77
|
+
* @param properties - The properties object.
|
|
78
|
+
* @param root - The root element to search within.
|
|
79
|
+
* @returns An array of text nodes containing LaTeX expressions.
|
|
73
80
|
*/
|
|
74
|
-
function findLatexTextNodes(root: any): Node[] {
|
|
75
|
-
const nodeIterator: NodeIterator =
|
|
76
|
-
|
|
77
|
-
);
|
|
81
|
+
function findLatexTextNodes(root: any, ignored_latex_containers: string | null): Node[] {
|
|
82
|
+
const nodeIterator: NodeIterator = createNodeIterator(root);
|
|
83
|
+
const blackListedNodes = root.querySelectorAll(ignored_latex_containers) ?? [];
|
|
78
84
|
const latexNodes: Node[] = [];
|
|
79
85
|
|
|
80
86
|
let currentNode: Node | null;
|
|
81
87
|
while ((currentNode = nodeIterator.nextNode())) {
|
|
88
|
+
if (blackListedNodes.length > 0 && isNodeBlacklisted(currentNode, blackListedNodes)) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
82
91
|
latexNodes.push(currentNode);
|
|
83
92
|
}
|
|
84
93
|
|
|
85
94
|
return latexNodes;
|
|
86
95
|
}
|
|
87
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Creates a NodeIterator to find text nodes containing LaTeX expressions.
|
|
99
|
+
*
|
|
100
|
+
* @param root - The root element to search within.
|
|
101
|
+
* @returns A NodeIterator for text nodes containing LaTeX expressions.
|
|
102
|
+
*/
|
|
103
|
+
function createNodeIterator(root: any): NodeIterator {
|
|
104
|
+
return document.createNodeIterator(root, NodeFilter.SHOW_TEXT, (node) =>
|
|
105
|
+
/(\$\$)(.*)(\$\$)/.test(node.nodeValue || "") ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Checks if a node or any of its ancestors are in the blacklist.
|
|
111
|
+
*
|
|
112
|
+
* @param node - The node to check.
|
|
113
|
+
* @param blackListedNodes - The list of blacklisted nodes.
|
|
114
|
+
* @returns True if the node or any of its ancestors are blacklisted, false otherwise.
|
|
115
|
+
*/
|
|
116
|
+
function isNodeBlacklisted(node: Node, blackListedNodes: NodeListOf<Element>): boolean {
|
|
117
|
+
return Array.from(blackListedNodes).some((blackListedNode) => blackListedNode.contains(node));
|
|
118
|
+
}
|
|
119
|
+
|
|
88
120
|
/**
|
|
89
121
|
* Returns an object {start, end} with the start and end latex position.
|
|
90
122
|
* @param {number} pos - Current position inside the text.
|
package/src/mathml.spec.ts
CHANGED
package/src/mathml.ts
CHANGED
|
@@ -35,10 +35,16 @@ function findSafeMathMLTextNodes(root: HTMLElement): Node[] {
|
|
|
35
35
|
* Parse the DOM looking for «math» formulas and replace them with the corresponding rendered images within the given element.
|
|
36
36
|
* @param {HTMLElement} root - Any DOM element that can contain MathML.
|
|
37
37
|
*/
|
|
38
|
-
function decodeSafeMathML(root:
|
|
38
|
+
function decodeSafeMathML(root: any, ignored_mathml_containers: string | null) {
|
|
39
39
|
const safeNodes = findSafeMathMLTextNodes(root);
|
|
40
|
+
const blackListedNodes = root.querySelectorAll(ignored_mathml_containers) ?? [];
|
|
40
41
|
|
|
41
42
|
for (const safeNode of safeNodes) {
|
|
43
|
+
if (blackListedNodes.length > 0 && isNodeBlacklisted(safeNode, blackListedNodes)) {
|
|
44
|
+
console.log("Node is blacklisted");
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
const mathml = MathML.safeXmlDecode(safeNode.textContent ?? "");
|
|
43
49
|
// Insert mathml node.
|
|
44
50
|
const fragment = document.createRange().createContextualFragment(mathml);
|
|
@@ -48,6 +54,17 @@ function decodeSafeMathML(root: HTMLElement) {
|
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a node or any of its ancestors are in the blacklist.
|
|
59
|
+
*
|
|
60
|
+
* @param node - The node to check.
|
|
61
|
+
* @param blackListedNodes - The list of blacklisted nodes.
|
|
62
|
+
* @returns True if the node or any of its ancestors are blacklisted, false otherwise.
|
|
63
|
+
*/
|
|
64
|
+
function isNodeBlacklisted(node: Node, blackListedNodes: NodeListOf<Element>): boolean {
|
|
65
|
+
return Array.from(blackListedNodes).some((blackListedNode) => blackListedNode.contains(node));
|
|
66
|
+
}
|
|
67
|
+
|
|
51
68
|
/**
|
|
52
69
|
* Parse the DOM looking for <math> elements and replace them with the corresponding rendered images within the given element.
|
|
53
70
|
* @param {Properties} properties - Properties of the viewer.
|
|
@@ -58,7 +75,7 @@ export async function renderMathML(properties: Properties, root: HTMLElement): P
|
|
|
58
75
|
return;
|
|
59
76
|
}
|
|
60
77
|
|
|
61
|
-
decodeSafeMathML(root);
|
|
78
|
+
decodeSafeMathML(root, properties.ignored_containers);
|
|
62
79
|
|
|
63
80
|
for (const mathElement of [...root.getElementsByTagName("math")]) {
|
|
64
81
|
const mml = serializeHtmlToXml(mathElement.outerHTML);
|
package/src/properties.ts
CHANGED
|
@@ -3,7 +3,7 @@ import Util from "@wiris/mathtype-html-integration-devkit/src/util";
|
|
|
3
3
|
|
|
4
4
|
// Helper types for Config below
|
|
5
5
|
type Viewer = "none" | "image" | "mathml" | "latex";
|
|
6
|
-
type
|
|
6
|
+
type StringifiedBoolean = "true" | "false";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Type representing all the configuration for the viewer.
|
|
@@ -12,15 +12,17 @@ export interface Config {
|
|
|
12
12
|
editorServicesRoot: string;
|
|
13
13
|
editorServicesExtension: string;
|
|
14
14
|
backendConfig: {
|
|
15
|
-
wirispluginperformance:
|
|
15
|
+
wirispluginperformance: StringifiedBoolean;
|
|
16
16
|
wiriseditormathmlattribute: string;
|
|
17
17
|
wiriscustomheaders: object;
|
|
18
|
+
wiriseditorparselatex: StringifiedBoolean;
|
|
18
19
|
};
|
|
19
20
|
dpi: number;
|
|
20
21
|
element: string;
|
|
21
22
|
lang: string;
|
|
22
23
|
viewer: Viewer;
|
|
23
24
|
zoom: number;
|
|
25
|
+
ignored_containers: string | null;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -33,12 +35,14 @@ const defaultValues: Config = {
|
|
|
33
35
|
wirispluginperformance: "true",
|
|
34
36
|
wiriseditormathmlattribute: "data-mathml",
|
|
35
37
|
wiriscustomheaders: {},
|
|
38
|
+
wiriseditorparselatex: "true",
|
|
36
39
|
},
|
|
37
40
|
dpi: 96,
|
|
38
41
|
element: "body",
|
|
39
42
|
lang: "en",
|
|
40
43
|
viewer: "none",
|
|
41
44
|
zoom: 1,
|
|
45
|
+
ignored_containers: null,
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
/**
|
|
@@ -88,7 +92,7 @@ export class Properties {
|
|
|
88
92
|
// Get backend parameters calling the configurationjson service
|
|
89
93
|
try {
|
|
90
94
|
Properties.instance.config.backendConfig = await configurationJson(
|
|
91
|
-
["wirispluginperformance", "wiriseditormathmlattribute", "wiriscustomheaders"],
|
|
95
|
+
["wirispluginperformance", "wiriseditormathmlattribute", "wiriscustomheaders", "wiriseditorparselatex"],
|
|
92
96
|
Properties.instance.editorServicesRoot,
|
|
93
97
|
Properties.instance.editorServicesExtension,
|
|
94
98
|
false,
|
|
@@ -143,6 +147,11 @@ export class Properties {
|
|
|
143
147
|
if (zoom !== null && zoom !== undefined) {
|
|
144
148
|
instance.config.zoom = +zoom;
|
|
145
149
|
}
|
|
150
|
+
|
|
151
|
+
const ignored_containers = urlParams.get("ignored_containers");
|
|
152
|
+
if (ignored_containers !== null && ignored_containers !== undefined) {
|
|
153
|
+
instance.config.ignored_containers = ignored_containers;
|
|
154
|
+
}
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
/**
|
|
@@ -152,9 +161,9 @@ export class Properties {
|
|
|
152
161
|
private async checkServices() {
|
|
153
162
|
const path = (document.currentScript as HTMLScriptElement).src;
|
|
154
163
|
|
|
155
|
-
if (path.includes("integration/WIRISplugins")) {
|
|
156
|
-
// If the path includes 'integration/WIRISplugins' use PHP Integrations Services
|
|
157
|
-
this.config.editorServicesRoot = path;
|
|
164
|
+
if (path.includes("integration/WIRISplugins") || path.includes("render/WIRISplugins")) {
|
|
165
|
+
// If the path includes 'integration/WIRISplugins' use PHP Integrations Services or Moodle.
|
|
166
|
+
this.config.editorServicesRoot = path.replace("render/WIRISplugins", "integration/WIRISplugins");
|
|
158
167
|
this.config.editorServicesExtension = ".php";
|
|
159
168
|
} else {
|
|
160
169
|
try {
|
|
@@ -276,11 +285,11 @@ export class Properties {
|
|
|
276
285
|
* - The backend configuration of the parameter.
|
|
277
286
|
* - true, by default.
|
|
278
287
|
*/
|
|
279
|
-
get wirispluginperformance():
|
|
288
|
+
get wirispluginperformance(): StringifiedBoolean {
|
|
280
289
|
return this.config.backendConfig.wirispluginperformance || defaultValues.backendConfig.wirispluginperformance;
|
|
281
290
|
}
|
|
282
291
|
|
|
283
|
-
set wirispluginperformance(wirispluginperformance:
|
|
292
|
+
set wirispluginperformance(wirispluginperformance: StringifiedBoolean) {
|
|
284
293
|
this.config.backendConfig.wirispluginperformance = wirispluginperformance;
|
|
285
294
|
this.render();
|
|
286
295
|
}
|
|
@@ -301,4 +310,22 @@ export class Properties {
|
|
|
301
310
|
this.config.backendConfig.wiriseditormathmlattribute = wiriseditormathmlattribute;
|
|
302
311
|
this.render();
|
|
303
312
|
}
|
|
313
|
+
|
|
314
|
+
get wiriseditorparselatex(): StringifiedBoolean {
|
|
315
|
+
return this.config.backendConfig.wiriseditorparselatex || defaultValues.backendConfig.wiriseditorparselatex;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
set wiriseditorparselatex(wiriseditorparselatex: StringifiedBoolean) {
|
|
319
|
+
this.config.backendConfig.wiriseditorparselatex = wiriseditorparselatex;
|
|
320
|
+
this.render();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
get ignored_containers(): string | null {
|
|
324
|
+
return this.config.ignored_containers ?? defaultValues.ignored_containers;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
set ignored_containers(ignored_containers: string) {
|
|
328
|
+
this.config.ignored_containers = ignored_containers;
|
|
329
|
+
this.render();
|
|
330
|
+
}
|
|
304
331
|
}
|