double click for actions on sidebar

This commit is contained in:
boyska 2018-12-22 23:37:06 +01:00
parent 7764f1287d
commit 9f06d02e52
2 changed files with 20 additions and 0 deletions

View file

@ -141,6 +141,7 @@ require(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"]
}}));
if (bare_id > 0) {
menu.setAttribute('default_item', 1)
menu.addChild(new dijit.MenuItem({
label: __("Edit feed"),
onClick: function() {

View file

@ -78,6 +78,25 @@ function updateFeedList() {
persist: true,
id: "feedTree",
}, "feedTree");
tree.on('dblclick', function(_, item, evt) {
var tnode = dijit.byNode(item.domNode)
if(tnode._menu === undefined || tnode._menu.attr('default_item') === undefined) {
var element = tnode.domNode
var newevt = new MouseEvent('contextmenu', {
'view': window,
'bubbles': true,
'cancelable': true,
'screenX': evt.screenX,
'screenY': evt.screenY,
'clientX': evt.clientX,
'clientY': evt.clientY,
});
return !element.dispatchEvent(newevt);
} else {
var mi = tnode._menu.getChildren()[tnode._menu.attr('default_item')]
mi.onClick(evt)
}
})
/* var menu = new dijit.Menu({id: 'feedMenu'});