mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 18:17:29 +09:00
[PALEMOON] [DevTools] Added support of the appmenu for DevTools menuitems (follow up)
Issue #96 Issue #102
This commit is contained in:
parent
9eaa4561ac
commit
83b729c6a1
1 changed files with 13 additions and 11 deletions
|
|
@ -160,7 +160,8 @@ function createToolMenuElements(toolDefinition, doc) {
|
||||||
let appmenuitem = createMenuItem({
|
let appmenuitem = createMenuItem({
|
||||||
doc,
|
doc,
|
||||||
id: "appmenuitem_" + id,
|
id: "appmenuitem_" + id,
|
||||||
label: toolDefinition.menuLabel || toolDefinition.label
|
label: toolDefinition.menuLabel || toolDefinition.label,
|
||||||
|
accesskey: null
|
||||||
});
|
});
|
||||||
|
|
||||||
let menuitem = createMenuItem({
|
let menuitem = createMenuItem({
|
||||||
|
|
@ -173,6 +174,7 @@ function createToolMenuElements(toolDefinition, doc) {
|
||||||
// Refer to the key in order to display the key shortcut at menu ends
|
// Refer to the key in order to display the key shortcut at menu ends
|
||||||
menuitem.setAttribute("key", key.id);
|
menuitem.setAttribute("key", key.id);
|
||||||
}
|
}
|
||||||
|
appmenuitem.addEventListener("command", oncommand);
|
||||||
menuitem.addEventListener("command", oncommand);
|
menuitem.addEventListener("command", oncommand);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -202,26 +204,26 @@ function insertToolMenuElements(doc, toolDefinition, prevDef) {
|
||||||
|
|
||||||
let amp;
|
let amp;
|
||||||
if (prevDef) {
|
if (prevDef) {
|
||||||
let menuitem = doc.getElementById("appmenuitem_" + prevDef.id);
|
let appmenuitem = doc.getElementById("appmenuitem_" + prevDef.id);
|
||||||
ref = menuitem && menuitem.nextSibling ? menuitem.nextSibling : null;
|
amp = appmenuitem && appmenuitem.nextSibling ? appmenuitem.nextSibling : null;
|
||||||
} else {
|
} else {
|
||||||
ref = doc.getElementById("appmenu_devtools_separator");
|
amp = doc.getElementById("appmenu_devtools_separator");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ref) {
|
if (amp) {
|
||||||
amp.parentNode.insertBefore(menuitem, ref);
|
amp.parentNode.insertBefore(appmenuitem, amp);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ref;
|
let mp;
|
||||||
if (prevDef) {
|
if (prevDef) {
|
||||||
let menuitem = doc.getElementById("menuitem_" + prevDef.id);
|
let menuitem = doc.getElementById("menuitem_" + prevDef.id);
|
||||||
ref = menuitem && menuitem.nextSibling ? menuitem.nextSibling : null;
|
mp = menuitem && menuitem.nextSibling ? menuitem.nextSibling : null;
|
||||||
} else {
|
} else {
|
||||||
ref = doc.getElementById("menu_devtools_separator");
|
mp = doc.getElementById("menu_devtools_separator");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ref) {
|
if (mp) {
|
||||||
ref.parentNode.insertBefore(menuitem, ref);
|
mp.parentNode.insertBefore(menuitem, mp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.insertToolMenuElements = insertToolMenuElements;
|
exports.insertToolMenuElements = insertToolMenuElements;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue