Skip to content

Commit 44da5fa

Browse files
committed
feat: add jsonToHtmlAsync for async customElementTypes support
Add toRedactorAsync (exported as jsonToHtmlAsync) that supports customElementTypes handlers returning string | Promise<string>. Enables dynamic component resolution (e.g. await import()) before serialization. Children are resolved via Promise.all concurrently. Refactors shared logic (text processing, attr building, element node processing) into toRedactorHelpers.ts so both sync and async versions are thin recursive shells with no duplicated code. The existing sync jsonToHtml behavior is unchanged. New types: IJsonToHtmlAsyncElementTags, IJsonToHtmlAsyncOptions.
1 parent 945d23c commit 44da5fa

6 files changed

Lines changed: 747 additions & 402 deletions

File tree

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "array-flat-polyfill"
22
import { fromRedactor } from "./fromRedactor"
33
import { toRedactor } from "./toRedactor"
4+
import { toRedactorAsync } from "./toRedactorAsync"
45
import {jsonToMarkdownSerializer} from './jsonToMarkdown'
56
export * from "./types"
6-
export { fromRedactor as htmlToJson, toRedactor as jsonToHtml, jsonToMarkdownSerializer as jsonToMarkdown }
7+
export { fromRedactor as htmlToJson, toRedactor as jsonToHtml, toRedactorAsync as jsonToHtmlAsync, jsonToMarkdownSerializer as jsonToMarkdown }

0 commit comments

Comments
 (0)