Extracts note command execute validation logic
Refactors active note validation into a dedicated static method for improved readability and reusability Enhances code maintainability by centralizing the check for valid editor and view
This commit is contained in:
1 file changed
+1
-1
@@ -50,7 +50,7 @@ export class NotePromptsCommand {
|
|||||||
editor: Editor,
|
editor: Editor,
|
||||||
view: MarkdownView
|
view: MarkdownView
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (!editor || !view) {
|
if (!NotePromptsCommand.canExecute(editor, view)) {
|
||||||
new Notice('No active note found. Please open a note first.');
|
new Notice('No active note found. Please open a note first.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user