xdan / jodit

Jodit - Best WYSIWYG Editor for You
https://xdsoft.net/jodit/
MIT License
1.71k stars 354 forks source link

Issue https://github.com/xdan/jodit/issues/597 is back (insert of  when pressing delete / backspace) #1185

Closed DevelopmentDan closed 1 month ago

DevelopmentDan commented 1 month ago

Pressing backspace / delete inserts this character: Â - but you have to be working in whitespace with no other text after it on the line for the issue to happen.

To reproduce:

  1. Use Jodit from the cloudflare CDN in a standard HTML5 doc. This issue only happens in the CDN hosted versions. If I get the files using npm install jodit, then everything works as expected (in min and non min versions of the files). https://cdnjs.cloudflare.com/ajax/libs/jodit/4.2.27/es2021/jodit.min.css https://cdnjs.cloudflare.com/ajax/libs/jodit/4.2.27/es2021/jodit.min.js
  2. Add a load of whitespace, using the spacebar (encoded as string of      in the HTML) to the end of a line.
  3. Try deleting the spaces from the end of the line (this bug goes away if there is text anywhere after the   on the same line).
  4. You will get  inserted into your document instead of the space being deleted.

image

This bug originally reported here https://github.com/xdan/jodit/issues/597 seems to be back in the latest version (Version: v4.2.27) (Chrome Version 129.0.6668.71 (Official Build) (64-bit)) - but oddly, I can't get it to play up on the xdsoft.net website.

Observation: just tested with: const oJodit = Jodit.make('#tbJoditTest', {}); (so no config) - same issue.

Observation: I am running on the CDN, but xdsoft.net is not - it's impossible to compare the JS to see where the programmatic difference lies between the two codebases.

Observation: This is an issue between utf-8 / Latin-1 and    corresponds to the Unicode character NO-BREAK SPACE U+00A0 NO-BREAK SPACE is encoded in UTF-8 as C2 A0 But in Latin-1, C2 A0 decodes to the characterÂ

For some reason Jodit is not cleaning an   properly, but is muddling between UTF8 and Latin1.

image

Jodit Version: 4.2.27

Browser: Chrome Version 129.0.6668.71 (Official Build) (64-bit) OS: Windows 11 Is React App: False Reproduced on xdsoft.net: False (Jodit Editor v.4.2.27)

Expected behavior: To delete the whitespace ( ) characters when pressing backspace / delete

Actual behavior: It inserts an "Â" character.

Config The issue happens with or without config const oJodit = Jodit.make('#joditCtrl');