Commit 03c0a0cd authored by Medicean's avatar Medicean

(EnhanceMent: FileManager) 编辑文件菜单可选择「标签打开」和「窗口打开」

parent a26f3603
......@@ -12,7 +12,7 @@
* 编辑文件窗口将「编码」按钮替换为「用此编码打开」, 若打开文件之后乱码,不妨试试切换编码
* 新增「复制文件名」和「复制文件路径」功能,目标复制文件名或路径到剪贴板
* 修复 windows shell 盘符小写引起目录树错乱的 Bug
* 编辑文件菜单可选择「标签打开」和「窗口打开」
### Other
......@@ -21,6 +21,7 @@
### BugFix
* 修复Linux中编码设置中找到不到路径的问题 (#117) thx @H1d3r
* 修复 Windows shell 盘符小写引起文件管理目录树错乱的 Bug
## 2018/12/25 `(v2.0.3)`
......
......@@ -306,7 +306,11 @@ module.exports = {
}
},
preview: 'Preview',
edit: 'Edit',
edit: {
title: 'Edit',
openwindow: 'Open in Window',
opentab: 'Open in Tab',
},
delete: 'Delete',
rename: 'Rename',
refresh: 'Refresh',
......
......@@ -307,7 +307,11 @@ module.exports = {
}
},
preview: '预览文件',
edit: '编辑文件',
edit: {
title: '编辑文件',
openwindow: '窗口打开',
opentab: '标签打开',
},
delete: '删除文件',
rename: '重命名文件',
refresh: '刷新目录',
......
......@@ -334,9 +334,14 @@ class Files {
manager.previewFile(id, this.getRowAttribute(_ids[0], 'fsize'));
} },
{ divider: true },
{ text: LANG['grid']['contextmenu']['edit'], icon: 'fa fa-edit', disabled: /*!isEdited || */!id || ids.length > 1 || isFolder, action: () => {
manager.editFile(id);
} },
{ text: LANG['grid']['contextmenu']['edit']['title'], icon: 'fa fa-edit', disabled: /*!isEdited || */!id || ids.length > 1 || isFolder, subMenu: [
{ text: LANG['grid']['contextmenu']['edit']['opentab'], icon: 'fa fa-external-link', action: () => {
manager.editFile(id, true);
} },
{ text: LANG['grid']['contextmenu']['edit']['openwindow'], icon: 'fa fa-arrows-alt', action: () => {
manager.editFile(id, false);
} },
] },
{ text: LANG['grid']['contextmenu']['delete'], icon: 'fa fa-trash-o', disabled: !id, action: () => {
manager.deleteFile(ids);
} },
......
......@@ -798,17 +798,28 @@ class FileManager {
}
// 编辑文件
editFile(name) {
editFile(name, openfileintab=false) {
let self = this;
let path = this.path + name;
let editor = null;
let codes = '';
// 创建窗口
let win = this.createWin({
title: LANG['editor']['title'](path),
width: 800
});
win.maximize();
let win;
if (openfileintab == false){
win = this.createWin({
title: LANG['editor']['title'](path),
width: 800
});
win.maximize();
}else{
let _id = String(Math.random()).substr(5, 10);
antSword['tabbar'].addTab(
`tab_file_${_id}`,
`<i class="fa fa-file-o"></i> ${name}`,
null, null, true, true
);
win = antSword['tabbar'].cells(`tab_file_${_id}`);
}
win.progressOn();
// 检测文件后缀
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment