Skip to content

Commit

Permalink
Adjust doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Dec 24, 2024
1 parent feb0632 commit 05c4cc8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/ckeditor5-bookmark/src/bookmarkui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,12 @@ export default class BookmarkUI extends Plugin {
items: editor.config.get( 'bookmark.toolbar' )!,
getRelatedElement: getSelectedBookmarkWidget,

// Delay the widget toolbar to avoid flickering when the expected selection
// is not the same as that one after enforcing browser to refresh DOM selection.
// It happens quite often when user clicks somewhere at the end of the paragraph *AND*
// the last child of the paragraph is the bookmark element with the caret inside.
// In such scenario, the editor will focus bookmark element, and the `update` event
// will be sent but in meantime, the browser will refresh the selection in short time
// and the widget toolbar will be shown for the paragraph instead of the bookmark.
// Delay the widget toolbar to avoid flickering when the expected selection is not being set on the focused element.
// It happens quite often when user clicks somewhere at the end of the paragraph *AND* and it's last child is the
// bookmark element. In such scenario, the editor will focus bookmark element (and `update` event will be fired).
// and shortly after, the browser will fire the selection change event that selects the start of the paragraph
// instead of the bookmark element (the second `update` event is fired). This delay will give the editor a chance
// to interpret the selection properly and decide if the toolbar should be displayed or not.
// See more: https://github.com/ckeditor/ckeditor5/pull/17690
debounced: true,

Expand Down

0 comments on commit 05c4cc8

Please sign in to comment.