|
|
|
@ -64,7 +64,7 @@ export class VerticalIcons extends Plugin { |
|
|
|
|
* Add an icon to the map |
|
|
|
|
* @param {ModuleProfile} profile The profile of the module |
|
|
|
|
*/ |
|
|
|
|
addIcon ({ kind, name, icon, displayName, tooltip }) { |
|
|
|
|
addIcon ({ kind, name, icon, displayName, tooltip, documentation }) { |
|
|
|
|
let title = (tooltip || displayName || name) |
|
|
|
|
title = title.replace(/^\w/, c => c.toUpperCase()) |
|
|
|
|
this.icons[name] = yo` |
|
|
|
@ -73,7 +73,7 @@ export class VerticalIcons extends Plugin { |
|
|
|
|
onclick="${() => { this.toggle(name) }}" |
|
|
|
|
plugin="${name}" |
|
|
|
|
title="${title}" |
|
|
|
|
oncontextmenu="${(e) => this.itemContextMenu(e, name)}" |
|
|
|
|
oncontextmenu="${(e) => this.itemContextMenu(e, name, documentation)}" |
|
|
|
|
data-id="verticalIconsKind${name}"> |
|
|
|
|
<img class="image" src="${icon}" alt="${name}" /> |
|
|
|
|
</div>` |
|
|
|
@ -223,13 +223,24 @@ export class VerticalIcons extends Plugin { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
itemContextMenu (e, name) { |
|
|
|
|
console.log(name) |
|
|
|
|
VERTICALMENU_HANDLE && VERTICALMENU_HANDLE.hide(null, true) |
|
|
|
|
async itemContextMenu (e, name, documentation) { |
|
|
|
|
const actions = {} |
|
|
|
|
actions['Deactivate'] = () => { this.call('manager', 'deactivatePlugin', name) } |
|
|
|
|
VERTICALMENU_HANDLE = contextMenu(e, actions) |
|
|
|
|
if (await this.appManager.canDeactivatePlugin(profile, { name })) { |
|
|
|
|
actions.Deactivate = () => { |
|
|
|
|
// this.call('manager', 'deactivatePlugin', name)
|
|
|
|
|
this.appManager.deactivatePlugin(name) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const links = {} |
|
|
|
|
if (documentation) { |
|
|
|
|
links.Documentation = documentation |
|
|
|
|
} |
|
|
|
|
if (Object.keys(actions).length || Object.keys(links).length) { |
|
|
|
|
VERTICALMENU_HANDLE && VERTICALMENU_HANDLE.hide(null, true) |
|
|
|
|
VERTICALMENU_HANDLE = contextMenu(e, actions, links) |
|
|
|
|
} |
|
|
|
|
e.preventDefault() |
|
|
|
|
e.stopPropagation() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
|