steven-tey / novel

Notion-style WYSIWYG editor with AI-powered autocompletion.
https://novel.sh
Apache License 2.0
12.99k stars 1.06k forks source link

bug: initialValue is getting passed as text when using JSONContent #453

Open Satindar31 opened 2 weeks ago

Satindar31 commented 2 weeks ago

Provide environment information

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
    Memory: 996.57 MB / 7.83 GB
  Binaries:
    Node: 20.10.0 - D:\node\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.8.2 - D:\node\npm.CMD
    pnpm: 9.5.0 - ~\AppData\Roaming\npm\pnpm.CMD
    bun: 1.1.6 - ~\.bun\bin\bun.EX

Describe the bug

When passing in initialValue which is of type JSONContent the editor displays it as plain text instead of text with propper highlighting.

Link to reproduction

https://github.com/satindar31/openpages

To reproduce

Feed JSONContent to initialValue (preferably which is being imported from another file or which is being fetched from a DB/server).

Additional information

The editor files in the repro repo are in /components/editor

Satindar31 commented 2 weeks ago

You can also use the site which is available online at https://openpages.us.kg/ to understand the bug. Signup for an account(or use clerks test emails to signup) and then go to https://openpages.us.kg/dashboard/write and write something in the editor. It should save on the second try(write pause, wait for save to fail, write again, it should save, this is a bug). Then view the document on https://openpages.us.kg/dashboard and click the id to see the editor handling the initialContent

Satindar31 commented 1 week ago

@andrewdoro