@manuscripts/body-editor 1.7.1 → 1.7.2-LEAN-3092
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/cjs/commands.js +2 -3
- package/dist/cjs/configs/editor-views.js +1 -0
- package/dist/cjs/lib/helpers.js +44 -1
- package/dist/cjs/lib/mathml-to-svg.js +70 -0
- package/dist/cjs/lib/tex-to-svg.js +60 -0
- package/dist/cjs/views/equation.js +16 -13
- package/dist/cjs/views/equation_editable.js +3 -9
- package/dist/cjs/views/equation_element.js +6 -3
- package/dist/cjs/views/inline_equation.js +16 -13
- package/dist/cjs/views/inline_equation_editable.js +3 -9
- package/dist/es/commands.js +3 -4
- package/dist/es/configs/editor-views.js +1 -0
- package/dist/es/lib/helpers.js +19 -0
- package/dist/es/lib/mathml-to-svg.js +66 -0
- package/dist/es/lib/tex-to-svg.js +56 -0
- package/dist/es/views/equation.js +16 -13
- package/dist/es/views/equation_editable.js +3 -9
- package/dist/es/views/equation_element.js +6 -3
- package/dist/es/views/inline_equation.js +16 -13
- package/dist/es/views/inline_equation_editable.js +3 -9
- package/dist/types/configs/editor-views.d.ts +3 -0
- package/dist/types/lib/helpers.d.ts +1 -0
- package/dist/types/lib/mathml-to-svg.d.ts +17 -0
- package/dist/types/lib/tex-to-svg.d.ts +18 -0
- package/package.json +7 -6
package/dist/cjs/commands.js
CHANGED
|
@@ -109,7 +109,6 @@ const createBlock = (nodeType, position, state, dispatch) => {
|
|
|
109
109
|
case state.schema.nodes.equation_element:
|
|
110
110
|
node = state.schema.nodes.equation_element.create({}, [
|
|
111
111
|
state.schema.nodes.equation.create(),
|
|
112
|
-
createAndFillFigcaptionElement(state),
|
|
113
112
|
]);
|
|
114
113
|
break;
|
|
115
114
|
default:
|
|
@@ -264,10 +263,10 @@ const insertCrossReference = (state, dispatch) => {
|
|
|
264
263
|
};
|
|
265
264
|
exports.insertCrossReference = insertCrossReference;
|
|
266
265
|
const insertInlineEquation = (state, dispatch) => {
|
|
267
|
-
const inlineMathFragment = (0, transform_1.buildInlineMathFragment)(state.selection.$anchor.parent.attrs.id, selectedText().replace(/^\$/, '').replace(/\$$/, ''));
|
|
268
266
|
const sourcePos = state.selection.from - 1;
|
|
269
267
|
const tr = state.tr.replaceSelectionWith(state.schema.nodes.inline_equation.create({
|
|
270
|
-
|
|
268
|
+
format: 'tex',
|
|
269
|
+
contents: selectedText().replace(/^\$/, '').replace(/\$$/, ''),
|
|
271
270
|
}));
|
|
272
271
|
if (dispatch) {
|
|
273
272
|
const selection = prosemirror_state_1.NodeSelection.create(tr.doc, tr.mapping.map(sourcePos) + 1);
|
|
@@ -86,5 +86,6 @@ exports.default = (props, dispatch) => {
|
|
|
86
86
|
table_element_footer: (0, table_element_footer_editable_1.default)(props),
|
|
87
87
|
toc_element: (0, toc_element_editable_1.default)(props),
|
|
88
88
|
comments: (0, empty_1.default)('comments'),
|
|
89
|
+
supplements: (0, empty_1.default)('supplements'),
|
|
89
90
|
};
|
|
90
91
|
};
|
package/dist/cjs/lib/helpers.js
CHANGED
|
@@ -14,8 +14,40 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
17
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.mergeSimilarItems = exports.nearestAncestor = exports.isNodeOfType = void 0;
|
|
50
|
+
exports.renderMath = exports.mergeSimilarItems = exports.nearestAncestor = exports.isNodeOfType = void 0;
|
|
19
51
|
const isNodeOfType = (...type) => (node) => {
|
|
20
52
|
const [head, ...tail] = type;
|
|
21
53
|
if (node.type === node.type.schema.nodes[head]) {
|
|
@@ -50,3 +82,14 @@ const mergeSimilarItems = (compareFunc, mergeFunc) => (items) => {
|
|
|
50
82
|
}, []);
|
|
51
83
|
};
|
|
52
84
|
exports.mergeSimilarItems = mergeSimilarItems;
|
|
85
|
+
const renderMath = (math, format) => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
if (format === 'tex') {
|
|
87
|
+
const { convertTeXToSVG } = yield Promise.resolve().then(() => __importStar(require('../lib/tex-to-svg')));
|
|
88
|
+
return convertTeXToSVG(math);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const { convertMathMLToSVG } = yield Promise.resolve().then(() => __importStar(require('../lib/mathml-to-svg')));
|
|
92
|
+
return convertMathMLToSVG(math);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
exports.renderMath = renderMath;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.convertMathMLToSVG = void 0;
|
|
19
|
+
require("mathjax-full/js/util/entities/all");
|
|
20
|
+
const transform_1 = require("@manuscripts/transform");
|
|
21
|
+
const HTMLAdaptor_1 = require("mathjax-full/js/adaptors/HTMLAdaptor");
|
|
22
|
+
const MmlFactory_1 = require("mathjax-full/js/core/MmlTree/MmlFactory");
|
|
23
|
+
const HTMLDocument_1 = require("mathjax-full/js/handlers/html/HTMLDocument");
|
|
24
|
+
const mathml_1 = require("mathjax-full/js/input/mathml");
|
|
25
|
+
const svg_1 = require("mathjax-full/js/output/svg");
|
|
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
|
+
}
|
|
38
|
+
class ManuscriptsHTMLAdaptor extends HTMLAdaptor_1.HTMLAdaptor {
|
|
39
|
+
setAttribute(node, name, value, ns) {
|
|
40
|
+
if (name !== 'xmlns') {
|
|
41
|
+
ns ? node.setAttributeNS(ns, name, value) : node.setAttribute(name, value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const InputJax = new mathml_1.MathML();
|
|
46
|
+
const OutputJax = new svg_1.SVG({
|
|
47
|
+
fontCache: 'none',
|
|
48
|
+
});
|
|
49
|
+
const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
50
|
+
const doc = new HTMLDocument_1.HTMLDocument(document, adaptor, {
|
|
51
|
+
InputJax,
|
|
52
|
+
OutputJax,
|
|
53
|
+
MmlFactory: new ManuscriptsMmlFactory(),
|
|
54
|
+
});
|
|
55
|
+
doc.addStyleSheet();
|
|
56
|
+
const convertMathMLToSVG = (mathml, display = true) => {
|
|
57
|
+
const item = doc.convert(mathml, {
|
|
58
|
+
display,
|
|
59
|
+
em: 16,
|
|
60
|
+
ex: 8,
|
|
61
|
+
containerWidth: 1000000,
|
|
62
|
+
lineWidth: 1000000,
|
|
63
|
+
scale: 1,
|
|
64
|
+
});
|
|
65
|
+
if (!item || !item.firstChild) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return transform_1.xmlSerializer.serializeToString(item.firstChild);
|
|
69
|
+
};
|
|
70
|
+
exports.convertMathMLToSVG = convertMathMLToSVG;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.convertTeXToSVG = exports.packages = void 0;
|
|
19
|
+
require("mathjax-full/js/util/entities/all");
|
|
20
|
+
const transform_1 = require("@manuscripts/transform");
|
|
21
|
+
const HTMLAdaptor_1 = require("mathjax-full/js/adaptors/HTMLAdaptor");
|
|
22
|
+
const HTMLDocument_1 = require("mathjax-full/js/handlers/html/HTMLDocument");
|
|
23
|
+
const tex_1 = require("mathjax-full/js/input/tex");
|
|
24
|
+
const AllPackages_1 = require("mathjax-full/js/input/tex/AllPackages");
|
|
25
|
+
const svg_1 = require("mathjax-full/js/output/svg");
|
|
26
|
+
exports.packages = AllPackages_1.AllPackages.filter((name) => name !== 'html' && name !== 'bussproofs');
|
|
27
|
+
class ManuscriptsHTMLAdaptor extends HTMLAdaptor_1.HTMLAdaptor {
|
|
28
|
+
setAttribute(node, name, value, ns) {
|
|
29
|
+
if (name !== 'xmlns') {
|
|
30
|
+
ns ? node.setAttributeNS(ns, name, value) : node.setAttribute(name, value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const InputJax = new tex_1.TeX({
|
|
35
|
+
packages: exports.packages,
|
|
36
|
+
});
|
|
37
|
+
const OutputJax = new svg_1.SVG({
|
|
38
|
+
fontCache: 'none',
|
|
39
|
+
});
|
|
40
|
+
const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
41
|
+
const doc = new HTMLDocument_1.HTMLDocument(document, adaptor, {
|
|
42
|
+
InputJax,
|
|
43
|
+
OutputJax,
|
|
44
|
+
});
|
|
45
|
+
doc.addStyleSheet();
|
|
46
|
+
const convertTeXToSVG = (tex, display = true) => {
|
|
47
|
+
const item = doc.convert(tex, {
|
|
48
|
+
display,
|
|
49
|
+
em: 16,
|
|
50
|
+
ex: 8,
|
|
51
|
+
containerWidth: 1000000,
|
|
52
|
+
lineWidth: 1000000,
|
|
53
|
+
scale: 1,
|
|
54
|
+
});
|
|
55
|
+
if (!item || !item.firstChild) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return transform_1.xmlSerializer.serializeToString(item.firstChild);
|
|
59
|
+
};
|
|
60
|
+
exports.convertTeXToSVG = convertTeXToSVG;
|
|
@@ -19,6 +19,7 @@ exports.EquationView = void 0;
|
|
|
19
19
|
const dompurify_1 = require("../lib/dompurify");
|
|
20
20
|
const base_node_view_1 = require("./base_node_view");
|
|
21
21
|
const creators_1 = require("./creators");
|
|
22
|
+
const helpers_1 = require("../lib/helpers");
|
|
22
23
|
class EquationView extends base_node_view_1.BaseNodeView {
|
|
23
24
|
constructor() {
|
|
24
25
|
super(...arguments);
|
|
@@ -32,22 +33,24 @@ class EquationView extends base_node_view_1.BaseNodeView {
|
|
|
32
33
|
this.dom.setAttribute('id', this.node.attrs.id);
|
|
33
34
|
};
|
|
34
35
|
this.updateContents = () => {
|
|
35
|
-
const {
|
|
36
|
+
const { contents, format } = this.node.attrs;
|
|
36
37
|
while (this.dom.hasChildNodes()) {
|
|
37
38
|
this.dom.removeChild(this.dom.firstChild);
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
(0, helpers_1.renderMath)(contents, format).then((svgContent) => {
|
|
41
|
+
if (svgContent) {
|
|
42
|
+
const fragment = (0, dompurify_1.sanitize)(svgContent, {
|
|
43
|
+
USE_PROFILES: { svg: true },
|
|
44
|
+
});
|
|
45
|
+
this.dom.appendChild(fragment);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const placeholder = document.createElement('div');
|
|
49
|
+
placeholder.className = 'equation-placeholder';
|
|
50
|
+
placeholder.textContent = '<Equation>';
|
|
51
|
+
this.dom.appendChild(placeholder);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
51
54
|
};
|
|
52
55
|
this.ignoreMutation = () => true;
|
|
53
56
|
}
|
|
@@ -48,7 +48,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.EquationEditableView = void 0;
|
|
51
|
-
const transform_1 = require("@manuscripts/transform");
|
|
52
51
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
53
52
|
const creators_1 = require("./creators");
|
|
54
53
|
const equation_1 = require("./equation");
|
|
@@ -62,21 +61,16 @@ class EquationEditableView extends equation_1.EquationView {
|
|
|
62
61
|
const { createEditor } = yield Promise.resolve().then(() => __importStar(require('../lib/codemirror')));
|
|
63
62
|
const placeholder = 'Enter LaTeX equation, e.g. "a^2 = \\sqrt{b^2 + c^2}"';
|
|
64
63
|
const input = yield createEditor({
|
|
65
|
-
value: this.node.attrs.
|
|
64
|
+
value: this.node.attrs.contents || '',
|
|
66
65
|
mode: 'stex',
|
|
67
66
|
placeholder,
|
|
68
67
|
autofocus: true,
|
|
69
68
|
});
|
|
70
69
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const
|
|
72
|
-
const SVGStringRepresentation = yield (0, transform_1.convertTeXToSVG)(TeXRepresentation, true);
|
|
73
|
-
if (!SVGStringRepresentation) {
|
|
74
|
-
throw new Error('No SVG output from MathJax');
|
|
75
|
-
}
|
|
70
|
+
const contents = input.getValue();
|
|
76
71
|
const pos = this.getPos();
|
|
77
72
|
const { tr } = this.view.state;
|
|
78
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
79
|
-
SVGStringRepresentation })).setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
73
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { contents, format: 'tex' })).setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
80
74
|
this.view.dispatch(tr);
|
|
81
75
|
}));
|
|
82
76
|
const wrapper = document.createElement('div');
|
|
@@ -27,9 +27,12 @@ class EquationElementView extends block_view_1.default {
|
|
|
27
27
|
this.elementType = 'figure';
|
|
28
28
|
this.updateContents = () => {
|
|
29
29
|
var _a;
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const { label } = this.node.attrs;
|
|
31
|
+
if (label) {
|
|
32
|
+
const labelEl = document.createElement('label');
|
|
33
|
+
labelEl.textContent = label;
|
|
34
|
+
this.dom.appendChild(labelEl);
|
|
35
|
+
}
|
|
33
36
|
if ((_a = this.node.attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.length) {
|
|
34
37
|
const lastChange = this.node.attrs.dataTracked[this.node.attrs.dataTracked.length - 1];
|
|
35
38
|
this.dom.setAttribute('data-track-status', lastChange.status);
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.InlineEquationView = void 0;
|
|
19
19
|
const dompurify_1 = require("../lib/dompurify");
|
|
20
|
+
const helpers_1 = require("../lib/helpers");
|
|
20
21
|
const track_changes_utils_1 = require("../lib/track-changes-utils");
|
|
21
22
|
const base_node_view_1 = require("./base_node_view");
|
|
22
23
|
const creators_1 = require("./creators");
|
|
@@ -29,22 +30,24 @@ class InlineEquationView extends base_node_view_1.BaseNodeView {
|
|
|
29
30
|
};
|
|
30
31
|
this.updateContents = () => {
|
|
31
32
|
if (!(0, track_changes_utils_1.isRejectedInsert)(this.node)) {
|
|
32
|
-
const {
|
|
33
|
+
const { contents, format } = this.node.attrs;
|
|
33
34
|
while (this.dom.hasChildNodes()) {
|
|
34
35
|
this.dom.removeChild(this.dom.firstChild);
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
(0, helpers_1.renderMath)(contents, format).then((svgContent) => {
|
|
38
|
+
if (svgContent) {
|
|
39
|
+
const fragment = (0, dompurify_1.sanitize)(svgContent, {
|
|
40
|
+
USE_PROFILES: { svg: true },
|
|
41
|
+
});
|
|
42
|
+
this.dom.appendChild(fragment);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const placeholder = document.createElement('div');
|
|
46
|
+
placeholder.className = 'equation-placeholder';
|
|
47
|
+
placeholder.textContent = '<Equation>';
|
|
48
|
+
this.dom.appendChild(placeholder);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
48
51
|
}
|
|
49
52
|
else {
|
|
50
53
|
this.dom.innerHTML = '';
|
|
@@ -48,7 +48,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.InlineEquationEditableView = void 0;
|
|
51
|
-
const transform_1 = require("@manuscripts/transform");
|
|
52
51
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
53
52
|
const creators_1 = require("./creators");
|
|
54
53
|
const inline_equation_1 = require("./inline_equation");
|
|
@@ -62,21 +61,16 @@ class InlineEquationEditableView extends inline_equation_1.InlineEquationView {
|
|
|
62
61
|
const { createEditor } = yield Promise.resolve().then(() => __importStar(require('../lib/codemirror')));
|
|
63
62
|
const placeholder = 'Enter LaTeX equation, e.g. "E=mc^2"';
|
|
64
63
|
const input = yield createEditor({
|
|
65
|
-
value: this.node.attrs.
|
|
64
|
+
value: this.node.attrs.contents || '',
|
|
66
65
|
mode: 'stex',
|
|
67
66
|
placeholder,
|
|
68
67
|
autofocus: true,
|
|
69
68
|
});
|
|
70
69
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const
|
|
72
|
-
const SVGRepresentation = yield (0, transform_1.convertTeXToSVG)(TeXRepresentation, true);
|
|
73
|
-
if (!SVGRepresentation) {
|
|
74
|
-
throw new Error('No SVG output from MathJax');
|
|
75
|
-
}
|
|
70
|
+
const contents = input.getValue();
|
|
76
71
|
const pos = this.getPos();
|
|
77
72
|
const { tr } = this.view.state;
|
|
78
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
79
|
-
SVGRepresentation })).setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
73
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { format: 'tex', contents })).setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
80
74
|
this.view.dispatch(tr);
|
|
81
75
|
}));
|
|
82
76
|
this.props.popper.show(this.dom, input.getWrapperElement(), 'bottom');
|
package/dist/es/commands.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
|
18
|
-
import { buildComment,
|
|
18
|
+
import { buildComment, generateID, isElementNodeType, isInBibliographySection, isListNode, isSectionNodeType, schema, } from '@manuscripts/transform';
|
|
19
19
|
import { NodeRange } from 'prosemirror-model';
|
|
20
20
|
import { wrapInList } from 'prosemirror-schema-list';
|
|
21
21
|
import { NodeSelection, TextSelection, } from 'prosemirror-state';
|
|
@@ -101,7 +101,6 @@ export const createBlock = (nodeType, position, state, dispatch) => {
|
|
|
101
101
|
case state.schema.nodes.equation_element:
|
|
102
102
|
node = state.schema.nodes.equation_element.create({}, [
|
|
103
103
|
state.schema.nodes.equation.create(),
|
|
104
|
-
createAndFillFigcaptionElement(state),
|
|
105
104
|
]);
|
|
106
105
|
break;
|
|
107
106
|
default:
|
|
@@ -247,10 +246,10 @@ export const insertCrossReference = (state, dispatch) => {
|
|
|
247
246
|
return true;
|
|
248
247
|
};
|
|
249
248
|
export const insertInlineEquation = (state, dispatch) => {
|
|
250
|
-
const inlineMathFragment = buildInlineMathFragment(state.selection.$anchor.parent.attrs.id, selectedText().replace(/^\$/, '').replace(/\$$/, ''));
|
|
251
249
|
const sourcePos = state.selection.from - 1;
|
|
252
250
|
const tr = state.tr.replaceSelectionWith(state.schema.nodes.inline_equation.create({
|
|
253
|
-
|
|
251
|
+
format: 'tex',
|
|
252
|
+
contents: selectedText().replace(/^\$/, '').replace(/\$$/, ''),
|
|
254
253
|
}));
|
|
255
254
|
if (dispatch) {
|
|
256
255
|
const selection = NodeSelection.create(tr.doc, tr.mapping.map(sourcePos) + 1);
|
package/dist/es/lib/helpers.js
CHANGED
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
16
25
|
export const isNodeOfType = (...type) => (node) => {
|
|
17
26
|
const [head, ...tail] = type;
|
|
18
27
|
if (node.type === node.type.schema.nodes[head]) {
|
|
@@ -44,3 +53,13 @@ export const mergeSimilarItems = (compareFunc, mergeFunc) => (items) => {
|
|
|
44
53
|
];
|
|
45
54
|
}, []);
|
|
46
55
|
};
|
|
56
|
+
export const renderMath = (math, format) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
if (format === 'tex') {
|
|
58
|
+
const { convertTeXToSVG } = yield import('../lib/tex-to-svg');
|
|
59
|
+
return convertTeXToSVG(math);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const { convertMathMLToSVG } = yield import('../lib/mathml-to-svg');
|
|
63
|
+
return convertMathMLToSVG(math);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
import { xmlSerializer } from '@manuscripts/transform';
|
|
18
|
+
import { HTMLAdaptor } from 'mathjax-full/js/adaptors/HTMLAdaptor';
|
|
19
|
+
import { MmlFactory } from 'mathjax-full/js/core/MmlTree/MmlFactory';
|
|
20
|
+
import { HTMLDocument } from 'mathjax-full/js/handlers/html/HTMLDocument';
|
|
21
|
+
import { MathML } from 'mathjax-full/js/input/mathml';
|
|
22
|
+
import { SVG } from 'mathjax-full/js/output/svg';
|
|
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
|
+
}
|
|
35
|
+
class ManuscriptsHTMLAdaptor extends HTMLAdaptor {
|
|
36
|
+
setAttribute(node, name, value, ns) {
|
|
37
|
+
if (name !== 'xmlns') {
|
|
38
|
+
ns ? node.setAttributeNS(ns, name, value) : node.setAttribute(name, value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const InputJax = new MathML();
|
|
43
|
+
const OutputJax = new SVG({
|
|
44
|
+
fontCache: 'none',
|
|
45
|
+
});
|
|
46
|
+
const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
47
|
+
const doc = new HTMLDocument(document, adaptor, {
|
|
48
|
+
InputJax,
|
|
49
|
+
OutputJax,
|
|
50
|
+
MmlFactory: new ManuscriptsMmlFactory(),
|
|
51
|
+
});
|
|
52
|
+
doc.addStyleSheet();
|
|
53
|
+
export const convertMathMLToSVG = (mathml, display = true) => {
|
|
54
|
+
const item = doc.convert(mathml, {
|
|
55
|
+
display,
|
|
56
|
+
em: 16,
|
|
57
|
+
ex: 8,
|
|
58
|
+
containerWidth: 1000000,
|
|
59
|
+
lineWidth: 1000000,
|
|
60
|
+
scale: 1,
|
|
61
|
+
});
|
|
62
|
+
if (!item || !item.firstChild) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return xmlSerializer.serializeToString(item.firstChild);
|
|
66
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
import { xmlSerializer } from '@manuscripts/transform';
|
|
18
|
+
import { HTMLAdaptor } from 'mathjax-full/js/adaptors/HTMLAdaptor';
|
|
19
|
+
import { HTMLDocument } from 'mathjax-full/js/handlers/html/HTMLDocument';
|
|
20
|
+
import { TeX } from 'mathjax-full/js/input/tex';
|
|
21
|
+
import { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';
|
|
22
|
+
import { SVG } from 'mathjax-full/js/output/svg';
|
|
23
|
+
export const packages = AllPackages.filter((name) => name !== 'html' && name !== 'bussproofs');
|
|
24
|
+
class ManuscriptsHTMLAdaptor extends HTMLAdaptor {
|
|
25
|
+
setAttribute(node, name, value, ns) {
|
|
26
|
+
if (name !== 'xmlns') {
|
|
27
|
+
ns ? node.setAttributeNS(ns, name, value) : node.setAttribute(name, value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const InputJax = new TeX({
|
|
32
|
+
packages,
|
|
33
|
+
});
|
|
34
|
+
const OutputJax = new SVG({
|
|
35
|
+
fontCache: 'none',
|
|
36
|
+
});
|
|
37
|
+
const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
38
|
+
const doc = new HTMLDocument(document, adaptor, {
|
|
39
|
+
InputJax,
|
|
40
|
+
OutputJax,
|
|
41
|
+
});
|
|
42
|
+
doc.addStyleSheet();
|
|
43
|
+
export const convertTeXToSVG = (tex, display = true) => {
|
|
44
|
+
const item = doc.convert(tex, {
|
|
45
|
+
display,
|
|
46
|
+
em: 16,
|
|
47
|
+
ex: 8,
|
|
48
|
+
containerWidth: 1000000,
|
|
49
|
+
lineWidth: 1000000,
|
|
50
|
+
scale: 1,
|
|
51
|
+
});
|
|
52
|
+
if (!item || !item.firstChild) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return xmlSerializer.serializeToString(item.firstChild);
|
|
56
|
+
};
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { sanitize } from '../lib/dompurify';
|
|
17
17
|
import { BaseNodeView } from './base_node_view';
|
|
18
18
|
import { createNodeView } from './creators';
|
|
19
|
+
import { renderMath } from "../lib/helpers";
|
|
19
20
|
export class EquationView extends BaseNodeView {
|
|
20
21
|
constructor() {
|
|
21
22
|
super(...arguments);
|
|
@@ -29,22 +30,24 @@ export class EquationView extends BaseNodeView {
|
|
|
29
30
|
this.dom.setAttribute('id', this.node.attrs.id);
|
|
30
31
|
};
|
|
31
32
|
this.updateContents = () => {
|
|
32
|
-
const {
|
|
33
|
+
const { contents, format } = this.node.attrs;
|
|
33
34
|
while (this.dom.hasChildNodes()) {
|
|
34
35
|
this.dom.removeChild(this.dom.firstChild);
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
renderMath(contents, format).then((svgContent) => {
|
|
38
|
+
if (svgContent) {
|
|
39
|
+
const fragment = sanitize(svgContent, {
|
|
40
|
+
USE_PROFILES: { svg: true },
|
|
41
|
+
});
|
|
42
|
+
this.dom.appendChild(fragment);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const placeholder = document.createElement('div');
|
|
46
|
+
placeholder.className = 'equation-placeholder';
|
|
47
|
+
placeholder.textContent = '<Equation>';
|
|
48
|
+
this.dom.appendChild(placeholder);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
48
51
|
};
|
|
49
52
|
this.ignoreMutation = () => true;
|
|
50
53
|
}
|
|
@@ -22,7 +22,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
import { convertTeXToSVG } from '@manuscripts/transform';
|
|
26
25
|
import { NodeSelection } from 'prosemirror-state';
|
|
27
26
|
import { createEditableNodeView } from './creators';
|
|
28
27
|
import { EquationView } from './equation';
|
|
@@ -36,21 +35,16 @@ export class EquationEditableView extends EquationView {
|
|
|
36
35
|
const { createEditor } = yield import('../lib/codemirror');
|
|
37
36
|
const placeholder = 'Enter LaTeX equation, e.g. "a^2 = \\sqrt{b^2 + c^2}"';
|
|
38
37
|
const input = yield createEditor({
|
|
39
|
-
value: this.node.attrs.
|
|
38
|
+
value: this.node.attrs.contents || '',
|
|
40
39
|
mode: 'stex',
|
|
41
40
|
placeholder,
|
|
42
41
|
autofocus: true,
|
|
43
42
|
});
|
|
44
43
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const
|
|
46
|
-
const SVGStringRepresentation = yield convertTeXToSVG(TeXRepresentation, true);
|
|
47
|
-
if (!SVGStringRepresentation) {
|
|
48
|
-
throw new Error('No SVG output from MathJax');
|
|
49
|
-
}
|
|
44
|
+
const contents = input.getValue();
|
|
50
45
|
const pos = this.getPos();
|
|
51
46
|
const { tr } = this.view.state;
|
|
52
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
53
|
-
SVGStringRepresentation })).setSelection(NodeSelection.create(tr.doc, pos));
|
|
47
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { contents, format: 'tex' })).setSelection(NodeSelection.create(tr.doc, pos));
|
|
54
48
|
this.view.dispatch(tr);
|
|
55
49
|
}));
|
|
56
50
|
const wrapper = document.createElement('div');
|
|
@@ -21,9 +21,12 @@ export class EquationElementView extends BlockView {
|
|
|
21
21
|
this.elementType = 'figure';
|
|
22
22
|
this.updateContents = () => {
|
|
23
23
|
var _a;
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const { label } = this.node.attrs;
|
|
25
|
+
if (label) {
|
|
26
|
+
const labelEl = document.createElement('label');
|
|
27
|
+
labelEl.textContent = label;
|
|
28
|
+
this.dom.appendChild(labelEl);
|
|
29
|
+
}
|
|
27
30
|
if ((_a = this.node.attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.length) {
|
|
28
31
|
const lastChange = this.node.attrs.dataTracked[this.node.attrs.dataTracked.length - 1];
|
|
29
32
|
this.dom.setAttribute('data-track-status', lastChange.status);
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { sanitize } from '../lib/dompurify';
|
|
17
|
+
import { renderMath } from '../lib/helpers';
|
|
17
18
|
import { isRejectedInsert } from '../lib/track-changes-utils';
|
|
18
19
|
import { BaseNodeView } from './base_node_view';
|
|
19
20
|
import { createNodeView } from './creators';
|
|
@@ -26,22 +27,24 @@ export class InlineEquationView extends BaseNodeView {
|
|
|
26
27
|
};
|
|
27
28
|
this.updateContents = () => {
|
|
28
29
|
if (!isRejectedInsert(this.node)) {
|
|
29
|
-
const {
|
|
30
|
+
const { contents, format } = this.node.attrs;
|
|
30
31
|
while (this.dom.hasChildNodes()) {
|
|
31
32
|
this.dom.removeChild(this.dom.firstChild);
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
renderMath(contents, format).then((svgContent) => {
|
|
35
|
+
if (svgContent) {
|
|
36
|
+
const fragment = sanitize(svgContent, {
|
|
37
|
+
USE_PROFILES: { svg: true },
|
|
38
|
+
});
|
|
39
|
+
this.dom.appendChild(fragment);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const placeholder = document.createElement('div');
|
|
43
|
+
placeholder.className = 'equation-placeholder';
|
|
44
|
+
placeholder.textContent = '<Equation>';
|
|
45
|
+
this.dom.appendChild(placeholder);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
else {
|
|
47
50
|
this.dom.innerHTML = '';
|
|
@@ -22,7 +22,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
import { convertTeXToSVG } from '@manuscripts/transform';
|
|
26
25
|
import { NodeSelection } from 'prosemirror-state';
|
|
27
26
|
import { createEditableNodeView } from './creators';
|
|
28
27
|
import { InlineEquationView } from './inline_equation';
|
|
@@ -36,21 +35,16 @@ export class InlineEquationEditableView extends InlineEquationView {
|
|
|
36
35
|
const { createEditor } = yield import('../lib/codemirror');
|
|
37
36
|
const placeholder = 'Enter LaTeX equation, e.g. "E=mc^2"';
|
|
38
37
|
const input = yield createEditor({
|
|
39
|
-
value: this.node.attrs.
|
|
38
|
+
value: this.node.attrs.contents || '',
|
|
40
39
|
mode: 'stex',
|
|
41
40
|
placeholder,
|
|
42
41
|
autofocus: true,
|
|
43
42
|
});
|
|
44
43
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const
|
|
46
|
-
const SVGRepresentation = yield convertTeXToSVG(TeXRepresentation, true);
|
|
47
|
-
if (!SVGRepresentation) {
|
|
48
|
-
throw new Error('No SVG output from MathJax');
|
|
49
|
-
}
|
|
44
|
+
const contents = input.getValue();
|
|
50
45
|
const pos = this.getPos();
|
|
51
46
|
const { tr } = this.view.state;
|
|
52
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
53
|
-
SVGRepresentation })).setSelection(NodeSelection.create(tr.doc, pos));
|
|
47
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { format: 'tex', contents })).setSelection(NodeSelection.create(tr.doc, pos));
|
|
54
48
|
this.view.dispatch(tr);
|
|
55
49
|
}));
|
|
56
50
|
this.props.popper.show(this.dom, input.getWrapperElement(), 'bottom');
|
|
@@ -18,3 +18,4 @@ import { Node, ResolvedPos } from 'prosemirror-model';
|
|
|
18
18
|
export declare const isNodeOfType: (...type: string[]) => (node: Node) => boolean;
|
|
19
19
|
export declare const nearestAncestor: (func: (node: ManuscriptNode) => boolean) => ($pos: ResolvedPos) => number | null;
|
|
20
20
|
export declare const mergeSimilarItems: <T>(compareFunc: (a: T, b: T) => boolean, mergeFunc: (a: T, b: T) => T) => (items: T[]) => T[];
|
|
21
|
+
export declare const renderMath: (math: string, format: string) => Promise<string | null>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
export declare const convertMathMLToSVG: (mathml: string, display?: boolean) => string | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
export declare const packages: string[];
|
|
18
|
+
export declare const convertTeXToSVG: (tex: string, display?: boolean) => string | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/body-editor",
|
|
3
3
|
"description": "Prosemirror components for editing and viewing manuscripts",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.2-LEAN-3092",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@iarna/word-count": "^1.1.2",
|
|
31
31
|
"@manuscripts/assets": "^0.6.4",
|
|
32
|
-
"@manuscripts/json-schema": "
|
|
33
|
-
"@manuscripts/library": "1.3.2",
|
|
34
|
-
"@manuscripts/style-guide": "1.7.4",
|
|
32
|
+
"@manuscripts/json-schema": "2.2.2-LEAN-3094",
|
|
33
|
+
"@manuscripts/library": "1.3.2-LEAN-3092-1",
|
|
34
|
+
"@manuscripts/style-guide": "1.7.4-LEAN-3092-0",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "^1.7.5",
|
|
36
|
-
"@manuscripts/transform": "2.1.1",
|
|
36
|
+
"@manuscripts/transform": "2.1.1-LEAN-3094",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
38
38
|
"axios": "^1.6.7",
|
|
39
|
+
"mathjax-full": "^3.2.2",
|
|
39
40
|
"codemirror": "^5.58.1",
|
|
40
41
|
"dompurify": "^2.4.1",
|
|
41
42
|
"grapheme-splitter": "^1.0.4",
|
|
@@ -109,4 +110,4 @@
|
|
|
109
110
|
"resolutions": {
|
|
110
111
|
"@types/react": "^17.0.2"
|
|
111
112
|
}
|
|
112
|
-
}
|
|
113
|
+
}
|