feature(package) supermenu v4.0.1

This commit is contained in:
coderaiser 2020-02-19 17:36:30 +02:00
parent a9ba166bd4
commit 88d5071400
4 changed files with 21 additions and 15 deletions

View file

@ -140,6 +140,8 @@ function setMenu(event) {
const element = CloudCmd.Edit.getElement();
Menu = supermenu(element, options, getMenuData());
Menu.addContextMenuListener();
Menu.show(position.x, position.y);
}

View file

@ -203,6 +203,8 @@ function setMenu(event) {
const element = CloudCmd.Edit.getElement();
Menu = supermenu(element, options, menuData);
Menu.addContextMenuListener();
Menu.show(position.x, position.y);
}

View file

@ -41,15 +41,17 @@ module.exports.init = () => {
menuDataFile,
} = getFileMenuData();
const NOT_FILE = true;
const fm = DOM.getFM();
const menuData = getMenuData(isAuth);
const options = getOptions(NOT_FILE);
const optionsFile = getOptions();
const options = getOptions({type: 'context'});
const optionsFile = getOptions({type: 'file'});
MenuContext = supermenu(fm, options, menuData);
MenuContextFile = supermenu(fm, optionsFile, menuDataFile);
MenuContext.addContextMenuListener();
MenuContextFile.addContextMenuListener();
Events.addKey(listener);
};
@ -91,14 +93,14 @@ function getMenuNameByEl(el) {
return 'contextFile';
}
function getOptions(notFile) {
function getOptions({type}) {
let name;
let func;
if (notFile) {
if (type === 'context') {
name = 'context';
func = Key.unsetBind;
} else {
} else if (type === 'file') {
name = 'contextFile';
}
@ -205,21 +207,21 @@ function beforeShow(callback, params) {
});
const menuName = getMenuNameByEl(el);
let notShow = menuName === 'contextFile';
if (params.name === 'contextFile') {
notShow = !notShow;
}
let isShow = menuName !== 'contextFile';
if (!notShow)
if (params.name === 'contextFile')
isShow = !isShow;
if (isShow)
MenuShowedName = name;
exec(callback);
if (!notShow)
notShow = isPath(params.x, params.y);
if (isShow)
isShow = isPath(params.x, params.y);
return notShow;
return isShow;
}
function beforeClick(name) {

View file

@ -212,7 +212,7 @@
"style-loader": "^1.0.0",
"stylelint": "^13.0.0",
"stylelint-config-standard": "^20.0.0",
"supermenu": "^3.0.0",
"supermenu": "^4.0.1",
"supertape": "^1.0.3",
"tar-stream": "^2.0.0",
"unionfs": "^4.0.0",