File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export class EditorSuggestor extends EditorSuggest<SuggestInfoWithContext> {
7272
7373 // If we can't save the file, we should not allow users to choose dependencies.
7474 // See https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2872
75- const canSaveEdits = markdownFileInfo instanceof MarkdownView ;
75+ const canSaveEdits = this . canSaveEdits ( markdownFileInfo ) ;
7676
7777 const suggestions : SuggestInfo [ ] =
7878 getUserSelectedTaskFormat ( ) . buildSuggestions ?.(
@@ -93,6 +93,10 @@ export class EditorSuggestor extends EditorSuggest<SuggestInfoWithContext> {
9393 return context . editor . cm . state . field ( editorInfoField ) ;
9494 }
9595
96+ private canSaveEdits ( markdownFileInfo : any ) {
97+ return markdownFileInfo instanceof MarkdownView ;
98+ }
99+
96100 renderSuggestion ( value : SuggestInfoWithContext , el : HTMLElement ) {
97101 el . setText ( value . displayText ) ;
98102 }
@@ -183,7 +187,7 @@ file: '${newTask.path}'
183187 // multiple ID fields can be added to individual task lines.
184188
185189 const markdownFileInfo = this . getMarkdownFileInfo ( value . context ) ;
186- if ( markdownFileInfo instanceof MarkdownView ) {
190+ if ( this . canSaveEdits ( markdownFileInfo ) ) {
187191 await markdownFileInfo . save ( ) ;
188192 }
189193 }
You can’t perform that action at this time.
0 commit comments