File tree Expand file tree Collapse file tree
frontend/app/view/webview Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ export class WebViewModel implements ViewModel {
7474 partitionOverride : PrimitiveAtom < string > | null ;
7575 userAgentType : Atom < string > ;
7676 env : WebViewEnv ;
77+ ctrlShiftUnsubFn : ( ( ) => void ) | null = null ;
7778
7879 constructor ( { blockId, nodeModel, tabModel, waveEnv } : ViewModelInitType ) {
7980 this . nodeModel = nodeModel ;
@@ -508,18 +509,21 @@ export class WebViewModel implements ViewModel {
508509 return true ;
509510 }
510511 const ctrlShiftState = globalStore . get ( getSimpleControlShiftAtom ( ) ) ;
511- if ( ctrlShiftState ) {
512+ if ( ctrlShiftState && ! this . ctrlShiftUnsubFn ) {
512513 // this is really weird, we don't get keyup events from webview
513- const unsubFn = globalStore . sub ( getSimpleControlShiftAtom ( ) , ( ) => {
514+ this . ctrlShiftUnsubFn = globalStore . sub ( getSimpleControlShiftAtom ( ) , ( ) => {
514515 const state = globalStore . get ( getSimpleControlShiftAtom ( ) ) ;
515516 if ( ! state ) {
516- unsubFn ( ) ;
517+ this . ctrlShiftUnsubFn ?.( ) ;
518+ this . ctrlShiftUnsubFn = null ;
517519 const isStillFocused = globalStore . get ( this . nodeModel . isFocused ) ;
518520 if ( isStillFocused ) {
519521 this . webviewRef . current ?. focus ( ) ;
520522 }
521523 }
522524 } ) ;
525+ }
526+ if ( ctrlShiftState ) {
523527 return false ;
524528 }
525529 this . webviewRef . current ?. focus ( ) ;
You can’t perform that action at this time.
0 commit comments