From 5e1257e630debf241a0001f96b5f1fee7646c7e5 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Fri, 5 Jul 2019 10:19:34 +0200 Subject: [PATCH 01/14] Make contextmenu separators hide for submenus too --- www/drive/inner.js | 91 ++++++++++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 32 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index 510eabbe1..b06d56da2 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -327,34 +327,56 @@ define([ 'tabindex': '-1', 'data-icon': faColor, }, Messages.fc_color)), -// h('li.dropdown-submenu', [ -// h('a.cp-app-drive-context-test.dropdown-item', { -// 'tabindex': '-1', -// 'data-icon': faFolderOpen, -// }, "TEST"), -// h("ul.dropdown-menu", [ -// h('li', h('a.cp-app-drive-context-subtest1.dropdown-item', { -// 'tabindex': '-1', -// 'data-icon': faFolderOpen, -// }, "Sub test 1")), -// h('li.dropdown-submenu', [ -// h('a.cp-app-drive-context-test.dropdown-item', { -// 'tabindex': '-1', -// 'data-icon': faFolderOpen, -// }, "TEST"), -// h("ul.dropdown-menu", [ -// h('li', h('a.cp-app-drive-context-subtest2.dropdown-item', { -// 'tabindex': '-1', -// 'data-icon': faFolderOpen, -// }, "Sub test 2")), -// h('li', h('a.cp-app-drive-context-subtest3.dropdown-item', { -// 'tabindex': '-1', -// 'data-icon': faFolderOpen, -// }, "Sub test 3")), -// ]), -// ]), -// ]), -// ]), + h('li.dropdown-submenu', [ + h('a.cp-app-drive-context-test.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "TEST"), + h("ul.dropdown-menu", [ + h('li', h('a.cp-app-drive-context-subtest1.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "Sub test 1")), + h('li.dropdown-submenu', [ + h('a.cp-app-drive-context-test.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "TEST"), + h("ul.dropdown-menu", [ + h('li', h('a.cp-app-drive-context-subtest2.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "Sub test 2")), + h('li', h('a.cp-app-drive-context-subtest3.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "Sub test 3")), + ]), + ]), + $separator.clone()[0], + h('li', h('a.cp-app-drive-context-subtest4.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "Sub test 4")), + $separator.clone()[0], + h('li.dropdown-submenu', [ + h('a.cp-app-drive-context-test.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "TEST"), + h("ul.dropdown-menu", [ + h('li', h('a.cp-app-drive-context-subtest5.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "Sub test 5")), + h('li', h('a.cp-app-drive-context-subtest6.dropdown-item', { + 'tabindex': '-1', + 'data-icon': faFolderOpen, + }, "Sub test 6")), + ]), + ]), + ]), + ]), h('li', h('a.cp-app-drive-context-download.dropdown-item', { 'tabindex': '-1', 'data-icon': faDownload, @@ -1297,12 +1319,11 @@ define([ updateContextButton(); }; - var displayMenu = function (e) { - var $menu = $contextMenu; + // show / hide dropdown separators + var hideSeparators = function ($menu) { var showSep = false; var $lastVisibleSep = null; - // show / hide drop-down divider - $menu.find(".dropdown-menu").children().each(function (i, el) { + $menu.children().each(function (i, el) { var $el = $(el); if ($el.is(".dropdown-divider")) { $el.css("display", showSep ? "list-item" : "none"); @@ -1314,6 +1335,12 @@ define([ } }); if (!showSep && $lastVisibleSep) { $lastVisibleSep.css("display", "none"); } // remove last divider if no options after + } + var displayMenu = function (e) { + var $menu = $contextMenu; + $menu.find(".dropdown-menu").each(function (i, menu) { + hideSeparators($(menu)); + }); // show / hide submenus $menu.find(".dropdown-submenu").each(function (i, el) { var $el = $(el); From b63354532ceeb8f3f170a23e60eb55c93a2f957c Mon Sep 17 00:00:00 2001 From: ClemDee Date: Fri, 5 Jul 2019 12:30:21 +0200 Subject: [PATCH 02/14] Context submenu now respond to click event --- www/drive/inner.js | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index b06d56da2..de78d6da3 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -328,7 +328,7 @@ define([ 'data-icon': faColor, }, Messages.fc_color)), h('li.dropdown-submenu', [ - h('a.cp-app-drive-context-test.dropdown-item', { + h('a.cp-app-drive-context-test1.dropdown-item', { 'tabindex': '-1', 'data-icon': faFolderOpen, }, "TEST"), @@ -338,7 +338,7 @@ define([ 'data-icon': faFolderOpen, }, "Sub test 1")), h('li.dropdown-submenu', [ - h('a.cp-app-drive-context-test.dropdown-item', { + h('a.cp-app-drive-context-test2.dropdown-item', { 'tabindex': '-1', 'data-icon': faFolderOpen, }, "TEST"), @@ -360,7 +360,7 @@ define([ }, "Sub test 4")), $separator.clone()[0], h('li.dropdown-submenu', [ - h('a.cp-app-drive-context-test.dropdown-item', { + h('a.cp-app-drive-context-test3.dropdown-item', { 'tabindex': '-1', 'data-icon': faFolderOpen, }, "TEST"), @@ -477,17 +477,34 @@ define([ var $el = $(el); var $a = $el.children().filter("a"); var $sub = $el.find(".dropdown-menu").first(); + var showSubmenu = function () { + $sub.toggleClass("left", $el.offset().left + $el.outerWidth() + $sub.outerWidth() > $(window).width()); + $sub.show(); + }; + var hideSubmenu = function () { + $sub.hide(); + $sub.removeClass("left"); + }; // Add submenu expand icon $a.append(h("span.dropdown-toggle")); // Show / hide submenu $el.hover(function () { - setTimeout(function () { // wait for dom to update - $sub.toggleClass("left", $el.offset().left + $el.outerWidth() + $sub.outerWidth() > $(window).width()); - $sub.show(); - }); + showSubmenu(); }, function () { - $sub.hide(); - $sub.removeClass("left"); + hideSubmenu(); + }); + $el.click(function (e) { + e.stopPropagation(); + if ($el.children().filter(".dropdown-menu:visible").length !== 0) { + console.log("leave", $a[0]); + $el.find(".dropdown-menu").hide(); + hideSubmenu(); + } + else { + console.log("enter", $a[0]); + $el.siblings().find(".dropdown-menu").hide(); + showSubmenu(); + } }); }); return $(menu); @@ -1137,7 +1154,7 @@ define([ show = ['newfolder', 'newsharedfolder', 'newdoc']; break; case 'tree': - show = ['open', 'openro', 'expandall', 'collapseall', 'color', 'download', 'share', 'rename', 'delete', 'deleteowned', 'removesf', 'properties', 'hashtag', 'subtest1', 'subtest2', 'subtest3']; + show = ['open', 'openro', 'expandall', 'collapseall', 'color', 'download', 'share', 'rename', 'delete', 'deleteowned', 'removesf', 'properties', 'hashtag', 'subtest1', 'subtest2', 'subtest3', 'subtest4', 'subtest5', 'subtest6']; break; case 'default': show = ['open', 'openro', 'share', 'openparent', 'delete', 'deleteowned', 'properties', 'hashtag']; @@ -1335,7 +1352,7 @@ define([ } }); if (!showSep && $lastVisibleSep) { $lastVisibleSep.css("display", "none"); } // remove last divider if no options after - } + }; var displayMenu = function (e) { var $menu = $contextMenu; $menu.find(".dropdown-menu").each(function (i, menu) { @@ -1454,7 +1471,7 @@ define([ }); cb(); }; - if (paths.some(function (p) { return manager.comparePath(newPath, p) })) { return void cb(); } + if (paths.some(function (p) { return manager.comparePath(newPath, p); })) { return void cb(); } manager.move(paths, newPath, newCb, copy); }; // Delete paths from the drive and/or shared folders (without moving them to the trash) @@ -3423,6 +3440,7 @@ define([ }; APP.hideMenu = function (e) { + console.error("HIDEMENU", e ? e.target : "e is undefined"); $contextMenu.hide(); $trashTreeContextMenu.hide(); $trashContextMenu.hide(); @@ -3525,7 +3543,7 @@ define([ if (paths.length !== 1) { return; } displayRenameInput(paths[0].element, paths[0].path); } - if ($(this).hasClass("cp-app-drive-context-color")) { + else if ($(this).hasClass("cp-app-drive-context-color")) { var currentColor = getFolderColor(paths[0].path); pickFolderColor(paths[0].element, currentColor, function (color) { paths.forEach(function (p) { @@ -3770,6 +3788,7 @@ define([ $appContainer.on('mouseup', function (e) { //if (sel.down) { return; } if (e.which !== 1) { return ; } + if ($(e.target).is(".dropdown-submenu a, .dropdown-submenu a span")) { return; } // if we click on dropdown-submenu, don't close menu APP.hideMenu(e); //removeSelected(e); }); From 3f480635fae0d7cc233a86a2518e360d145af630 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 7 Aug 2019 10:30:21 +0200 Subject: [PATCH 03/14] Fix submenu left position --- customize.dist/src/less2/include/contextmenu.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/contextmenu.less b/customize.dist/src/less2/include/contextmenu.less index f223be85c..b5194a5b7 100644 --- a/customize.dist/src/less2/include/contextmenu.less +++ b/customize.dist/src/less2/include/contextmenu.less @@ -28,7 +28,8 @@ top: -0.7rem; left: 100%; &.left { - left: -10rem; + left: 0%; + transform: translate(-100%); } } } From 7e1425394a5b46affa294d694982752852b863d6 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 7 Aug 2019 10:43:31 +0200 Subject: [PATCH 04/14] Move all create new pad in a submenu of the contextmenu --- www/drive/inner.js | 58 ++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index de78d6da3..d8d9b3a27 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -402,31 +402,39 @@ define([ 'data-icon': faTags, }, Messages.fc_hashtag)), $separator.clone()[0], - h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { - 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.pad, - 'data-type': 'pad' - }, Messages.button_newpad)), - h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { - 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.code, - 'data-type': 'code' - }, Messages.button_newcode)), - h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { - 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.slide, - 'data-type': 'slide' - }, Messages.button_newslide)), - h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { - 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.poll, - 'data-type': 'poll' - }, Messages.button_newpoll)), - h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { - 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.whiteboard, - 'data-type': 'whiteboard' - }, Messages.button_newwhiteboard)), + h('li.dropdown-submenu', [ + h('a.cp-app-drive-context-newdocmenu.dropdown-item', { + 'tabindex': '-1', + 'data-icon': "fa-plus", + }, Messages.fm_newFile), + h("ul.dropdown-menu", [ + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.pad, + 'data-type': 'pad' + }, Messages.button_newpad)), + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.code, + 'data-type': 'code' + }, Messages.button_newcode)), + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.slide, + 'data-type': 'slide' + }, Messages.button_newslide)), + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.poll, + 'data-type': 'poll' + }, Messages.button_newpoll)), + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.whiteboard, + 'data-type': 'whiteboard' + }, Messages.button_newwhiteboard)), + ]), + ]), $separator.clone()[0], h('li', h('a.cp-app-drive-context-empty.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', From 3191b3cbdd8ab13cfd4f805aa0f64294bc83a655 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 7 Aug 2019 12:06:55 +0200 Subject: [PATCH 05/14] Fix remaining context submenu issues --- www/drive/inner.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index d8d9b3a27..3a3a7641e 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -471,6 +471,7 @@ define([ }, Messages.fc_prop)), ]) ]); + // add icons to the contextmenu options $(menu).find("li a.dropdown-item").each(function (i, el) { var $icon = $(""); if ($(el).attr('data-icon')) { @@ -481,6 +482,7 @@ define([ } $(el).prepend($icon); }); + // add events handlers for the contextmenu submenus $(menu).find(".dropdown-submenu").each(function (i, el) { var $el = $(el); var $a = $el.children().filter("a"); @@ -501,15 +503,16 @@ define([ }, function () { hideSubmenu(); }); + // handle click event $el.click(function (e) { - e.stopPropagation(); + var targetItem = $(e.target).closest(".dropdown-item")[0]; // don't close contextmenu if open submenu + var elTarget = $el.children(".dropdown-item")[0]; + if (targetItem === elTarget) { e.stopPropagation(); } if ($el.children().filter(".dropdown-menu:visible").length !== 0) { - console.log("leave", $a[0]); $el.find(".dropdown-menu").hide(); hideSubmenu(); } else { - console.log("enter", $a[0]); $el.siblings().find(".dropdown-menu").hide(); showSubmenu(); } @@ -1361,21 +1364,26 @@ define([ }); if (!showSep && $lastVisibleSep) { $lastVisibleSep.css("display", "none"); } // remove last divider if no options after }; + + // prepare and display contextmenu var displayMenu = function (e) { var $menu = $contextMenu; - $menu.find(".dropdown-menu").each(function (i, menu) { - hideSeparators($(menu)); - }); // show / hide submenus $menu.find(".dropdown-submenu").each(function (i, el) { var $el = $(el); + $el.children(".dropdown-menu").css("display", "none"); $el.find("li").each(function (i, li) { if ($(li).css("display") !== "none") { - $(el).css("display", "block"); + $el.css("display", "block"); return; } }); }); + // show / hide separators + $menu.find(".dropdown-menu").each(function (i, menu) { + hideSeparators($(menu)); + }); + // show contextmenu at cursor position $menu.css({ display: "block" }); if (APP.mobile()) { return; } var h = $menu.outerHeight(); @@ -3448,7 +3456,6 @@ define([ }; APP.hideMenu = function (e) { - console.error("HIDEMENU", e ? e.target : "e is undefined"); $contextMenu.hide(); $trashTreeContextMenu.hide(); $trashContextMenu.hide(); From 38e955e4909e3d6f360e04a054fb7978d35712d7 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 7 Aug 2019 12:14:10 +0200 Subject: [PATCH 06/14] Set timeout before hiding submenu --- www/drive/inner.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index 3a3a7641e..70347154d 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -487,7 +487,9 @@ define([ var $el = $(el); var $a = $el.children().filter("a"); var $sub = $el.find(".dropdown-menu").first(); + var timeoutId; var showSubmenu = function () { + clearTimeout(timeoutId); $sub.toggleClass("left", $el.offset().left + $el.outerWidth() + $sub.outerWidth() > $(window).width()); $sub.show(); }; @@ -495,13 +497,16 @@ define([ $sub.hide(); $sub.removeClass("left"); }; + var mouseOutSubmenu = function () { + timeoutId = setTimeout(hideSubmenu, 100); + } // Add submenu expand icon $a.append(h("span.dropdown-toggle")); // Show / hide submenu $el.hover(function () { showSubmenu(); }, function () { - hideSubmenu(); + mouseOutSubmenu(); }); // handle click event $el.click(function (e) { From a9aadb77e5ae19ca42d10f27bffc687d070f7d01 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 7 Aug 2019 12:25:50 +0200 Subject: [PATCH 07/14] Tweaked submenu dropdown arrow --- customize.dist/src/less2/include/contextmenu.less | 2 ++ 1 file changed, 2 insertions(+) diff --git a/customize.dist/src/less2/include/contextmenu.less b/customize.dist/src/less2/include/contextmenu.less index b5194a5b7..4d81cb9aa 100644 --- a/customize.dist/src/less2/include/contextmenu.less +++ b/customize.dist/src/less2/include/contextmenu.less @@ -22,7 +22,9 @@ } } .dropdown-toggle { + transform: rotate(270deg); margin-left: 10px; + float: right; } .dropdown-menu { top: -0.7rem; From 5e1426bee0ab4f2bd3712f41f75ee4defffce36c Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 7 Aug 2019 12:27:19 +0200 Subject: [PATCH 08/14] Remove test context submenus --- www/drive/inner.js | 52 +--------------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index 70347154d..a6d2d1811 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -327,56 +327,6 @@ define([ 'tabindex': '-1', 'data-icon': faColor, }, Messages.fc_color)), - h('li.dropdown-submenu', [ - h('a.cp-app-drive-context-test1.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "TEST"), - h("ul.dropdown-menu", [ - h('li', h('a.cp-app-drive-context-subtest1.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "Sub test 1")), - h('li.dropdown-submenu', [ - h('a.cp-app-drive-context-test2.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "TEST"), - h("ul.dropdown-menu", [ - h('li', h('a.cp-app-drive-context-subtest2.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "Sub test 2")), - h('li', h('a.cp-app-drive-context-subtest3.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "Sub test 3")), - ]), - ]), - $separator.clone()[0], - h('li', h('a.cp-app-drive-context-subtest4.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "Sub test 4")), - $separator.clone()[0], - h('li.dropdown-submenu', [ - h('a.cp-app-drive-context-test3.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "TEST"), - h("ul.dropdown-menu", [ - h('li', h('a.cp-app-drive-context-subtest5.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "Sub test 5")), - h('li', h('a.cp-app-drive-context-subtest6.dropdown-item', { - 'tabindex': '-1', - 'data-icon': faFolderOpen, - }, "Sub test 6")), - ]), - ]), - ]), - ]), h('li', h('a.cp-app-drive-context-download.dropdown-item', { 'tabindex': '-1', 'data-icon': faDownload, @@ -1170,7 +1120,7 @@ define([ show = ['newfolder', 'newsharedfolder', 'newdoc']; break; case 'tree': - show = ['open', 'openro', 'expandall', 'collapseall', 'color', 'download', 'share', 'rename', 'delete', 'deleteowned', 'removesf', 'properties', 'hashtag', 'subtest1', 'subtest2', 'subtest3', 'subtest4', 'subtest5', 'subtest6']; + show = ['open', 'openro', 'expandall', 'collapseall', 'color', 'download', 'share', 'rename', 'delete', 'deleteowned', 'removesf', 'properties', 'hashtag']; break; case 'default': show = ['open', 'openro', 'share', 'openparent', 'delete', 'deleteowned', 'properties', 'hashtag']; From 06f224bdfeae8ca9522862f50c0fef703253764d Mon Sep 17 00:00:00 2001 From: ClemDee Date: Fri, 9 Aug 2019 15:20:17 +0200 Subject: [PATCH 09/14] Remove infinite function call recursion in whiteboard --- www/whiteboard/inner.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index 18a66a635..18a99b7de 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -254,12 +254,6 @@ define([ updateLocalPalette(palette); - metadataMgr.onChange(function () { - var md = metadataMgr.getMetadata(); - if (md.palette) { - updateLocalPalette(md.palette); - } - }); return { palette: palette, From b481b99441e0c0118c8759168bc97bee06cf510e Mon Sep 17 00:00:00 2001 From: ClemDee Date: Mon, 12 Aug 2019 11:44:04 +0200 Subject: [PATCH 10/14] Fix infinite function call recursion in whiteboard --- www/whiteboard/inner.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index 18a99b7de..e744a22a3 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -254,6 +254,12 @@ define([ updateLocalPalette(palette); + metadataMgr.onChange(function () { + var md = metadataMgr.getMetadata(); + if (md.palette) { + updatePalette(md.palette); + } + }); return { palette: palette, From 9586695c7501d7dbbdde780d8751c96cc7cc3e0a Mon Sep 17 00:00:00 2001 From: ClemDee Date: Mon, 12 Aug 2019 15:22:15 +0200 Subject: [PATCH 11/14] Reorganize / add pads in contextmenu --- www/drive/inner.js | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index f252acc36..fa90cd2e9 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -382,37 +382,47 @@ define([ 'data-icon': faTags, }, Messages.fc_hashtag)), $separator.clone()[0], + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.pad, + 'data-type': 'pad' + }, Messages.button_newpad)), + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.code, + 'data-type': 'code' + }, Messages.button_newcode)), + h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { + 'tabindex': '-1', + 'data-icon': AppConfig.applicationsIcon.slide, + 'data-type': 'slide' + }, Messages.button_newslide)), h('li.dropdown-submenu', [ h('a.cp-app-drive-context-newdocmenu.dropdown-item', { 'tabindex': '-1', 'data-icon': "fa-plus", - }, Messages.fm_newFile), + }, Messages.fm_otherPads || "Other pads"), //XXX h("ul.dropdown-menu", [ h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.pad, - 'data-type': 'pad' - }, Messages.button_newpad)), + 'data-icon': AppConfig.applicationsIcon.sheet, + 'data-type': 'sheet' + }, Messages.button_newsheet)), h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.code, - 'data-type': 'code' - }, Messages.button_newcode)), + 'data-icon': AppConfig.applicationsIcon.whiteboard, + 'data-type': 'whiteboard' + }, Messages.button_newwhiteboard)), h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.slide, - 'data-type': 'slide' - }, Messages.button_newslide)), + 'data-icon': AppConfig.applicationsIcon.kanban, + 'data-type': 'kanban' + }, Messages.button_newkanban)), h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', 'data-icon': AppConfig.applicationsIcon.poll, 'data-type': 'poll' }, Messages.button_newpoll)), - h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { - 'tabindex': '-1', - 'data-icon': AppConfig.applicationsIcon.whiteboard, - 'data-type': 'whiteboard' - }, Messages.button_newwhiteboard)), ]), ]), $separator.clone()[0], From 1b05fb982c032ca22745c3a35c0b54600d977a5a Mon Sep 17 00:00:00 2001 From: ClemDee Date: Mon, 12 Aug 2019 15:26:07 +0200 Subject: [PATCH 12/14] Ensure there are not two context submenus opened at the same time --- www/drive/inner.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index fa90cd2e9..d8885413d 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -481,6 +481,7 @@ define([ var showSubmenu = function () { clearTimeout(timeoutId); $sub.toggleClass("left", $el.offset().left + $el.outerWidth() + $sub.outerWidth() > $(window).width()); + $el.siblings().find(".dropdown-menu").hide(); $sub.show(); }; var hideSubmenu = function () { @@ -488,6 +489,7 @@ define([ $sub.removeClass("left"); }; var mouseOutSubmenu = function () { + // don't hide immediately the submenu timeoutId = setTimeout(hideSubmenu, 100); } // Add submenu expand icon @@ -508,7 +510,6 @@ define([ hideSubmenu(); } else { - $el.siblings().find(".dropdown-menu").hide(); showSubmenu(); } }); From 4351ece25612474ffc01bf4129ef54d3889d3bd9 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Mon, 12 Aug 2019 15:29:13 +0200 Subject: [PATCH 13/14] Change 'Other pads' title to 'More Pads' in contextmenu --- www/drive/inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index d8885413d..e8b4fd2c9 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -401,7 +401,7 @@ define([ h('a.cp-app-drive-context-newdocmenu.dropdown-item', { 'tabindex': '-1', 'data-icon': "fa-plus", - }, Messages.fm_otherPads || "Other pads"), //XXX + }, Messages.fm_morePads || "More pads"), //XXX h("ul.dropdown-menu", [ h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', From 6548ec346cca86ab7ca281d4cf49dec8f0a492e7 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Mon, 12 Aug 2019 15:31:21 +0200 Subject: [PATCH 14/14] Add missing semicolon --- www/drive/inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index e8b4fd2c9..c7c48668a 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -491,7 +491,7 @@ define([ var mouseOutSubmenu = function () { // don't hide immediately the submenu timeoutId = setTimeout(hideSubmenu, 100); - } + }; // Add submenu expand icon $a.append(h("span.dropdown-toggle")); // Show / hide submenu