@@ -60,23 +60,63 @@ export default class TimeTreePlugin extends Plugin {
60
60
id : "change-status-todo" ,
61
61
name : "Change status to todo" ,
62
62
callback : async ( ) => {
63
- await this . changeStatus ( "todo" ) ;
63
+ await this . updateNoteProperty ( "status" , "todo" ) ;
64
64
} ,
65
65
} ) ;
66
66
67
67
this . addCommand ( {
68
68
id : "change-status-doing" ,
69
69
name : "Change status to doing" ,
70
70
callback : async ( ) => {
71
- await this . changeStatus ( "doing" ) ;
71
+ await this . updateNoteProperty ( "status" , "doing" ) ;
72
72
} ,
73
73
} ) ;
74
74
75
75
this . addCommand ( {
76
76
id : "change-status-done" ,
77
77
name : "Change status to done" ,
78
78
callback : async ( ) => {
79
- await this . changeStatus ( "done" ) ;
79
+ await this . updateNoteProperty ( "status" , "done" ) ;
80
+ } ,
81
+ } ) ;
82
+
83
+ this . addCommand ( {
84
+ id : "change-priority-lowest" ,
85
+ name : "Change priority to Lowest" ,
86
+ callback : async ( ) => {
87
+ await this . updateNoteProperty ( "priority" , "Lowest" ) ;
88
+ } ,
89
+ } ) ;
90
+
91
+ this . addCommand ( {
92
+ id : "change-priority-low" ,
93
+ name : "Change priority to Low" ,
94
+ callback : async ( ) => {
95
+ await this . updateNoteProperty ( "priority" , "Low" ) ;
96
+ } ,
97
+ } ) ;
98
+
99
+ this . addCommand ( {
100
+ id : "change-priority-medium" ,
101
+ name : "Change priority to Medium" ,
102
+ callback : async ( ) => {
103
+ await this . updateNoteProperty ( "priority" , "Medium" ) ;
104
+ } ,
105
+ } ) ;
106
+
107
+ this . addCommand ( {
108
+ id : "change-priority-high" ,
109
+ name : "Change priority to High" ,
110
+ callback : async ( ) => {
111
+ await this . updateNoteProperty ( "priority" , "High" ) ;
112
+ } ,
113
+ } ) ;
114
+
115
+ this . addCommand ( {
116
+ id : "change-priority-highest" ,
117
+ name : "Change priority to Highest" ,
118
+ callback : async ( ) => {
119
+ await this . updateNoteProperty ( "priority" , "Highest" ) ;
80
120
} ,
81
121
} ) ;
82
122
@@ -220,7 +260,7 @@ export default class TimeTreePlugin extends Plugin {
220
260
editor . setCursor ( { line : cursor . line , ch : cursor . ch + 4 } ) ;
221
261
}
222
262
223
- async changeStatus ( status : string ) : Promise < void > {
263
+ async updateNoteProperty ( property : string , value : string ) : Promise < void > {
224
264
const activeFile = this . app . workspace . getActiveFile ( ) ;
225
265
if ( ! activeFile ) {
226
266
new Notice ( "No active file found." ) ;
@@ -229,11 +269,11 @@ export default class TimeTreePlugin extends Plugin {
229
269
await this . frontMatterManager . updateProperty (
230
270
activeFile ,
231
271
( frontmatter ) => {
232
- frontmatter . status = status ;
272
+ frontmatter [ property ] = value ;
233
273
return frontmatter ;
234
274
}
235
275
) ;
236
- new Notice ( `Updated status to ${ status } ` ) ;
276
+ new Notice ( `Updated ${ property } to ${ value } ` ) ;
237
277
}
238
278
239
279
scheduleComputeTimeTree ( ) : void {
0 commit comments