File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export default class UI extends Module<UINodes> {
5050 /**
5151 * The actual cached selection.
5252 */
53- private prevSelection : any = null ;
53+ private prevSelection : string | null = null ;
5454
5555 /**
5656 * Editor.js UI CSS class names
@@ -806,10 +806,10 @@ export default class UI extends Module<UINodes> {
806806 private selectionChanged ( ) : void {
807807 const { CrossBlockSelection, BlockSelection } = this . Editor ;
808808 const focusedElement = Selection . anchorElement ;
809- const currentSelection = window . getSelection ( ) ;
809+ const currentSelection = window . getSelection ( ) ?. toString ( ) ?? null ;
810810
811- const sameSelection = currentSelection == this . prevSelection && currentSelection ;
812- const sameFocus = this . prevSelectionAnchorElement == focusedElement && focusedElement ;
811+ const sameSelection = ( currentSelection == this . prevSelection ) && ! ! currentSelection ;
812+ const sameFocus = ( focusedElement == this . prevSelectionAnchorElement ) && ! ! focusedElement ;
813813
814814 if ( sameSelection && sameFocus ) {
815815 return ;
You can’t perform that action at this time.
0 commit comments