-
Notifications
You must be signed in to change notification settings - Fork 1
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 returns being stripped while typing #3
Comments
@jackmparker thanks for reporting this. What web browser do you use? I tried it on Firefox and wasn't able to reproduce it. Trying Chrome next. |
@jackmparker I was able to repoduce it With Chrome. I'll look for a solution |
@jackmparker please try v6.1.3 and make sure that you are using codejar ^4.2.0. Codejar 4.1.2 had an issue that produced the bug you have described. |
Versions used when I encountered the bug: codejar: ^4.2.0, And yes, you figured it out, but I'm using Chrome version 122.0.6261.112 I'll try v6.1.3. Thanks! |
@jackmparker are you sure you were using codejar 4.2.0 when facing this bug? I updated CodeJar to 4.2.0 and that solved this issue for me |
Yes, I'm positive. I haven't touched the I just updated to v6.1.3 and am still encountering the issue in a brand new Angular project. |
"brand new Angular project" means Angular 17, am I right? Do you use SSR? |
I created the Angular app yesterday just to test this out so I thought it was the latest but it appears it's still verison 16:
|
@jackmparker I was able to reproduce this issue with Angular 17. I assume that it's an issue with Angular >= 16 (version of this repository is 15). I'll look for a solution tomorrow (~ 12 hours) |
Ok, no problem, this isn't urgent. I reported this primarily so you were aware. Take your time if needed. |
@jackmparker updgrading the library to Angular 16 (see v7.0.0) didn't work either. I was able to find the source of the problem: In the highlightingMethod we use a code like this: highlightMethod(editor: CodeJarContainer) {
if (editor.textContent !== null && editor.textContent !== undefined) {
editor.innerHTML = hljs.highlight(editor.textContent, {
language: 'typescript',
}).value;
}
} The problem is here that somehow Using "editor.innerText" distracts the cursor position. Do you know a solution? More strangely this error doesn't appear on the CodeJar demo page even it's using the same code using |
finally found the error: It's because I'm using |
@jackmparker fixed in version 7.0.2 and 6.1.4. Please use 7.0.2 for Angular 15. Thank you for reporting this issue! |
I've confirmed on my end that the fix is working – glad you were able to find a fix! Sorry it took a few hours for such a small thing but that's how it goes, right? Thanks again! |
This issue occurs on the demo page (https://julianpoemp.github.io/ngx-codejar/) as well as when implemented. Version information wasn't provided as it doesn't seem to matter. Steps to reproduce:
Expected result: Line breaks, tabs, etc., should all stay exactly as typed.
This doesn't happen using CodeJar itself, only when using this wrapper. Thanks!
The text was updated successfully, but these errors were encountered: