@@ -27,7 +27,7 @@ import { DispatchEvent, codeViewCellContext, kCodeViewNextLineTransaction } from
2727import { Behavior , BehaviorContext , State } from "." ;
2828
2929// track the selection in prosemirror
30- export function trackSelectionBehavior ( context : BehaviorContext ) : Behavior {
30+ export function trackSelectionBehavior ( context : BehaviorContext ) : Behavior {
3131
3232 let unsubscribe : VoidFunction ;
3333
@@ -50,32 +50,32 @@ export function trackSelectionBehavior(context: BehaviorContext) : Behavior {
5050 unsubscribe = context . pmContext . events . subscribe ( DispatchEvent , ( tr : Transaction | undefined ) => {
5151 if ( tr ) {
5252 // track selection changes that occur when we don't have focus
53- if ( ! cmView . hasFocus && tr . selectionSet && ! tr . docChanged && ( tr . selection instanceof TextSelection ) ) {
53+ if ( tr . selectionSet && ! tr . docChanged && ( tr . selection instanceof TextSelection ) ) {
5454 const cmSelection = asCodeMirrorSelection ( context . view , cmView , context . getPos ) ;
5555 context . withState ( State . Updating , ( ) => {
5656 if ( cmSelection ) {
5757 cmView . dispatch ( { selection : cmSelection } ) ;
5858 } else {
59- cmView . dispatch ( { selection : EditorSelection . single ( 0 ) } )
60- }
59+ cmView . dispatch ( { selection : EditorSelection . single ( 0 ) } )
60+ }
6161 } )
6262 } else if ( tr . getMeta ( kCodeViewNextLineTransaction ) === true ) {
6363 // NOTE: this is a special directive to advance to the next line. as distinct
6464 // from the block above it is not a reporting of a change in the PM selection
65- // but rather an instruction to move the CM selection to the next line. as
65+ // but rather an instruction to move the CM selection to the next line. as
6666 // such we do not encose the code in State.Updating, because we want an update
6767 // to the PM selection to occur
6868 const cmSelection = asCodeMirrorSelection ( context . view , cmView , context . getPos ) ;
6969 if ( cmSelection ) {
7070 if ( cursorLineDown ( cmView ) ) {
7171 cursorLineStart ( cmView ) ;
72- }
72+ }
7373 }
74- // for other selection changes
74+ // for other selection changes
7575 } else if ( cmView . hasFocus && tr . selectionSet && ( tr . selection instanceof TextSelection ) ) {
7676 codeViewAssist ( ) ;
7777 }
78- }
78+ }
7979 } ) ;
8080 } ,
8181
@@ -91,7 +91,7 @@ export const asCodeMirrorSelection = (
9191 cmView : EditorView ,
9292 getPos : ( ( ) => number ) | boolean
9393) => {
94- if ( typeof ( getPos ) === "function" ) {
94+ if ( typeof ( getPos ) === "function" ) {
9595 const offset = getPos ( ) + 1 ;
9696 const node = pmView . state . doc . nodeAt ( getPos ( ) ) ;
9797 if ( node ) {
@@ -104,8 +104,8 @@ export const asCodeMirrorSelection = (
104104 } else if ( selection . from <= cmRange . from && selection . to >= cmRange . to ) {
105105 return EditorSelection . single ( 0 , cmView . state . doc . length ) ;
106106 }
107-
107+
108108 }
109109 }
110110 return undefined ;
111- }
111+ }
0 commit comments