Skip to content

Commit

Permalink
Enhance plugin browser when opened by URL (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjeby committed Jan 10, 2022
1 parent e394b94 commit 85137ef
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
20 changes: 17 additions & 3 deletions main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "hotkey-helper",
"name": "Hotkey Helper",
"version": "0.3.8",
"minAppVersion": "0.12.3",
"version": "0.3.9",
"minAppVersion": "0.13.19",
"description": "Easily see and access any plugin's settings or hotkey assignments (and conflicts) from the Community Plugins tab",
"author": "PJ Eby",
"authorUrl": "https://github.com/pjeby"
Expand Down
18 changes: 16 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,30 @@ export default class HotkeyHelper extends Plugin {
if (corePlugins) this.register(around(corePlugins, {display: this.addPluginSettingEvents.bind(this, corePlugins.id)}));
if (community) this.register(around(community, {display: this.addPluginSettingEvents.bind(this, community.id)}));

const enhanceViewer = () => this.enhanceViewer();

if (community) this.register(
// Trap opens of the community plugins viewer
// Trap opens of the community plugins viewer from the settings panel
onElement(
community.containerEl, "click",
".mod-cta, .installed-plugins-container .setting-item-info",
() => this.enhanceViewer(),
enhanceViewer,
true
)
);

// Trap opens of the community plugins viewer via URL
this.register(
around(app.workspace.protocolHandlers, {
get(old) {
return function get(key) {
if (key === "show-plugin") enhanceViewer();
return old.call(this, key);
}
}
})
)

// Now force a refresh if either plugins tab is currently visible (to show our new buttons)
function refreshTabIfOpen() {
if (pluginSettingsAreOpen(app)) app.setting.openTabById(app.setting.activeTab.id);
Expand Down
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"0.3.9": "0.13.19",
"0.3.8": "0.12.3",
"0.3.0": "0.12.1",
"0.2.1": "0.11.13",
Expand Down

0 comments on commit 85137ef

Please sign in to comment.