Add output options

This commit is contained in:
Sauli Anto
2019-09-17 19:39:49 +03:00
parent fe3c7ba393
commit 4bae994b4f
4 changed files with 20 additions and 10 deletions

View File

@@ -54,7 +54,7 @@ export default class MathEditing extends Plugin {
},
model: ( viewElement, modelWriter ) => {
const equation = viewElement.getChild( 0 ).data.trim();
return modelWriter.createElement( 'mathtex', { equation, type: 'script', display: false } );
return modelWriter.createElement( 'mathtex', { equation, type: mathConfig.forceOutputType ? mathConfig.outputType : 'script', display: false } );
}
} )
// MathJax display way (e.g. <script type="math/tex; mode=display">\sqrt{\frac{a}{b}}</script>)
@@ -67,7 +67,7 @@ export default class MathEditing extends Plugin {
},
model: ( viewElement, modelWriter ) => {
const equation = viewElement.getChild( 0 ).data.trim();
return modelWriter.createElement( 'mathtex', { equation, type: 'script', display: true } );
return modelWriter.createElement( 'mathtex', { equation, type: mathConfig.forceOutputType ? mathConfig.outputType : 'script', display: true } );
}
} )
// CKEditor 4 way (e.g. <span class="math-tex">\( \sqrt{\frac{a}{b}} \)</span>)
@@ -86,7 +86,7 @@ export default class MathEditing extends Plugin {
equation = equation.substring( 2, equation.length - 2 ).trim();
}
return modelWriter.createElement( 'mathtex', { equation, type: 'span', display: hasDisplayDelimiters } );
return modelWriter.createElement( 'mathtex', { equation, type: mathConfig.forceOutputType ? mathConfig.outputType : 'span', display: hasDisplayDelimiters } );
}
} );