@manuscripts/body-editor 1.7.3-LEAN-3092-1 → 1.7.3
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 +3 -2
- package/dist/cjs/lib/helpers.js +1 -44
- package/dist/cjs/views/equation.js +13 -16
- package/dist/cjs/views/equation_editable.js +9 -3
- package/dist/cjs/views/equation_element.js +3 -6
- package/dist/cjs/views/inline_equation.js +13 -16
- package/dist/cjs/views/inline_equation_editable.js +9 -3
- package/dist/es/commands.js +4 -3
- package/dist/es/lib/helpers.js +0 -19
- package/dist/es/views/equation.js +13 -16
- package/dist/es/views/equation_editable.js +9 -3
- package/dist/es/views/equation_element.js +3 -6
- package/dist/es/views/inline_equation.js +13 -16
- package/dist/es/views/inline_equation_editable.js +9 -3
- package/dist/types/lib/helpers.d.ts +0 -1
- package/package.json +5 -6
- package/dist/cjs/lib/mathml-to-svg.js +0 -70
- package/dist/cjs/lib/tex-to-svg.js +0 -60
- package/dist/es/lib/mathml-to-svg.js +0 -66
- package/dist/es/lib/tex-to-svg.js +0 -56
- package/dist/types/lib/mathml-to-svg.d.ts +0 -17
- package/dist/types/lib/tex-to-svg.d.ts +0 -18
package/dist/cjs/commands.js
CHANGED
|
@@ -109,6 +109,7 @@ 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),
|
|
112
113
|
]);
|
|
113
114
|
break;
|
|
114
115
|
default:
|
|
@@ -263,10 +264,10 @@ const insertCrossReference = (state, dispatch) => {
|
|
|
263
264
|
};
|
|
264
265
|
exports.insertCrossReference = insertCrossReference;
|
|
265
266
|
const insertInlineEquation = (state, dispatch) => {
|
|
267
|
+
const inlineMathFragment = (0, transform_1.buildInlineMathFragment)(state.selection.$anchor.parent.attrs.id, selectedText().replace(/^\$/, '').replace(/\$$/, ''));
|
|
266
268
|
const sourcePos = state.selection.from - 1;
|
|
267
269
|
const tr = state.tr.replaceSelectionWith(state.schema.nodes.inline_equation.create({
|
|
268
|
-
|
|
269
|
-
contents: selectedText().replace(/^\$/, '').replace(/\$$/, ''),
|
|
270
|
+
id: inlineMathFragment._id,
|
|
270
271
|
}));
|
|
271
272
|
if (dispatch) {
|
|
272
273
|
const selection = prosemirror_state_1.NodeSelection.create(tr.doc, tr.mapping.map(sourcePos) + 1);
|
package/dist/cjs/lib/helpers.js
CHANGED
|
@@ -14,40 +14,8 @@
|
|
|
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
|
-
};
|
|
49
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.
|
|
18
|
+
exports.mergeSimilarItems = exports.nearestAncestor = exports.isNodeOfType = void 0;
|
|
51
19
|
const isNodeOfType = (...type) => (node) => {
|
|
52
20
|
const [head, ...tail] = type;
|
|
53
21
|
if (node.type === node.type.schema.nodes[head]) {
|
|
@@ -82,14 +50,3 @@ const mergeSimilarItems = (compareFunc, mergeFunc) => (items) => {
|
|
|
82
50
|
}, []);
|
|
83
51
|
};
|
|
84
52
|
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;
|
|
@@ -19,7 +19,6 @@ 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");
|
|
23
22
|
class EquationView extends base_node_view_1.BaseNodeView {
|
|
24
23
|
constructor() {
|
|
25
24
|
super(...arguments);
|
|
@@ -33,24 +32,22 @@ class EquationView extends base_node_view_1.BaseNodeView {
|
|
|
33
32
|
this.dom.setAttribute('id', this.node.attrs.id);
|
|
34
33
|
};
|
|
35
34
|
this.updateContents = () => {
|
|
36
|
-
const {
|
|
35
|
+
const { SVGStringRepresentation } = this.node.attrs;
|
|
37
36
|
while (this.dom.hasChildNodes()) {
|
|
38
37
|
this.dom.removeChild(this.dom.firstChild);
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
});
|
|
39
|
+
if (SVGStringRepresentation) {
|
|
40
|
+
const fragment = (0, dompurify_1.sanitize)(SVGStringRepresentation, {
|
|
41
|
+
USE_PROFILES: { svg: true },
|
|
42
|
+
});
|
|
43
|
+
this.dom.appendChild(fragment);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const placeholder = document.createElement('div');
|
|
47
|
+
placeholder.className = 'equation-placeholder';
|
|
48
|
+
placeholder.textContent = '<Equation>';
|
|
49
|
+
this.dom.appendChild(placeholder);
|
|
50
|
+
}
|
|
54
51
|
};
|
|
55
52
|
this.ignoreMutation = () => true;
|
|
56
53
|
}
|
|
@@ -48,6 +48,7 @@ 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");
|
|
51
52
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
52
53
|
const creators_1 = require("./creators");
|
|
53
54
|
const equation_1 = require("./equation");
|
|
@@ -61,16 +62,21 @@ class EquationEditableView extends equation_1.EquationView {
|
|
|
61
62
|
const { createEditor } = yield Promise.resolve().then(() => __importStar(require('../lib/codemirror')));
|
|
62
63
|
const placeholder = 'Enter LaTeX equation, e.g. "a^2 = \\sqrt{b^2 + c^2}"';
|
|
63
64
|
const input = yield createEditor({
|
|
64
|
-
value: this.node.attrs.
|
|
65
|
+
value: this.node.attrs.TeXRepresentation || '',
|
|
65
66
|
mode: 'stex',
|
|
66
67
|
placeholder,
|
|
67
68
|
autofocus: true,
|
|
68
69
|
});
|
|
69
70
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const
|
|
71
|
+
const TeXRepresentation = input.getValue();
|
|
72
|
+
const SVGStringRepresentation = yield (0, transform_1.convertTeXToSVG)(TeXRepresentation, true);
|
|
73
|
+
if (!SVGStringRepresentation) {
|
|
74
|
+
throw new Error('No SVG output from MathJax');
|
|
75
|
+
}
|
|
71
76
|
const pos = this.getPos();
|
|
72
77
|
const { tr } = this.view.state;
|
|
73
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
78
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { TeXRepresentation,
|
|
79
|
+
SVGStringRepresentation })).setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
74
80
|
this.view.dispatch(tr);
|
|
75
81
|
}));
|
|
76
82
|
const wrapper = document.createElement('div');
|
|
@@ -27,12 +27,9 @@ class EquationElementView extends block_view_1.default {
|
|
|
27
27
|
this.elementType = 'figure';
|
|
28
28
|
this.updateContents = () => {
|
|
29
29
|
var _a;
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
labelEl.textContent = label;
|
|
34
|
-
this.dom.appendChild(labelEl);
|
|
35
|
-
}
|
|
30
|
+
const { suppressCaption, suppressTitle } = this.node.attrs;
|
|
31
|
+
this.dom.classList.toggle('suppress-caption', suppressCaption);
|
|
32
|
+
this.dom.classList.toggle('suppress-title', suppressTitle === undefined ? true : suppressTitle);
|
|
36
33
|
if ((_a = this.node.attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.length) {
|
|
37
34
|
const lastChange = this.node.attrs.dataTracked[this.node.attrs.dataTracked.length - 1];
|
|
38
35
|
this.dom.setAttribute('data-track-status', lastChange.status);
|
|
@@ -17,7 +17,6 @@
|
|
|
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");
|
|
21
20
|
const track_changes_utils_1 = require("../lib/track-changes-utils");
|
|
22
21
|
const base_node_view_1 = require("./base_node_view");
|
|
23
22
|
const creators_1 = require("./creators");
|
|
@@ -30,24 +29,22 @@ class InlineEquationView extends base_node_view_1.BaseNodeView {
|
|
|
30
29
|
};
|
|
31
30
|
this.updateContents = () => {
|
|
32
31
|
if (!(0, track_changes_utils_1.isRejectedInsert)(this.node)) {
|
|
33
|
-
const {
|
|
32
|
+
const { SVGRepresentation } = this.node.attrs;
|
|
34
33
|
while (this.dom.hasChildNodes()) {
|
|
35
34
|
this.dom.removeChild(this.dom.firstChild);
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
});
|
|
36
|
+
if (SVGRepresentation) {
|
|
37
|
+
const fragment = (0, dompurify_1.sanitize)(SVGRepresentation, {
|
|
38
|
+
USE_PROFILES: { svg: true },
|
|
39
|
+
});
|
|
40
|
+
this.dom.appendChild(fragment);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const placeholder = document.createElement('div');
|
|
44
|
+
placeholder.className = 'equation-placeholder';
|
|
45
|
+
placeholder.textContent = '<Equation>';
|
|
46
|
+
this.dom.appendChild(placeholder);
|
|
47
|
+
}
|
|
51
48
|
}
|
|
52
49
|
else {
|
|
53
50
|
this.dom.innerHTML = '';
|
|
@@ -48,6 +48,7 @@ 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");
|
|
51
52
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
52
53
|
const creators_1 = require("./creators");
|
|
53
54
|
const inline_equation_1 = require("./inline_equation");
|
|
@@ -61,16 +62,21 @@ class InlineEquationEditableView extends inline_equation_1.InlineEquationView {
|
|
|
61
62
|
const { createEditor } = yield Promise.resolve().then(() => __importStar(require('../lib/codemirror')));
|
|
62
63
|
const placeholder = 'Enter LaTeX equation, e.g. "E=mc^2"';
|
|
63
64
|
const input = yield createEditor({
|
|
64
|
-
value: this.node.attrs.
|
|
65
|
+
value: this.node.attrs.TeXRepresentation || '',
|
|
65
66
|
mode: 'stex',
|
|
66
67
|
placeholder,
|
|
67
68
|
autofocus: true,
|
|
68
69
|
});
|
|
69
70
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const
|
|
71
|
+
const TeXRepresentation = input.getValue();
|
|
72
|
+
const SVGRepresentation = yield (0, transform_1.convertTeXToSVG)(TeXRepresentation, true);
|
|
73
|
+
if (!SVGRepresentation) {
|
|
74
|
+
throw new Error('No SVG output from MathJax');
|
|
75
|
+
}
|
|
71
76
|
const pos = this.getPos();
|
|
72
77
|
const { tr } = this.view.state;
|
|
73
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
78
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { TeXRepresentation,
|
|
79
|
+
SVGRepresentation })).setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
74
80
|
this.view.dispatch(tr);
|
|
75
81
|
}));
|
|
76
82
|
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, generateID, isElementNodeType, isInBibliographySection, isListNode, isSectionNodeType, schema, } from '@manuscripts/transform';
|
|
18
|
+
import { buildComment, buildInlineMathFragment, 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,6 +101,7 @@ 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),
|
|
104
105
|
]);
|
|
105
106
|
break;
|
|
106
107
|
default:
|
|
@@ -246,10 +247,10 @@ export const insertCrossReference = (state, dispatch) => {
|
|
|
246
247
|
return true;
|
|
247
248
|
};
|
|
248
249
|
export const insertInlineEquation = (state, dispatch) => {
|
|
250
|
+
const inlineMathFragment = buildInlineMathFragment(state.selection.$anchor.parent.attrs.id, selectedText().replace(/^\$/, '').replace(/\$$/, ''));
|
|
249
251
|
const sourcePos = state.selection.from - 1;
|
|
250
252
|
const tr = state.tr.replaceSelectionWith(state.schema.nodes.inline_equation.create({
|
|
251
|
-
|
|
252
|
-
contents: selectedText().replace(/^\$/, '').replace(/\$$/, ''),
|
|
253
|
+
id: inlineMathFragment._id,
|
|
253
254
|
}));
|
|
254
255
|
if (dispatch) {
|
|
255
256
|
const selection = NodeSelection.create(tr.doc, tr.mapping.map(sourcePos) + 1);
|
package/dist/es/lib/helpers.js
CHANGED
|
@@ -13,15 +13,6 @@
|
|
|
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
|
-
};
|
|
25
16
|
export const isNodeOfType = (...type) => (node) => {
|
|
26
17
|
const [head, ...tail] = type;
|
|
27
18
|
if (node.type === node.type.schema.nodes[head]) {
|
|
@@ -53,13 +44,3 @@ export const mergeSimilarItems = (compareFunc, mergeFunc) => (items) => {
|
|
|
53
44
|
];
|
|
54
45
|
}, []);
|
|
55
46
|
};
|
|
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
|
-
});
|
|
@@ -16,7 +16,6 @@
|
|
|
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";
|
|
20
19
|
export class EquationView extends BaseNodeView {
|
|
21
20
|
constructor() {
|
|
22
21
|
super(...arguments);
|
|
@@ -30,24 +29,22 @@ export class EquationView extends BaseNodeView {
|
|
|
30
29
|
this.dom.setAttribute('id', this.node.attrs.id);
|
|
31
30
|
};
|
|
32
31
|
this.updateContents = () => {
|
|
33
|
-
const {
|
|
32
|
+
const { SVGStringRepresentation } = this.node.attrs;
|
|
34
33
|
while (this.dom.hasChildNodes()) {
|
|
35
34
|
this.dom.removeChild(this.dom.firstChild);
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
});
|
|
36
|
+
if (SVGStringRepresentation) {
|
|
37
|
+
const fragment = sanitize(SVGStringRepresentation, {
|
|
38
|
+
USE_PROFILES: { svg: true },
|
|
39
|
+
});
|
|
40
|
+
this.dom.appendChild(fragment);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const placeholder = document.createElement('div');
|
|
44
|
+
placeholder.className = 'equation-placeholder';
|
|
45
|
+
placeholder.textContent = '<Equation>';
|
|
46
|
+
this.dom.appendChild(placeholder);
|
|
47
|
+
}
|
|
51
48
|
};
|
|
52
49
|
this.ignoreMutation = () => true;
|
|
53
50
|
}
|
|
@@ -22,6 +22,7 @@ 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';
|
|
25
26
|
import { NodeSelection } from 'prosemirror-state';
|
|
26
27
|
import { createEditableNodeView } from './creators';
|
|
27
28
|
import { EquationView } from './equation';
|
|
@@ -35,16 +36,21 @@ export class EquationEditableView extends EquationView {
|
|
|
35
36
|
const { createEditor } = yield import('../lib/codemirror');
|
|
36
37
|
const placeholder = 'Enter LaTeX equation, e.g. "a^2 = \\sqrt{b^2 + c^2}"';
|
|
37
38
|
const input = yield createEditor({
|
|
38
|
-
value: this.node.attrs.
|
|
39
|
+
value: this.node.attrs.TeXRepresentation || '',
|
|
39
40
|
mode: 'stex',
|
|
40
41
|
placeholder,
|
|
41
42
|
autofocus: true,
|
|
42
43
|
});
|
|
43
44
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const
|
|
45
|
+
const TeXRepresentation = input.getValue();
|
|
46
|
+
const SVGStringRepresentation = yield convertTeXToSVG(TeXRepresentation, true);
|
|
47
|
+
if (!SVGStringRepresentation) {
|
|
48
|
+
throw new Error('No SVG output from MathJax');
|
|
49
|
+
}
|
|
45
50
|
const pos = this.getPos();
|
|
46
51
|
const { tr } = this.view.state;
|
|
47
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
52
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { TeXRepresentation,
|
|
53
|
+
SVGStringRepresentation })).setSelection(NodeSelection.create(tr.doc, pos));
|
|
48
54
|
this.view.dispatch(tr);
|
|
49
55
|
}));
|
|
50
56
|
const wrapper = document.createElement('div');
|
|
@@ -21,12 +21,9 @@ export class EquationElementView extends BlockView {
|
|
|
21
21
|
this.elementType = 'figure';
|
|
22
22
|
this.updateContents = () => {
|
|
23
23
|
var _a;
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
labelEl.textContent = label;
|
|
28
|
-
this.dom.appendChild(labelEl);
|
|
29
|
-
}
|
|
24
|
+
const { suppressCaption, suppressTitle } = this.node.attrs;
|
|
25
|
+
this.dom.classList.toggle('suppress-caption', suppressCaption);
|
|
26
|
+
this.dom.classList.toggle('suppress-title', suppressTitle === undefined ? true : suppressTitle);
|
|
30
27
|
if ((_a = this.node.attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.length) {
|
|
31
28
|
const lastChange = this.node.attrs.dataTracked[this.node.attrs.dataTracked.length - 1];
|
|
32
29
|
this.dom.setAttribute('data-track-status', lastChange.status);
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { sanitize } from '../lib/dompurify';
|
|
17
|
-
import { renderMath } from '../lib/helpers';
|
|
18
17
|
import { isRejectedInsert } from '../lib/track-changes-utils';
|
|
19
18
|
import { BaseNodeView } from './base_node_view';
|
|
20
19
|
import { createNodeView } from './creators';
|
|
@@ -27,24 +26,22 @@ export class InlineEquationView extends BaseNodeView {
|
|
|
27
26
|
};
|
|
28
27
|
this.updateContents = () => {
|
|
29
28
|
if (!isRejectedInsert(this.node)) {
|
|
30
|
-
const {
|
|
29
|
+
const { SVGRepresentation } = this.node.attrs;
|
|
31
30
|
while (this.dom.hasChildNodes()) {
|
|
32
31
|
this.dom.removeChild(this.dom.firstChild);
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
});
|
|
33
|
+
if (SVGRepresentation) {
|
|
34
|
+
const fragment = sanitize(SVGRepresentation, {
|
|
35
|
+
USE_PROFILES: { svg: true },
|
|
36
|
+
});
|
|
37
|
+
this.dom.appendChild(fragment);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const placeholder = document.createElement('div');
|
|
41
|
+
placeholder.className = 'equation-placeholder';
|
|
42
|
+
placeholder.textContent = '<Equation>';
|
|
43
|
+
this.dom.appendChild(placeholder);
|
|
44
|
+
}
|
|
48
45
|
}
|
|
49
46
|
else {
|
|
50
47
|
this.dom.innerHTML = '';
|
|
@@ -22,6 +22,7 @@ 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';
|
|
25
26
|
import { NodeSelection } from 'prosemirror-state';
|
|
26
27
|
import { createEditableNodeView } from './creators';
|
|
27
28
|
import { InlineEquationView } from './inline_equation';
|
|
@@ -35,16 +36,21 @@ export class InlineEquationEditableView extends InlineEquationView {
|
|
|
35
36
|
const { createEditor } = yield import('../lib/codemirror');
|
|
36
37
|
const placeholder = 'Enter LaTeX equation, e.g. "E=mc^2"';
|
|
37
38
|
const input = yield createEditor({
|
|
38
|
-
value: this.node.attrs.
|
|
39
|
+
value: this.node.attrs.TeXRepresentation || '',
|
|
39
40
|
mode: 'stex',
|
|
40
41
|
placeholder,
|
|
41
42
|
autofocus: true,
|
|
42
43
|
});
|
|
43
44
|
input.on('changes', () => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const
|
|
45
|
+
const TeXRepresentation = input.getValue();
|
|
46
|
+
const SVGRepresentation = yield convertTeXToSVG(TeXRepresentation, true);
|
|
47
|
+
if (!SVGRepresentation) {
|
|
48
|
+
throw new Error('No SVG output from MathJax');
|
|
49
|
+
}
|
|
45
50
|
const pos = this.getPos();
|
|
46
51
|
const { tr } = this.view.state;
|
|
47
|
-
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), {
|
|
52
|
+
tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, this.node.attrs), { TeXRepresentation,
|
|
53
|
+
SVGRepresentation })).setSelection(NodeSelection.create(tr.doc, pos));
|
|
48
54
|
this.view.dispatch(tr);
|
|
49
55
|
}));
|
|
50
56
|
this.props.popper.show(this.dom, input.getWrapperElement(), 'bottom');
|
|
@@ -18,4 +18,3 @@ 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>;
|
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.3
|
|
4
|
+
"version": "1.7.3",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,14 +29,13 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@iarna/word-count": "^1.1.2",
|
|
31
31
|
"@manuscripts/assets": "^0.6.4",
|
|
32
|
-
"@manuscripts/json-schema": "2.2.2
|
|
33
|
-
"@manuscripts/library": "1.3.2
|
|
34
|
-
"@manuscripts/style-guide": "1.7.4
|
|
32
|
+
"@manuscripts/json-schema": "^2.2.2",
|
|
33
|
+
"@manuscripts/library": "1.3.2",
|
|
34
|
+
"@manuscripts/style-guide": "1.7.4",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "^1.7.5",
|
|
36
|
-
"@manuscripts/transform": "2.1.1
|
|
36
|
+
"@manuscripts/transform": "2.1.1",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
38
38
|
"axios": "^1.6.7",
|
|
39
|
-
"mathjax-full": "^3.2.2",
|
|
40
39
|
"codemirror": "^5.58.1",
|
|
41
40
|
"dompurify": "^2.4.1",
|
|
42
41
|
"grapheme-splitter": "^1.0.4",
|
|
@@ -1,70 +0,0 @@
|
|
|
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;
|
|
@@ -1,60 +0,0 @@
|
|
|
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;
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|