Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "To get the active editor ..." #20

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Conversation

udus122
Copy link
Owner

@udus122 udus122 commented Jun 13, 2024

const activeLeaf = this.app.workspace.getActiveViewOfType(MarkdownView);
To get the active editor use this.app.workspace.activeEditor?.editor, which will mean that this code works in Canvas.

obsidianmd/obsidian-releases#3674 (comment)

  • use app.workspace.activeEditor instead of app.workspace.getActiveViewOfType(MarkdownView)
    • At the same time, change the editor to be passed as an argument to the method.
    • To prevent plugins from running when a note is not open

@udus122 udus122 force-pushed the feature/how-to-get-active-editor branch from 8c5651a to 9228523 Compare June 13, 2024 02:28
@udus122 udus122 force-pushed the feature/how-to-get-active-editor branch from 9228523 to 0feb3fa Compare June 13, 2024 02:29
@udus122 udus122 merged commit 388bec0 into main Jun 13, 2024
@udus122 udus122 deleted the feature/how-to-get-active-editor branch June 13, 2024 02:31
@udus122 udus122 mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant