FIameCaster / prism-code-editor

Lightweight, extensible code editor component for the web using Prism
https://prism-code-editor.netlify.app
MIT License
57 stars 7 forks source link

readonly code folder adding new lines? #25

Closed ysk3a closed 3 months ago

ysk3a commented 3 months ago

I'm not sure if this is just in the demo but i've also noticed an odd behavior in the examples under the example section.

The provided examples were mostly non readonly examples, that is, the examples did not use readonlyeditor() or use the readOnlyCodeFolding option. So I tried to add them to see how it would look like and for some odd reason adding readOnlyCodeFolding add extra new lines at various locations.

forking one of the stackblitz examples, i've added the folding option and theres new lines added? https://stackblitz.com/edit/vitejs-vite-ympxkc?file=src%2Fmain.ts

original: image

after adding readOnlyCodeFolding: image

FIameCaster commented 3 months ago

The readOnlyCodeFolding extension requires styles from prism-code-editor/code-folding.css. I'll usually document it if an extension requires extra styling, but I forgot to do so here. I will fix that.

ysk3a commented 3 months ago

I see. It appears adding import 'prism-code-editor/code-folding.css'; in addition to 'readOnlyCodeFolding` seems to have fixed the new line behavior as you have mentioned. Thanks for the quick response! 👍