@@ -20,7 +20,7 @@ import {
2020 mword_each_do_text_text
2121} from './text_annotations' ;
2222import { keydown_event_do_text_text } from './text_keyboard' ;
23- import { mword_drag_n_drop_select , mword_touch_select } from './text_multiword_selection' ;
23+ import { setupMultiWordSelection , mword_drag_n_drop_select , mword_touch_select } from './text_multiword_selection' ;
2424import { loadModalFrame } from './frame_management' ;
2525import { removeAllTooltips } from '../ui/native_tooltip' ;
2626import {
@@ -45,7 +45,9 @@ export { keydown_event_do_text_text } from './text_keyboard';
4545export {
4646 mwordDragNDrop ,
4747 mword_drag_n_drop_select ,
48- mword_touch_select
48+ mword_touch_select ,
49+ setupMultiWordSelection ,
50+ handleTextSelection
4951} from './text_multiword_selection' ;
5052
5153// Re-export word actions for external use
@@ -413,34 +415,9 @@ export function prepareTextInteractions(): void {
413415
414416 const thetext = document . getElementById ( 'thetext' ) ;
415417 if ( thetext ) {
416- // Prevent text selection on spans
417- thetext . addEventListener ( 'selectstart' , ( e ) => {
418- if ( ( e . target as HTMLElement ) . tagName === 'SPAN' ) {
419- e . preventDefault ( ) ;
420- }
421- } ) ;
422-
423- // Multi-word drag and drop selection (mouse)
424- thetext . addEventListener ( 'mousedown' , ( e ) => {
425- const target = e . target as HTMLElement ;
426- if ( target . classList . contains ( 'wsty' ) ) {
427- // Create a synthetic event object with annotation data
428- const eventWithData = e as MouseEvent & { data ?: { annotation : number } } ;
429- eventWithData . data = { annotation : LWT_DATA . settings . annotations_mode } ;
430- mword_drag_n_drop_select . call ( target , eventWithData ) ;
431- }
432- } ) ;
433-
434- // Multi-word selection for touch devices
435- thetext . addEventListener ( 'touchstart' , ( e ) => {
436- const target = e . target as HTMLElement ;
437- if ( target . classList . contains ( 'wsty' ) ) {
438- // Create a synthetic event object with annotation data
439- const eventWithData = e as TouchEvent & { data ?: { annotation : number } } ;
440- eventWithData . data = { annotation : LWT_DATA . settings . annotations_mode } ;
441- mword_touch_select . call ( target , eventWithData ) ;
442- }
443- } , { passive : true } ) ;
418+ // Multi-word selection via native text selection
419+ // When user selects multiple words, the multi-word modal opens
420+ setupMultiWordSelection ( thetext ) ;
444421
445422 // Multi-word click events (delegated)
446423 thetext . addEventListener ( 'click' , ( e ) => {
0 commit comments