mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
#81 Make span element className configurable
This commit is contained in:
parent
406aa5cb3a
commit
c7b616a31d
@ -132,6 +132,7 @@ InlineEditor.defaultConfig = {
|
|||||||
engine: 'mathjax', // or katex or function. E.g. (equation, element, display) => { ... }
|
engine: 'mathjax', // or katex or function. E.g. (equation, element, display) => { ... }
|
||||||
lazyLoad: undefined, // async () => { ... }, called once before rendering first equation if engine doesn't exist. After resolving promise, plugin renders equations.
|
lazyLoad: undefined, // async () => { ... }, called once before rendering first equation if engine doesn't exist. After resolving promise, plugin renders equations.
|
||||||
outputType: 'script', // or span
|
outputType: 'script', // or span
|
||||||
|
className: 'math-tex', // class name to use with span output type, change e.g. MathJax processClass (v2) / processHtmlClass (v3) is set
|
||||||
forceOutputType: false, // forces output to use outputType
|
forceOutputType: false, // forces output to use outputType
|
||||||
enablePreview: true, // Enable preview view
|
enablePreview: true, // Enable preview view
|
||||||
previewClassName: [], // Class names to add to previews
|
previewClassName: [], // Class names to add to previews
|
||||||
|
@ -26,6 +26,7 @@ export default class MathEditing extends Plugin {
|
|||||||
editor.config.define( 'math', {
|
editor.config.define( 'math', {
|
||||||
engine: 'mathjax',
|
engine: 'mathjax',
|
||||||
outputType: 'script',
|
outputType: 'script',
|
||||||
|
className: 'math-tex',
|
||||||
forceOutputType: false,
|
forceOutputType: false,
|
||||||
enablePreview: true,
|
enablePreview: true,
|
||||||
previewClassName: [],
|
previewClassName: [],
|
||||||
@ -95,7 +96,7 @@ export default class MathEditing extends Plugin {
|
|||||||
.elementToElement( {
|
.elementToElement( {
|
||||||
view: {
|
view: {
|
||||||
name: 'span',
|
name: 'span',
|
||||||
classes: [ 'math-tex' ]
|
classes: [ mathConfig.className ]
|
||||||
},
|
},
|
||||||
model: ( viewElement, { writer } ) => {
|
model: ( viewElement, { writer } ) => {
|
||||||
const equation = viewElement.getChild( 0 ).data.trim();
|
const equation = viewElement.getChild( 0 ).data.trim();
|
||||||
@ -185,7 +186,7 @@ export default class MathEditing extends Plugin {
|
|||||||
|
|
||||||
if ( type === 'span' ) {
|
if ( type === 'span' ) {
|
||||||
const mathtexView = writer.createContainerElement( 'span', {
|
const mathtexView = writer.createContainerElement( 'span', {
|
||||||
class: 'math-tex'
|
class: mathConfig.className
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( display ) {
|
if ( display ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user