Replies: 1 comment
|
Thank you for your support. I will consider migrating this issue. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi @hunghg255,
Author of Prism code editor here. Thank you for using my library!
I have seen that you decided to make a fork instead. Based on this commit, your reason for forking was the usage of browser APIs in module scope, which breaks SSR in React. This was already fixed in development 8 months earlier, but wasn't in a stable release yet. I'm therefore suggesting to migrate to Prism code editor for the
CodeBlockextension, so that users of your library can use newer versions of Prism code editor. This is obviously a breaking change, but I'd appreciate it if you planned it for v2.0.0.Migration steps
Migrating to Prism code editor v5 should be easy despite two major releases. The first thing you need to change is some CSS variables in the code block styles. Refer to the migration guide for which variables to change. Lastly, the
indentGuides()extension now requires extra styling fromprism-code-editor/guides.css.Current issues
I have identified a few issues with how you're using the library that I'd recommend fixing:
prism-code-editor/languages. This means automatic indentation and comment toggling won't work. Refer to this guide for how<Select>) due to the<NodeViewCodeBlock>component inheritingcontentEditable. AddingcontentEditable={false}to the compoenent should fix this:not(.image-view, .search-result, textarea)::selectionxml,jsx,graphql,scss,ruby, and many more are not in thelanguageslist making them inaccessible in the code block```followed by an invalid language and pressing enter makes the language<Select>empty in the new code blockAn alternative
An alternative to Prism code editor would be
prism-react-editor, which is a rewrite made to be easier to use with React, which should make yourCodeBlockextension easier to maintain. In addition, the<IndentGuides />extension doesn't require any extra CSS.Feel free to ask if you have any questions about the migration.
All reactions