Skip to content

Commit 8ea02b6

Browse files
committed
drawio plugin: change new file icon in rightmenu; for KE, add rightmenu on desktop mod; for KB, can create new file on dirs other then desktop on desktop mod, try to fix #12
1 parent a035ef9 commit 8ea02b6

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed
20.1 KB
Loading

kodbox-plugins/drawio/static/main.js

+16-24
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,30 @@ kodReady.push(function() {
2222
'newDraw': {
2323
name: "{{LNG['drawio.file.name']}}",
2424
className: "newDraw",
25-
icon: "{{pluginHost}}static/images/icon.png",
25+
icon: "{{pluginHost}}static/images/drawio.png",
2626
callback: function() {
27-
kodApp.pathAction.newFile('drawio');
27+
//kodApp.pathAction.newFile('drawio');
28+
if(typeof(kodApp.root.pathAction)=="undefined"){
29+
kodApp.pathAction.newFile('drawio');
30+
} else {
31+
kodApp.root.pathAction.newFile('drawio');
32+
}
33+
//window.kodApp.root.pathAction.newFile('drawio');
34+
//alert(kodApp.root.pathAction.makeParamItem().name);
2835
}
2936
}
3037
}
31-
// 文件夹空白右键菜单
32-
Events.bind(
33-
'rightMenu.beforeShow@.menu-path-body', function(menu, menuType) {
38+
function menuLoad(menu, menuType) {
3439
if (menu.extendNewDraw) return;
3540
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
3641
menu.extendNewDraw = true;
37-
});
42+
}
43+
// 文件夹空白右键菜单
44+
Events.bind('rightMenu.beforeShow@.menu-path-body', menuLoad);
3845
// 桌面右键菜单
39-
Events.bind(
40-
'rightMenu.beforeShow@.menu-desktop', function(menu, menuType) {
41-
if (menu.extendNewDraw) return;
42-
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
43-
menu.extendNewDraw = true;
44-
});
46+
Events.bind('rightMenu.beforeShow@.menu-desktop', menuLoad);
4547
// 本地路径目录空白右键菜单
46-
Events.bind(
47-
'rightMenu.beforeShow@.menu-path-guest-body', function(menu, menuType) {
48-
if (menu.extendNewDraw) return;
49-
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
50-
menu.extendNewDraw = true;
51-
});
48+
Events.bind('rightMenu.beforeShow@.menu-path-guest-body', menuLoad);
5249
// 工具栏“新建更多”菜单
53-
Events.bind(
54-
'rightMenu.beforeShow@.menu-toolbar-new-file-others', function(menu, menuType) {
55-
if (menu.extendNewDraw) return;
56-
$.contextMenu.menuAdd(newDrawMenu, menu, false, '.new-file-docx');
57-
menu.extendNewDraw = true;
58-
});
50+
Events.bind('rightMenu.beforeShow@.menu-toolbar-new-file-others', menuLoad);
5951
});
Loading

kodexplorer-plugins/drawio/static/main.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ kodReady.push(function() {
2020
'newDraw': {
2121
name: "{{LNG.drawio.file.name}}",
2222
className: "newDraw",
23-
icon: "{{pluginHost}}static/images/icon.png",
23+
icon: "{{pluginHost}}static/images/drawio.png",
2424
callback: function() {
2525
ui.path.newFile('drawio');
2626
}
@@ -30,4 +30,6 @@ kodReady.push(function() {
3030
$.contextMenu.menuAdd(newDrawMenu, '.menu-body-main', false, 'newfile-docx');
3131
// 工具栏“新建更多”菜单
3232
$.contextMenu.menuAdd(newDrawMenu, ".tool-path-newfile", false, "newfile-docx");
33+
// 桌面模式右键菜单
34+
$.contextMenu.menuAdd(newDrawMenu, ".bodymain", false, "newfile-docx");
3335
});

0 commit comments

Comments
 (0)