Fix contextmenu disappear on narrow layout

pull/1/head
ClemDee 5 years ago
parent 08c006e682
commit 925b147e6c

@ -43,7 +43,7 @@ define([
{ {
var APP = window.APP = { var APP = window.APP = {
editable: false, editable: false,
mobile: function () { return $('body').width() <= 600; }, // Menu and content area are not inline-block anymore for mobiles mobile: $('body').width() <= 600, // Menu and content area are not inline-block anymore for mobiles
isMac: navigator.platform === "MacIntel", isMac: navigator.platform === "MacIntel",
}; };
@ -1339,7 +1339,14 @@ define([
}); });
}); });
$menu.css({ display: "block" }); $menu.css({ display: "block" });
if (APP.mobile()) { return; } if (APP.mobile) {
$menu.css({
top: ($("#cp-app-drive-toolbar-context-mobile").offset().top + 32) + 'px',
right: '0px',
left: ''
});
return;
}
var h = $menu.outerHeight(); var h = $menu.outerHeight();
var w = $menu.outerWidth(); var w = $menu.outerWidth();
var wH = window.innerHeight; var wH = window.innerHeight;
@ -1945,7 +1952,7 @@ define([
var createTitle = function ($container, path, noStyle) { var createTitle = function ($container, path, noStyle) {
if (!path || path.length === 0) { return; } if (!path || path.length === 0) { return; }
var isTrash = manager.isPathIn(path, [TRASH]); var isTrash = manager.isPathIn(path, [TRASH]);
if (APP.mobile() && !noStyle) { // noStyle means title in search result if (APP.mobile && !noStyle) { // noStyle means title in search result
return $container; return $container;
} }
var isVirtual = virtualCategories.indexOf(path[0]) !== -1; var isVirtual = virtualCategories.indexOf(path[0]) !== -1;
@ -3023,7 +3030,7 @@ define([
APP.resetTree(); APP.resetTree();
if (displayedCategories.indexOf(SEARCH) !== -1 && $tree.find('#cp-app-drive-tree-search-input').length) { if (displayedCategories.indexOf(SEARCH) !== -1 && $tree.find('#cp-app-drive-tree-search-input').length) {
// in history mode we want to focus the version number input // in history mode we want to focus the version number input
if (!history.isHistoryMode && !APP.mobile()) { if (!history.isHistoryMode && !APP.mobile) {
var st = $tree.scrollTop() || 0; var st = $tree.scrollTop() || 0;
$tree.find('#cp-app-drive-tree-search-input').focus(); $tree.find('#cp-app-drive-tree-search-input').focus();
$tree.scrollTop(st); $tree.scrollTop(st);
@ -3066,7 +3073,7 @@ define([
createTitle($toolbar.find('.cp-app-drive-path'), path); createTitle($toolbar.find('.cp-app-drive-path'), path);
if (APP.mobile()) { if (APP.mobile) {
var $context = $('<button>', { var $context = $('<button>', {
id: 'cp-app-drive-toolbar-context-mobile' id: 'cp-app-drive-toolbar-context-mobile'
}); });
@ -3085,11 +3092,6 @@ define([
return; return;
} }
// Open the menu // Open the menu
$('.cp-contextmenu').css({
top: ($context.offset().top + 32) + 'px',
right: '0px',
left: ''
});
$li.contextmenu(); $li.contextmenu();
}); });
} else { } else {
@ -3362,7 +3364,7 @@ define([
} else { } else {
$input.removeClass('cp-app-drive-search-active'); $input.removeClass('cp-app-drive-search-active');
} }
if (APP.mobile()) { return; } if (APP.mobile) { return; }
search.to = window.setTimeout(function () { search.to = window.setTimeout(function () {
if (!isInSearchTmp) { search.oldLocation = currentPath.slice(); } if (!isInSearchTmp) { search.oldLocation = currentPath.slice(); }
var newLocation = [SEARCH, $input.val()]; var newLocation = [SEARCH, $input.val()];

Loading…
Cancel
Save