mirror of
https://github.com/dartungar/obsidian-mermaid.git
synced 2026-07-22 07:10:23 +00:00
use active-leaf-change event instead of click for tracking active editor
This commit is contained in:
parent
8b8c17d5b8
commit
88d3376a81
2 changed files with 2 additions and 2 deletions
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
Copyright (c) [2023] [Daniel Nikolaev]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
2
main.ts
2
main.ts
|
|
@ -27,7 +27,7 @@ export default class MermaidPlugin extends Plugin {
|
|||
// keep track of last active editor
|
||||
// cannot simply call this.app.workspace.activeEditor ad hoc
|
||||
// because Editor will be null when using Mermaid toolbar view
|
||||
this.registerDomEvent(document, 'click', () => {
|
||||
this.app.workspace.on('active-leaf-change', (leaf) => {
|
||||
this.activeEditor = this.app.workspace.activeEditor?.editor ?? this.activeEditor;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue