10play / 10tap-editor

React Native Rich Text Editor
MIT License
539 stars 23 forks source link

Editor's initialContent support for JSON missing #122

Closed timothysantos closed 2 months ago

timothysantos commented 2 months ago

I noticed that initialContent can't accept JSON when tiptap editor does. I have a simple change that should work and we tested it too. With this change we should be able to use the code below:

const editor = useEditorBridge({
    autofocus: true,
    avoidIosKeyboard: true,
    initialContent: {
      type: "doc",
      content: [
        {
          type: "paragraph",
          content: [
            {
              type: "text",
              text: "Leave a note ",
            },
            {
              type: "text",
              marks: [
                {
                  type: "bold",
                },
              ],
              text: "—text in bold",
            },
          ],
        },
      ],
    },
    // bridgeExtensions: [...TenTapStartKit, CodeBridge.configureCSS(editorCustomCSS)],
    // theme: customTheme,
  })
ororsatti commented 2 months ago

Can you open a PR?

timothysantos commented 2 months ago

PR here: https://github.com/10play/10tap-editor/pull/124