Skip to content

Commit

Permalink
Merge pull request #124 from timothysantos/fix-initialcontent-json-su…
Browse files Browse the repository at this point in the history
…pport

initialContent JSON value support
  • Loading branch information
17Amir17 authored Jun 9, 2024
2 parents 9f6b441 + 97eb2c9 commit 879e9dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/RichText/useEditorBridge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type RecursivePartial<T> = {

export const useEditorBridge = (options?: {
bridgeExtensions?: BridgeExtension<any, any, any>[];
initialContent?: string;
initialContent?: string | object;
autofocus?: boolean;
avoidIosKeyboard?: boolean;
customSource?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/RichText/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const getInjectedJSBeforeContentLoad = (editor: EditorBridge) => {
: ''
}${
editor.initialContent
? `window.initialContent = '${editor.initialContent}';`
? `window.initialContent = ${JSON.stringify(editor.initialContent)};`
: ''
}
window.editable = ${editor.editable};
Expand Down
2 changes: 1 addition & 1 deletion website/docs/api/useEditorBridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A list of BridgeExtensions that will be added to the editor on the native side

#### initialContent

`string`
`string | json`
<u>default</u>: `undefined`<br />
initial content that will be loaded first on the editor

Expand Down

0 comments on commit 879e9dd

Please sign in to comment.