mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-22 23:50:33 +00:00
fix(menu) when click on ".." show full menu
This commit is contained in:
parent
4f1e70a06b
commit
742ec385e1
1 changed files with 26 additions and 3 deletions
|
|
@ -84,6 +84,25 @@ function MenuProto(Position) {
|
|||
return getCurrentPosition();
|
||||
};
|
||||
|
||||
function getMenuNameByEl(el) {
|
||||
if (!el)
|
||||
return 'context';
|
||||
|
||||
const name = DOM.getCurrentName(el);
|
||||
|
||||
if (name === '..')
|
||||
return 'context'
|
||||
|
||||
return 'contextFile'
|
||||
};
|
||||
|
||||
function getMenuByName(name) {
|
||||
if (name === 'context')
|
||||
return MenuContext;
|
||||
|
||||
return MenuContextFile;
|
||||
}
|
||||
|
||||
function show(position) {
|
||||
const {x, y} = getPosition(position);
|
||||
|
||||
|
|
@ -104,8 +123,9 @@ function MenuProto(Position) {
|
|||
MenuContext = new MenuIO(fm, options, menuData);
|
||||
MenuContextFile = new MenuIO(fm, optionsFile, menuDataFile);
|
||||
|
||||
const is = DOM.getCurrentByPosition({x, y});
|
||||
const menu = is ? MenuContextFile : MenuContext;
|
||||
const el = DOM.getCurrentByPosition({x, y});
|
||||
const menuName = getMenuNameByEl(el);
|
||||
const menu = getMenuByName(menuName);
|
||||
|
||||
menu.show(x, y);
|
||||
|
||||
|
|
@ -216,11 +236,14 @@ function MenuProto(Position) {
|
|||
|
||||
function beforeShow(callback, params) {
|
||||
const name = params.name;
|
||||
let notShow = DOM.getCurrentByPosition({
|
||||
let el = DOM.getCurrentByPosition({
|
||||
x: params.x,
|
||||
y: params.y
|
||||
});
|
||||
|
||||
const menuName = getMenuNameByEl(el);
|
||||
let notShow = menuName === 'contextFile';
|
||||
|
||||
if (params.name === 'contextFile') {
|
||||
notShow = !notShow;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue