From c95ecf504d7cffe595b26e1e5d8342d6cf0cf968 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 5 Apr 2023 07:42:03 -0500 Subject: [PATCH] fix(config): Fix loading with no config object Fixes #96 --- src/mathediting.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mathediting.js b/src/mathediting.js index 5a4a1973a..31d14f49a 100644 --- a/src/mathediting.js +++ b/src/mathediting.js @@ -12,6 +12,20 @@ export default class MathEditing extends Plugin { 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() { const editor = this.editor; editor.commands.add( 'math', new MathCommand( editor ) ); @@ -23,16 +37,6 @@ export default class MathEditing extends Plugin { 'viewToModelPosition', 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() {