mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
feature(key) go to parent dir on backspace
This commit is contained in:
parent
fde5695c46
commit
67d03c3b65
2 changed files with 33 additions and 3 deletions
|
|
@ -872,6 +872,20 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
* get current direcotory path
|
||||
*/
|
||||
this.getParentDirPath = function(panel) {
|
||||
var path = DOM.getCurrentDirPath(panel),
|
||||
dirName = DOM.getCurrentDirName() + '/',
|
||||
ret = '/';
|
||||
|
||||
if (path !== '/')
|
||||
ret = Util.removeStr(path, dirName);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* get not current direcotory path
|
||||
*/
|
||||
|
|
@ -1824,6 +1838,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
info.dir = Cmd.getCurrentDirName();
|
||||
info.dirPath = Cmd.getCurrentDirPath();
|
||||
info.parentDirPath = Cmd.getParentDirPath();
|
||||
info.element = current;
|
||||
info.ext = Util.getExtension(name);
|
||||
info.files = files.children,
|
||||
|
|
@ -1836,7 +1851,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
info.name = name;
|
||||
info.path = Cmd.getCurrentPath(current);
|
||||
info.panel = panel;
|
||||
info.panelPassive = panelPassive
|
||||
info.panelPassive = panelPassive;
|
||||
info.size = Cmd.getCurrentSize(current);
|
||||
info.isDir = Cmd.isCurrentIsDir();
|
||||
info.isSelected = Cmd.isSelected(current);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ var CloudCmd, Util, DOM;
|
|||
var Info = DOM.CurrentInfo,
|
||||
Chars = [],
|
||||
KEY = {
|
||||
BACKSPACE : 8,
|
||||
TAB : 9,
|
||||
ENTER : 13,
|
||||
ESC : 27,
|
||||
|
|
@ -162,6 +163,9 @@ var CloudCmd, Util, DOM;
|
|||
var i, n, id,
|
||||
current = Info.element,
|
||||
panel = Info.panel,
|
||||
path = Info.path,
|
||||
dirPath = Info.dirPath,
|
||||
parentDirPath = Info.parentDirPath,
|
||||
filesPassive = Info.filesPassive,
|
||||
prev = current.previousSibling,
|
||||
next = current.nextSibling,
|
||||
|
|
@ -197,8 +201,6 @@ var CloudCmd, Util, DOM;
|
|||
|
||||
case Key.DELETE:
|
||||
if (shift) {
|
||||
var path = Info.path;
|
||||
|
||||
if (Info.isDir)
|
||||
path += '?dir';
|
||||
|
||||
|
|
@ -384,6 +386,19 @@ var CloudCmd, Util, DOM;
|
|||
if (Info.isDir)
|
||||
Util.exec(CloudCmd.loadDir());
|
||||
break;
|
||||
|
||||
case Key.BACKSPACE:
|
||||
path = Info.dirPath;
|
||||
|
||||
if (path !== parentDirPath) {
|
||||
path = parentDirPath;
|
||||
path = CloudFunc.FS + CloudFunc.rmLastSlash(path);
|
||||
|
||||
Util.exec(CloudCmd.loadDir(path));
|
||||
}
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.A:
|
||||
if (pEvent.ctrlKey) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue