@manuscripts/transform 1.3.5 → 1.3.6
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.
|
@@ -18,10 +18,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.convertMathMLToSVG = void 0;
|
|
19
19
|
require("mathjax-full/js/util/entities/all");
|
|
20
20
|
const HTMLAdaptor_1 = require("mathjax-full/js/adaptors/HTMLAdaptor");
|
|
21
|
+
const MmlFactory_1 = require("mathjax-full/js/core/MmlTree/MmlFactory");
|
|
21
22
|
const HTMLDocument_1 = require("mathjax-full/js/handlers/html/HTMLDocument");
|
|
22
23
|
const mathml_1 = require("mathjax-full/js/input/mathml");
|
|
23
24
|
const svg_1 = require("mathjax-full/js/output/svg");
|
|
24
25
|
const transformer_1 = require("../transformer");
|
|
26
|
+
class ManuscriptsMmlFactory extends MmlFactory_1.MmlFactory {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.nodeMap.set('image', this.nodeMap.get('none'));
|
|
30
|
+
}
|
|
31
|
+
create(kind, properties = {}, children = []) {
|
|
32
|
+
if (kind === 'image') {
|
|
33
|
+
return this.node['none'](properties, children);
|
|
34
|
+
}
|
|
35
|
+
return this.node[kind](properties, children);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
25
38
|
class ManuscriptsHTMLAdaptor extends HTMLAdaptor_1.HTMLAdaptor {
|
|
26
39
|
setAttribute(node, name, value, ns) {
|
|
27
40
|
if (name !== 'xmlns') {
|
|
@@ -37,6 +50,7 @@ const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
|
37
50
|
const doc = new HTMLDocument_1.HTMLDocument(document, adaptor, {
|
|
38
51
|
InputJax,
|
|
39
52
|
OutputJax,
|
|
53
|
+
MmlFactory: new ManuscriptsMmlFactory(),
|
|
40
54
|
});
|
|
41
55
|
doc.addStyleSheet();
|
|
42
56
|
const convertMathMLToSVG = (mathml, display) => {
|
|
@@ -15,10 +15,23 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import 'mathjax-full/js/util/entities/all';
|
|
17
17
|
import { HTMLAdaptor } from 'mathjax-full/js/adaptors/HTMLAdaptor';
|
|
18
|
+
import { MmlFactory } from 'mathjax-full/js/core/MmlTree/MmlFactory';
|
|
18
19
|
import { HTMLDocument } from 'mathjax-full/js/handlers/html/HTMLDocument';
|
|
19
20
|
import { MathML } from 'mathjax-full/js/input/mathml';
|
|
20
21
|
import { SVG } from 'mathjax-full/js/output/svg';
|
|
21
22
|
import { xmlSerializer } from '../transformer';
|
|
23
|
+
class ManuscriptsMmlFactory extends MmlFactory {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
this.nodeMap.set('image', this.nodeMap.get('none'));
|
|
27
|
+
}
|
|
28
|
+
create(kind, properties = {}, children = []) {
|
|
29
|
+
if (kind === 'image') {
|
|
30
|
+
return this.node['none'](properties, children);
|
|
31
|
+
}
|
|
32
|
+
return this.node[kind](properties, children);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
22
35
|
class ManuscriptsHTMLAdaptor extends HTMLAdaptor {
|
|
23
36
|
setAttribute(node, name, value, ns) {
|
|
24
37
|
if (name !== 'xmlns') {
|
|
@@ -34,6 +47,7 @@ const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
|
34
47
|
const doc = new HTMLDocument(document, adaptor, {
|
|
35
48
|
InputJax,
|
|
36
49
|
OutputJax,
|
|
50
|
+
MmlFactory: new ManuscriptsMmlFactory(),
|
|
37
51
|
});
|
|
38
52
|
doc.addStyleSheet();
|
|
39
53
|
export const convertMathMLToSVG = (mathml, display) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.6",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|