-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line numbers don't handle auto-wrapping correctly #87
Comments
I temporarily fixed this by disabling word wrap: .prism-editor-wrapper .prism-editor__editor, .prism-editor-wrapper .prism-editor__textarea {
white-space: pre !important;
} |
Thanks for the report @DrMarkEy . For now use @mikecbone solution. But im thinking about making linewrap optinal or disabling when using with linenumbers. 🤔 |
I worked around this by instead using PrismJs' line numbers plugin. If anything, looking at it may help point in the right direction to resolve. to try that way:
Then add the class Then in method called by :highlight
EDIT:almost forgot, you do need to left pad the textarea of course:
|
This works for me until I try to type anything which causes the line numbers disappear. I took a look at Vue-Prism-Editor's code and from my understanding it restyles them whenever the code is updated - I can't seem to replicate this behaviour from a parent component, although I'm not too familiar with Vue so perhaps someone else would have more success |
Selam Mesut, I had this problem as well. .prism-editor__editor {
white-space: pre !important;
}
.prism-editor__container {
overflow-x: scroll !important;
} This makes look visually OK but when I try to write something, text appears somewhere else in the document not at the cursor position 😄 EDIT .prism-editor__textarea {
width: 999999px !important;
}
.prism-editor__editor {
white-space: pre !important;
}
.prism-editor__container {
overflow-x: scroll !important;
} |
Selam Ozan :) |
@koca I'd be super interested in a setting to control word wrapping. Thank you for all your work on this! |
I'd like to bump this - Super important. Lmk if you want help @koca |
hey @lane-c-wagner :) feel free to send a PR 👍 |
I'd be nice to have this props so again, bump. I need this for my project - word wrapping and working line numbers. |
News on this? |
Wondering the same thing. |
When a very long line is wrapped automatically, the wrapped line gets its own line number, which is then missing at the end of the text. Instead I would expect that the wrapped line has no line number, as in most text editors. The error is reproducable in the example at https://prism-editor.netlify.app/
The text was updated successfully, but these errors were encountered: