From b15c932d145f10738677b95ba6590c2f1875b585 Mon Sep 17 00:00:00 2001 From: AN1BRA Date: Sat, 13 May 2023 18:10:28 +0100 Subject: [PATCH] expose `renderFromHTML` --- .../@react-editor-js/client/src/client-editor-core.ts | 4 ++++ packages/@react-editor-js/core/src/editor-core.ts | 2 ++ .../@react-editor-js/server/src/server-editor-core.ts | 10 +++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/@react-editor-js/client/src/client-editor-core.ts b/packages/@react-editor-js/client/src/client-editor-core.ts index 9453ec3..2378b48 100644 --- a/packages/@react-editor-js/client/src/client-editor-core.ts +++ b/packages/@react-editor-js/client/src/client-editor-core.ts @@ -41,4 +41,8 @@ export class ClientEditorCore implements EditorCore { public async render(data: OutputData) { await this._editorJS.render(data) } + + public async renderFromHTML(html: string): Promise { + await this._editorJS.blocks.renderFromHTML(html) + } } diff --git a/packages/@react-editor-js/core/src/editor-core.ts b/packages/@react-editor-js/core/src/editor-core.ts index 30456a7..20627be 100644 --- a/packages/@react-editor-js/core/src/editor-core.ts +++ b/packages/@react-editor-js/core/src/editor-core.ts @@ -9,5 +9,7 @@ export interface EditorCore { render(data: OutputData): Promise + renderFromHTML(html: string): Promise + get dangerouslyLowLevelInstance(): any | null } diff --git a/packages/@react-editor-js/server/src/server-editor-core.ts b/packages/@react-editor-js/server/src/server-editor-core.ts index a2243e4..045365c 100644 --- a/packages/@react-editor-js/server/src/server-editor-core.ts +++ b/packages/@react-editor-js/server/src/server-editor-core.ts @@ -14,13 +14,17 @@ export class ServerEditorCore implements EditorCore { return null } - public async clear() {} + public async clear() { } public async save() { return this._memoizedData } - public async destroy() {} + public async destroy() { } - public async render() {} + public async render() { } + + public async renderFromHTML(html: string): Promise { + + } }