PKM-er / obsidian-editing-toolbar

An obsidian toolbar plugin, modified from the Cmenu plugin
Mozilla Public License 2.0
848 stars 30 forks source link

perf: removed a lot of unused imports, variables and functions, and refactored deprecated code. #158

Closed s4my closed 6 months ago

s4my commented 6 months ago

This commit is pretty much a cleanup of unused imports, variables and functions for perf reasons. And I also in the process refactored the editor instances to get rid of the now obsolete API Workspace.activeLeaf. If I deleted anything I shouldn't of, please do tell.

cumany commented 6 months ago

It's great to see you optimizing the code again. One line like editor = app.workspace.activeLeaf.view?.editor; it using the deprecated activeLeaf is because some editors aren't of the Markdown type, such as the canvas and thino plugins. Especially with the thino plugin, recent updates have been made to ensure compatibility. I recommend downloading and try if it functions properly.

s4my commented 6 months ago

It's great to see you optimizing the code again. One line like editor = app.workspace.activeLeaf.view?.editor; it using the deprecated activeLeaf is because some editors aren't of the Markdown type, such as the canvas and thino plugins. Especially with the thino plugin, recent updates have been made to ensure compatibility. I recommend downloading and try if it functions properly.

I don't know what's the "the thino plugins", I didn't find anything on google? and in canvas, even the current version doesn't work, so I reverted those changes cause fixing that is a separate issue.

cumany commented 6 months ago

plugin url: https://obsidian.md/plugins?search=thino

s4my commented 6 months ago

plugin url: https://obsidian.md/plugins?search=thino

Like I said, you can merge this is commit as is (I reverted the changes to the deprecated version), and we leave that as a separate issue since personally the current version of the toolbar doesn't work in canvas, you should test it yourself.