From 5e3bfc37d783d284b85b29d72097aa07cbbac741 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sat, 27 May 2023 12:14:44 +0400 Subject: [PATCH] Don't init default toolbar if custom enabled --- src/rich_text_editor/index.ts | 9 +++++++-- src/rich_text_editor/model/RichTextEditor.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/rich_text_editor/index.ts b/src/rich_text_editor/index.ts index e04f42e4b..f6b18a7b4 100644 --- a/src/rich_text_editor/index.ts +++ b/src/rich_text_editor/index.ts @@ -117,7 +117,6 @@ export default class RichTextEditorModule extends Module this.__trgCustom(), 0); - if (!hasWin()) return this; + } + + onLoad() { + if (!hasWin()) return; + const { config } = this; + const ppfx = config.pStylePrefix; + const isCustom = config.custom; const toolbar = createEl('div', { class: cx(`${ppfx}rte-toolbar`, !isCustom && `${ppfx}one-bg ${ppfx}rte-toolbar-ui`), }); diff --git a/src/rich_text_editor/model/RichTextEditor.ts b/src/rich_text_editor/model/RichTextEditor.ts index f8fefd469..79d2cfd4c 100644 --- a/src/rich_text_editor/model/RichTextEditor.ts +++ b/src/rich_text_editor/model/RichTextEditor.ts @@ -186,7 +186,7 @@ export default class RichTextEditor { isCustom(module?: RichTextEditorModule) { const rte = module || this.em.RichTextEditor; - return !!rte?.config.custom; + return !!(rte?.config.custom || rte?.customRte); } destroy() {}