Skip to content

Commit

Permalink
#81 Make span element className configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielKulbe committed Feb 21, 2023
1 parent 0dbe462 commit a653456
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ InlineEditor.defaultConfig = {
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.
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
enablePreview: true, // Enable preview view
previewClassName: [], // Class names to add to previews
Expand Down
5 changes: 3 additions & 2 deletions src/mathediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default class MathEditing extends Plugin {
editor.config.define( 'math', {
engine: 'mathjax',
outputType: 'script',
className: 'math-tex',
forceOutputType: false,
enablePreview: true,
previewClassName: [],
Expand Down Expand Up @@ -98,7 +99,7 @@ export default class MathEditing extends Plugin {
.elementToElement( {
view: {
name: 'span',
classes: [ 'math-tex' ]
classes: [ mathConfig.className ]
},
model: ( viewElement, { writer } ) => {
const equation = viewElement.getChild( 0 ).data.trim();
Expand Down Expand Up @@ -188,7 +189,7 @@ export default class MathEditing extends Plugin {

if ( type === 'span' ) {
const mathtexView = writer.createContainerElement( 'span', {
class: 'math-tex'
class: mathConfig.className
} );

if ( display ) {
Expand Down

0 comments on commit a653456

Please sign in to comment.