This repository was archived by the owner on Jun 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-20
lines changed Expand file tree Collapse file tree 3 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -247,16 +247,16 @@ export default class FindWidget extends NoteContextAwareWidget {
247247 }
248248
249249 async getHandler ( ) {
250- if ( this . note ?. type === "render" ) {
251- return this . htmlHandler ;
252- }
253-
254- const readOnly = await this . noteContext ?. isReadOnly ( ) ;
255-
256- if ( readOnly ) {
257- return this . htmlHandler ;
258- } else {
259- return this . note ?. type === "code" ? this . codeHandler : this . textHandler ;
250+ switch ( this . note ?. type ) {
251+ case "render" :
252+ return this . htmlHandler ;
253+ case "code" :
254+ return this . codeHandler ;
255+ case "text" :
256+ return this . textHandler ;
257+ default :
258+ const readOnly = await this . noteContext ?. isReadOnly ( ) ;
259+ return readOnly ? this . htmlHandler : this . textHandler ;
260260 }
261261 }
262262
Original file line number Diff line number Diff line change @@ -99,6 +99,16 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
9999 }
100100 }
101101
102+ async executeWithCodeEditorEvent ( { resolve, ntxId } : EventData < "executeWithCodeEditor" > ) {
103+ if ( ! this . isNoteContext ( ntxId ) ) {
104+ return ;
105+ }
106+
107+ await this . initialized ;
108+
109+ resolve ( this . codeEditor ) ;
110+ }
111+
102112 async entitiesReloadedEvent ( { loadResults } : EventData < "entitiesReloaded" > ) {
103113 if ( loadResults . isOptionReloaded ( "codeNoteTheme" ) ) {
104114 const themeId = options . get ( "codeNoteTheme" ) ;
Original file line number Diff line number Diff line change @@ -71,16 +71,6 @@ export default class EditableCodeTypeWidget extends AbstractCodeTypeWidget {
7171 } ;
7272 }
7373
74- async executeWithCodeEditorEvent ( { resolve, ntxId } : EventData < "executeWithCodeEditor" > ) {
75- if ( ! this . isNoteContext ( ntxId ) ) {
76- return ;
77- }
78-
79- await this . initialized ;
80-
81- resolve ( this . codeEditor ) ;
82- }
83-
8474 buildTouchBarCommand ( { TouchBar, buildIcon } : CommandListenerData < "buildTouchBar" > ) {
8575 const items : TouchBarItem [ ] = [ ] ;
8676 const note = this . note ;
You can’t perform that action at this time.
0 commit comments