diff --git a/src/editor/index.ts b/src/editor/index.ts index 86af9b199..dead3c274 100644 --- a/src/editor/index.ts +++ b/src/editor/index.ts @@ -78,7 +78,8 @@ import PageManager from '../pages'; import PanelManager from '../panels'; import ParserModule from '../parser'; import { CustomParserCss } from '../parser/config/config'; -import RichTextEditorModule, { CustomRTE, RichTextEditorEvent } from '../rich_text_editor'; +import RichTextEditorModule, { RichTextEditorEvent } from '../rich_text_editor'; +import { CustomRTE } from '../rich_text_editor/config/config'; import SelectorManager, { SelectorEvent } from '../selector_manager'; import StorageManager, { StorageEvent } from '../storage_manager'; import { ProjectData } from '../storage_manager/model/IStorage'; diff --git a/src/rich_text_editor/config/config.ts b/src/rich_text_editor/config/config.ts index 303b635d0..4e885aad5 100644 --- a/src/rich_text_editor/config/config.ts +++ b/src/rich_text_editor/config/config.ts @@ -1,3 +1,32 @@ +export interface CustomRTE { + /** + * If true, the returned HTML content will be parsed into Components, allowing + * the custom RTE to behave in the same way as the native one. + * If false, the HTML content will be used as it is in the canvas and the export code. + */ + parseContent?: boolean; + /** + * Create or enable the custom RTE. + */ + enable: (el: HTMLElement, rte: T | undefined) => T | Promise; + /** + * Disable the custom RTE. + */ + disable: (el: HTMLElement, rte: T) => any | Promise; + /** + * Get HTML content from the custom RTE. + * If not specified, it will use the innerHTML of the element (passed also as `content` in options). + */ + getContent?: (el: HTMLElement, rte: T | undefined) => string | Promise; + /** + * Destroy the custom RTE. + * Will be triggered on editor destroy. + */ + destroy?: () => void; + + [key: string]: unknown; +} + export interface RichTextEditorConfig { /** * Class name prefix for styles diff --git a/src/rich_text_editor/index.ts b/src/rich_text_editor/index.ts index 8bcb4a43e..e48b5c9f9 100644 --- a/src/rich_text_editor/index.ts +++ b/src/rich_text_editor/index.ts @@ -44,7 +44,7 @@ import ComponentView from '../dom_components/view/ComponentView'; import EditorModel from '../editor/model/Editor'; import { createEl, cx, removeEl } from '../utils/dom'; import { hasWin, isDef, on } from '../utils/mixins'; -import defaults, { RichTextEditorConfig } from './config/config'; +import defaults, { CustomRTE, RichTextEditorConfig } from './config/config'; import RichTextEditor, { RichTextEditorAction } from './model/RichTextEditor'; export type RichTextEditorEvent = 'rte:enable' | 'rte:disable' | 'rte:custom'; @@ -61,35 +61,6 @@ const events = { custom: evCustom, }; -export interface CustomRTE { - /** - * If true, the returned HTML content will be parsed into Components, allowing - * the custom RTE to behave in the same way as the native one. - * If false, the HTML content will be used as it is in the canvas and the export code. - */ - parseContent?: boolean; - /** - * Create or enable the custom RTE. - */ - enable: (el: HTMLElement, rte: T | undefined) => T | Promise; - /** - * Disable the custom RTE. - */ - disable: (el: HTMLElement, rte: T) => any | Promise; - /** - * Get HTML content from the custom RTE. - * If not specified, it will use the innerHTML of the element (passed also as `content` in options). - */ - getContent?: (el: HTMLElement, rte: T | undefined) => string | Promise; - /** - * Destroy the custom RTE. - * Will be triggered on editor destroy. - */ - destroy?: () => void; - - [key: string]: unknown; -} - interface ModelRTE { currentView?: ComponentView; }