Skip to content

Commit

Permalink
drawio plugin: change new file icon in rightmenu; for KE, add rightme…
Browse files Browse the repository at this point in the history
…nu on desktop mod; for KB, can create new file on dirs other then desktop on desktop mod, try to fix #12
  • Loading branch information
zhtengw committed Jun 24, 2020
1 parent a035ef9 commit 8ea02b6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
Binary file added kodbox-plugins/drawio/static/images/drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 16 additions & 24 deletions kodbox-plugins/drawio/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,30 @@ kodReady.push(function() {
'newDraw': {
name: "{{LNG['drawio.file.name']}}",
className: "newDraw",
icon: "{{pluginHost}}static/images/icon.png",
icon: "{{pluginHost}}static/images/drawio.png",
callback: function() {
kodApp.pathAction.newFile('drawio');
//kodApp.pathAction.newFile('drawio');
if(typeof(kodApp.root.pathAction)=="undefined"){
kodApp.pathAction.newFile('drawio');
} else {
kodApp.root.pathAction.newFile('drawio');
}
//window.kodApp.root.pathAction.newFile('drawio');
//alert(kodApp.root.pathAction.makeParamItem().name);
}
}
}
// 文件夹空白右键菜单
Events.bind(
'rightMenu.beforeShow@.menu-path-body', function(menu, menuType) {
function menuLoad(menu, menuType) {
if (menu.extendNewDraw) return;
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
menu.extendNewDraw = true;
});
}
// 文件夹空白右键菜单
Events.bind('rightMenu.beforeShow@.menu-path-body', menuLoad);
// 桌面右键菜单
Events.bind(
'rightMenu.beforeShow@.menu-desktop', function(menu, menuType) {
if (menu.extendNewDraw) return;
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
menu.extendNewDraw = true;
});
Events.bind('rightMenu.beforeShow@.menu-desktop', menuLoad);
// 本地路径目录空白右键菜单
Events.bind(
'rightMenu.beforeShow@.menu-path-guest-body', function(menu, menuType) {
if (menu.extendNewDraw) return;
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
menu.extendNewDraw = true;
});
Events.bind('rightMenu.beforeShow@.menu-path-guest-body', menuLoad);
// 工具栏“新建更多”菜单
Events.bind(
'rightMenu.beforeShow@.menu-toolbar-new-file-others', function(menu, menuType) {
if (menu.extendNewDraw) return;
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
menu.extendNewDraw = true;
});
Events.bind('rightMenu.beforeShow@.menu-toolbar-new-file-others', menuLoad);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion kodexplorer-plugins/drawio/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kodReady.push(function() {
'newDraw': {
name: "{{LNG.drawio.file.name}}",
className: "newDraw",
icon: "{{pluginHost}}static/images/icon.png",
icon: "{{pluginHost}}static/images/drawio.png",
callback: function() {
ui.path.newFile('drawio');
}
Expand All @@ -30,4 +30,6 @@ kodReady.push(function() {
$.contextMenu.menuAdd(newDrawMenu, '.menu-body-main', false, 'newfile-docx');
// 工具栏“新建更多”菜单
$.contextMenu.menuAdd(newDrawMenu, ".tool-path-newfile", false, "newfile-docx");
// 桌面模式右键菜单
$.contextMenu.menuAdd(newDrawMenu, ".bodymain", false, "newfile-docx");
});

0 comments on commit 8ea02b6

Please sign in to comment.