xdan / jodit

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

Backspacing in the editor with preadded styling or added styling is not retained #1120

Closed pmasekito closed 1 month ago

pmasekito commented 2 months ago

Jodit Version: 4.0.18

Browser: Chrome/Safari OS: Windows/Mac Is React App: true

Code In the jodit editor the html is:

<div><text style="font-size:18pt;color:#000000;font-family:Segoe UI;font-weight:normal;font-style:normal;">Titles</text></div>

When I backspace to just enough to remove "Titles" in order to replace it with text I want, the cursor doesn't stay within the styled element and resets to the beginning of the line.

<div>Replace</div><div><text style="font-size:18pt;color:#000000;font-family:Segoe UI;font-weight:normal;font-style:normal;"></text></div>
// A *self-contained* demonstration of the problem follows...

Expected behavior: if I backspace enough exact amount of chars in the div, and then want to type in new text, it should retain the styling within that div the cursor was at.

Actual behavior: Backspace enough and then type, the styling is gone.

Styled element: Screenshot 2024-04-24 112752

Trying to replace text: Screenshot 2024-04-24 112953

Reproducible on jodit playground