@@ -73,9 +73,12 @@ export const SelectionHandler = (
7373 const onSelectionChange = debounce ( ( evt : Event ) => {
7474 const sel = document . getSelection ( ) ;
7575
76- // This is to handle cases where the selection is "hijacked" by another element
77- // in a not-annotatable area. A rare case in theory. But rich text editors
78- // will like Quill do it...
76+ /**
77+ * This is to handle cases where the selection is "hijacked"
78+ * by another element in a not-annotatable area.
79+ * A rare case in theory.
80+ * But rich text editors will like Quill do it.
81+ */
7982 if ( isNotAnnotatable ( sel . anchorNode ) ) {
8083 currentTarget = undefined ;
8184 return ;
@@ -130,7 +133,6 @@ export const SelectionHandler = (
130133 const hasChanged =
131134 annotatableRanges . length !== currentTarget . selector . length ||
132135 annotatableRanges . some ( ( r , i ) => r . toString ( ) !== currentTarget . selector [ i ] ?. quote ) ;
133-
134136 if ( ! hasChanged ) return ;
135137
136138 currentTarget = {
@@ -140,8 +142,8 @@ export const SelectionHandler = (
140142 } ;
141143
142144 /**
143- * During mouse selection on the desktop, annotation won't usually exist while the selection is being edited.
144- * But it will be typical during keyboard or mobile handlebars selection!
145+ * During mouse selection on the desktop, the annotation won't usually exist while the selection is being edited.
146+ * But it'll be typical during selection via the keyboard or mobile's handlebars.
145147 */
146148 if ( store . getAnnotation ( currentTarget . annotation ) ) {
147149 store . updateTarget ( currentTarget , Origin . LOCAL ) ;
@@ -152,7 +154,7 @@ export const SelectionHandler = (
152154 } ) ;
153155
154156 /**
155- * Select events don't carry information about the mouse button
157+ * Select events don't carry information about the mouse button.
156158 * Therefore, to prevent right-click selection, we need to listen
157159 * to the initial pointerdown event and remember the button
158160 */
0 commit comments