From f9333cf869297aa0876fafb743a00bad56ffc55d Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Wed, 4 Nov 2020 12:19:40 +0200 Subject: [PATCH] fix multiple config instances --- wax-prosemirror-core/src/Application.js | 2 +- wax-prosemirror-core/src/Wax.js | 7 +++---- wax-prosemirror-core/src/config/defaultConfig.js | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/wax-prosemirror-core/src/Application.js b/wax-prosemirror-core/src/Application.js index 40916f3a4..02ed53193 100644 --- a/wax-prosemirror-core/src/Application.js +++ b/wax-prosemirror-core/src/Application.js @@ -66,7 +66,7 @@ export default class Application { static create(config) { /* Merge Core Config with User Config */ - const appConfig = deepmerge({ config: defaultConfig }, config, { + const appConfig = deepmerge({ config: defaultConfig() }, config, { customMerge: key => { if (key === 'services') { return (coreService, configService) => { diff --git a/wax-prosemirror-core/src/Wax.js b/wax-prosemirror-core/src/Wax.js index ccff04147..fb2a468a4 100644 --- a/wax-prosemirror-core/src/Wax.js +++ b/wax-prosemirror-core/src/Wax.js @@ -31,10 +31,9 @@ const serializer = schema => { }; }; -let schema; const createApplication = props => { const application = Application.create(props); - schema = application.getSchema(); + application.getSchema(); application.bootServices(); return application; }; @@ -68,7 +67,7 @@ const Wax = props => { } = props; if (!application) return null; - + const { schema } = application.schema; const WaxOnchange = onChange ? onChange : value => true; const editorContent = value || ''; @@ -88,7 +87,7 @@ const Wax = props => { const finalOnChange = debounce( value => { - /*HACK alter toDOM of footnote, because of how PM treats inline nodes + /* HACK alter toDOM of footnote, because of how PM treats inline nodes with content */ if (schema.nodes.footnote) { const old = schema.nodes.footnote.spec.toDOM; diff --git a/wax-prosemirror-core/src/config/defaultConfig.js b/wax-prosemirror-core/src/config/defaultConfig.js index c7f9a3726..662a9b2de 100644 --- a/wax-prosemirror-core/src/config/defaultConfig.js +++ b/wax-prosemirror-core/src/config/defaultConfig.js @@ -7,7 +7,7 @@ import { OverlayService, } from 'wax-prosemirror-services'; -export default { +export default () => ({ services: [ new SchemaService(), new RulesService(), @@ -16,4 +16,4 @@ export default { new MenuService(), new OverlayService(), ], -}; +}); -- GitLab