diff --git a/editors/demo/src/Editoria/layout/EditorElements.js b/editors/demo/src/Editoria/layout/EditorElements.js index 9d9f806464cde92ddd2de8c3c597b0de47023987..c6d44d363c8bf8c02e55a0f60785465b5441e79a 100644 --- a/editors/demo/src/Editoria/layout/EditorElements.js +++ b/editors/demo/src/Editoria/layout/EditorElements.js @@ -382,11 +382,11 @@ export default css` math-display { display: block; - text-align: center; } math-display .math-render { display: block; + text-align: center; } math-display.ProseMirror-selectednode { @@ -405,10 +405,6 @@ export default css` color: #b0b0b0; } - math-display .katex-display { - margin: 0; - } - /* -- Selection Plugin ---------------------------------- */ p::selection, diff --git a/editors/demo/src/HHMI/layout/EditorElements.js b/editors/demo/src/HHMI/layout/EditorElements.js index b98620f64f0644ac890160a31af1e61f6fb3d0a1..4d3b79fc0c922fe76bca10d0c36807d780af3101 100644 --- a/editors/demo/src/HHMI/layout/EditorElements.js +++ b/editors/demo/src/HHMI/layout/EditorElements.js @@ -276,11 +276,11 @@ export default css` math-display { display: block; - text-align: center; } math-display .math-render { display: block; + text-align: center; } math-display.ProseMirror-selectednode { @@ -299,10 +299,6 @@ export default css` color: #b0b0b0; } - math-display .katex-display { - margin: 0; - } - /* -- Selection Plugin ---------------------------------- */ p::selection, diff --git a/wax-prosemirror-plugins/src/math/math-nodeview.js b/wax-prosemirror-plugins/src/math/math-nodeview.js index 62dcdd1c6003c6c2e54e2433c940eb92b22c2937..04dd5c4e85965a6dd1b7a126dd782d293f24b00f 100644 --- a/wax-prosemirror-plugins/src/math/math-nodeview.js +++ b/wax-prosemirror-plugins/src/math/math-nodeview.js @@ -35,67 +35,15 @@ const CSS = [ 'use[data-c]{stroke-width:3px}', ].join(''); -// -// Get the command-line arguments -// -var argv = require('yargs') - .demand(0) - .strict() - .usage('$0 [options] "math" > file.svg') - .options({ - inline: { - boolean: true, - describe: 'process as inline math', - }, - em: { - default: 16, - describe: 'em-size in pixels', - }, - ex: { - default: 8, - describe: 'ex-size in pixels', - }, - width: { - default: 80 * 16, - describe: 'width of container in pixels', - }, - packages: { - default: AllPackages.sort().join(', '), - describe: 'the packages to use, e.g. "base, ams"', - }, - styles: { - boolean: true, - default: true, - describe: 'include css styles for stand-alone image', - }, - container: { - boolean: true, - describe: 'include <mjx-container> element', - }, - css: { - boolean: true, - describe: 'output the required CSS rather than the SVG itself', - }, - fontCache: { - boolean: true, - default: true, - describe: 'whether to use a local font cache or not', - }, - assistiveMml: { - boolean: true, - default: false, - describe: 'whether to include assistive MathML output', - }, - }).argv; - // // Create DOM adaptor and register it for HTML documents // +const packages = AllPackages.sort().join(', '); const adaptor = liteAdaptor(); const handler = RegisterHTMLHandler(adaptor); -if (argv.assistiveMml) AssistiveMmlHandler(handler); -const tex = new TeX({ packages: argv.packages.split(/\s*,\s*/) }); -const svg = new SVG({ fontCache: argv.fontCache ? 'local' : 'none' }); +// if (argv.assistiveMml) AssistiveMmlHandler(handler); +const tex = new TeX({ packages: packages.split(/\s*,\s*/) }); +const svg = new SVG({ fontCache: 'none' }); const html = mathjax.document('', { InputJax: tex, OutputJax: svg }); export class MathView { @@ -248,18 +196,13 @@ export class MathView { this.dom.classList.remove('empty-math'); } - const node = html.convert(argv._[0] || texString, { - display: !argv.inline, - em: argv.em, - ex: argv.ex, - containerWidth: argv.width, + const node = html.convert(texString || '', { + em: 16, + ex: 8, + containerWidth: 700, }); - let output = argv.container - ? adaptor.outerHTML(node) - : adaptor.innerHTML(node); - - this._mathRenderElt.innerHTML = output; + this._mathRenderElt.innerHTML = adaptor.innerHTML(node); } // == Inner Editor ================================== // dispatchInner(tr) {