Hello! Thank you very much for providing such excellent code!
Problems:
First, add code block highlight for markdown, then assign a long text to DOC of editor, as shown in the picture, and then I modify the content of one code block, for example, change HTML to JavaScript, the console will display a red error message, and the subsequent operations will not be operated, such as deletion, writing, etc! Please check my GIF pictures for details
There is another situation. For example, in my project, I save the text in the current editor as a draft every five seconds. For example, I’m typing javasc. But the input is not complete, and then save the draft, refresh the page, the page will cause an error, and then the next operation is not executable. Please see the GIF pictures I recorded for details.
Here is a simple example I wrote, which may be helpful for your debugging。
The escape character is added here to prevent the parsing exception of the current article. Therefore, when using it, you need to delete the escape character
<textarea>
\`\`\`html
<div></div>
\`\`\`
\`\`\`html
<div></div>
\`\`\`
<!--Look here. I made a mistake here on purpose-->
\`\`\`javasc
<div></div>
\`\`\`
\`\`\`html
<div></div>
\`\`\`
\`\`\`html
<div></div>
\`\`\`
</textarea>
import theme from './theme'; // theme.js is the style file defined for highlighting
EditorState.create({
doc: document.querySelector("textarea").value,
extensions: [
theme(),
markdown({
base: markdownLanguage,
codeLanguages: languages
}),
]
})
Thank you very much for any help!