Commit 48da235 1 parent a79442b commit 48da235 Copy full SHA for 48da235
File tree 1 file changed +13
-5
lines changed
editor/components/rich-text
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -467,16 +467,24 @@ export class RichText extends Component {
467
467
468
468
const isReverse = event . keyCode === LEFT ;
469
469
470
+ // Look to previous character for ZWSP if navigating in reverse.
470
471
let offset = focusOffset ;
471
472
if ( isReverse ) {
472
473
offset -- ;
473
474
}
474
475
475
- // [WORKAROUND]: When in a new paragraph in a new inline boundary node,
476
- // while typing the zero-width space occurs as the first child instead
477
- // of at the end of the inline boundary where the caret is. This should
478
- // only be exempt when focusNode is not _only_ the ZWSP, which occurs
479
- // when caret is placed on the right outside edge of inline boundary.
476
+ // Workaround: In a new inline boundary node, the zero-width space
477
+ // wrongly lingers at the beginning of the node, rather than following
478
+ // the caret. If we are at the extent of the inline boundary, but the
479
+ // ZWSP exists at the beginning, consider as though it were to be
480
+ // handled as a transition outside the inline boundary.
481
+ //
482
+ // Since this condition could also be satisfied in the case that we're
483
+ // on the right edge of an inline boundary -- where the ZWSP exists as
484
+ // as an otherwise empty focus node -- ensure that the focus node is
485
+ // non-empty.
486
+ //
487
+ // See: https://github.com/tinymce/tinymce/issues/4472
480
488
if ( ! isReverse && focusOffset === nodeValue . length &&
481
489
nodeValue . length > 1 && nodeValue [ 0 ] === TINYMCE_ZWSP ) {
482
490
offset = 0 ;
You can’t perform that action at this time.
0 commit comments