steven-tey / novel

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

Error after typing any character after '/' #391

Open CodeLine6 opened 4 months ago

CodeLine6 commented 4 months ago

Provide environment information

System: OS: Windows 10 10.0.19045 CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz Memory: 2.74 GB / 11.91 GB Binaries: Node: 20.11.1 - C:\Program Files\nodejs\node.EXE npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD

Describe the bug

I am recieving error after writing any character after '/' in editor. The slash menu appears as it is supoosed to after I invoke with '/' command but as soon as type anything after '/' the app crashed and I recieve error screen noteseasy error

Link to reproduction

https://github.com/missingsemicolononline8/noteeasy/tree/Using_Novel

To reproduce

Install Required Packages For Backend and Client Set up Enviroment variables according to .env.example(s) Start up server and client

You should be able to view Novel.sh editor after logging in to client on homepage. image

Additional information

No response

wannaGetHigh commented 4 months ago

I have the same issue but it could be resolved by wrapping your slash command options with EditorCommandList component.

CodeLine6 commented 4 months ago

I have the same issue but it could be resolved by wrapping your slash command options with EditorCommandList component.

Thank you wannaGetHigh. It is working now. As it tturns out this component is missing from docs and examples.

jamescash commented 4 months ago

Hey @missingsemicolononline8 @wannaGetHigh how did you fix this? I'm having the same problem. I'm using EditorCommandList already.

<EditorCommand className="z-50 h-auto max-h-[330px] overflow-y-auto rounded-md border border-muted bg-background px-1 py-2 shadow-md transition-all">
        <EditorCommandEmpty className="px-2 text-muted-foreground">No results</EditorCommandEmpty>
        <EditorCommandList>
          {suggestionItems.map((item) => (
            <EditorCommandItem
              value={item.title}
              onCommand={(val) => item?.command!(val)}
              className="flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent"
              key={item.title}
            >
              <div className="flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background">
                {item.icon}
              </div>
              <div>
                <p className="font-medium">{item.title}</p>
                <p className="text-xs text-muted-foreground">{item.description}</p>
              </div>
            </EditorCommandItem>
          ))}
        </EditorCommandList>
      </EditorCommand>
jamescash commented 4 months ago

Incase anyone else runs into this. Its something got to do with nextjs server actions. Found a workaround here

const json = JSON.parse(JSON.stringify(editor.getJSON()))