@@ -487,60 +487,10 @@ export default class TaskProgressBarPlugin extends Plugin {
487487 await this . saveSettings ( ) ;
488488 }
489489
490- // Add a global command for quick capture from anywhere
490+ // Add command for quick capture with metadata
491491 this . addCommand ( {
492- id : "global-quick-capture" ,
493- name : t ( "Quick capture (Global)" ) ,
494- callback : ( ) => {
495- // Get the active leaf if available
496- const activeLeaf =
497- this . app . workspace . getActiveViewOfType ( MarkdownView ) ;
498-
499- if ( activeLeaf && activeLeaf . editor ) {
500- // If we're in a markdown editor, use the editor command
501- const editorView = activeLeaf . editor . cm as EditorView ;
502-
503- // Import necessary functions dynamically to avoid circular dependencies
504-
505- try {
506- // Show the quick capture panel
507- editorView . dispatch ( {
508- effects : toggleQuickCapture . of ( true ) ,
509- } ) ;
510- } catch ( e ) {
511- // No quick capture state found, try to add the extension first
512- // This is a simplified approach and might not work in all cases
513- this . registerEditorExtension ( [
514- quickCaptureExtension ( this . app , this ) ,
515- ] ) ;
516-
517- // Try again after registering the extension
518- setTimeout ( ( ) => {
519- try {
520- editorView . dispatch ( {
521- effects : toggleQuickCapture . of ( true ) ,
522- } ) ;
523- } catch ( e ) {
524- new Notice (
525- t (
526- "Could not open quick capture panel in the current editor"
527- )
528- ) ;
529- }
530- } , 100 ) ;
531- }
532- } else {
533- // No active markdown view, show a floating capture window instead
534- // Create a simple modal with capture functionality
535- new QuickCaptureModal ( this . app , this ) . open ( ) ;
536- }
537- } ,
538- } ) ;
539-
540- // Add command for full-featured task capture
541- this . addCommand ( {
542- id : "full-featured-task-capture" ,
543- name : t ( "Task capture with metadata" ) ,
492+ id : "quick-capture" ,
493+ name : t ( "Quick Capture" ) ,
544494 callback : ( ) => {
545495 // Create a modal with full task metadata options
546496 new QuickCaptureModal ( this . app , this , { } , true ) . open ( ) ;
@@ -888,7 +838,7 @@ export default class TaskProgressBarPlugin extends Plugin {
888838 // Add command for toggling quick capture panel in editor
889839 this . addCommand ( {
890840 id : "toggle-quick-capture" ,
891- name : t ( "Toggle quick capture panel" ) ,
841+ name : t ( "Toggle quick capture panel in editor " ) ,
892842 editorCallback : ( editor ) => {
893843 const editorView = editor . cm as EditorView ;
894844
@@ -910,6 +860,50 @@ export default class TaskProgressBarPlugin extends Plugin {
910860 } ,
911861 } ) ;
912862
863+ this . addCommand ( {
864+ id : "toggle-quick-capture-globally" ,
865+ name : t ( "Toggle quick capture panel in editor (Globally)" ) ,
866+ callback : ( ) => {
867+ const activeLeaf =
868+ this . app . workspace . getActiveViewOfType ( MarkdownView ) ;
869+
870+ if ( activeLeaf && activeLeaf . editor ) {
871+ // If we're in a markdown editor, use the editor command
872+ const editorView = activeLeaf . editor . cm as EditorView ;
873+
874+ // Import necessary functions dynamically to avoid circular dependencies
875+
876+ try {
877+ // Show the quick capture panel
878+ editorView . dispatch ( {
879+ effects : toggleQuickCapture . of ( true ) ,
880+ } ) ;
881+ } catch ( e ) {
882+ // No quick capture state found, try to add the extension first
883+ // This is a simplified approach and might not work in all cases
884+ this . registerEditorExtension ( [
885+ quickCaptureExtension ( this . app , this ) ,
886+ ] ) ;
887+
888+ // Try again after registering the extension
889+ setTimeout ( ( ) => {
890+ try {
891+ editorView . dispatch ( {
892+ effects : toggleQuickCapture . of ( true ) ,
893+ } ) ;
894+ } catch ( e ) {
895+ new Notice (
896+ t (
897+ "Could not open quick capture panel in the current editor"
898+ )
899+ ) ;
900+ }
901+ } , 100 ) ;
902+ }
903+ }
904+ } ,
905+ } ) ;
906+
913907 // Workflow commands
914908 if ( this . settings . workflow . enableWorkflow ) {
915909 this . addCommand ( {
0 commit comments