fix(config): Fix loading with no config object

Fixes #96
This commit is contained in:
Tony Narlock 2023-04-05 07:42:03 -05:00
parent 6c194e8ffd
commit c95ecf504d

View File

@ -12,6 +12,20 @@ export default class MathEditing extends Plugin {
return 'MathEditing'; return 'MathEditing';
} }
constructor( editor ) {
super( editor );
editor.config.define( 'math', {
engine: 'mathjax',
outputType: 'script',
className: 'math-tex',
forceOutputType: false,
enablePreview: true,
previewClassName: [],
popupClassName: [],
katexRenderOptions: {}
} );
}
init() { init() {
const editor = this.editor; const editor = this.editor;
editor.commands.add( 'math', new MathCommand( editor ) ); editor.commands.add( 'math', new MathCommand( editor ) );
@ -23,16 +37,6 @@ export default class MathEditing extends Plugin {
'viewToModelPosition', 'viewToModelPosition',
viewToModelPositionOutsideModelElement( editor.model, viewElement => viewElement.hasClass( 'math' ) ) viewToModelPositionOutsideModelElement( editor.model, viewElement => viewElement.hasClass( 'math' ) )
); );
editor.config.define( 'math', {
engine: 'mathjax',
outputType: 'script',
className: 'math-tex',
forceOutputType: false,
enablePreview: true,
previewClassName: [],
popupClassName: [],
katexRenderOptions: {}
} );
} }
_defineSchema() { _defineSchema() {