Fix selection issues in the drive with Chrome

pull/1/head
yflory 8 years ago
parent a6c49cd65c
commit 6a8153aca3

@ -43,6 +43,9 @@ body {
margin-top: 0.5em; margin-top: 0.5em;
} }
} }
div:focus {
outline: none;
}
.fa { .fa {
/*min-width: 17px;*/ /*min-width: 17px;*/
margin-right: 3px; margin-right: 3px;

@ -70,6 +70,10 @@ body {
} }
} }
div:focus {
outline: none;
}
.fa { .fa {
/*min-width: 17px;*/ /*min-width: 17px;*/
margin-right: 3px; margin-right: 3px;

@ -14,7 +14,7 @@
<div class="app-container" tabindex="0"> <div class="app-container" tabindex="0">
<div id="tree"> <div id="tree">
</div> </div>
<div id="content"> <div id="content" tabindex="2">
</div> </div>
<div id="treeContextMenu" class="contextMenu dropdown clearfix"> <div id="treeContextMenu" class="contextMenu dropdown clearfix">
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" style="display:block;position:static;margin-bottom:5px;"> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" style="display:block;position:static;margin-bottom:5px;">

@ -297,6 +297,7 @@ define([
}; };
$content.on('mousedown', function (e) { $content.on('mousedown', function (e) {
if (e.which !== 1) { return; } if (e.which !== 1) { return; }
$content.focus();
sel.down = true; sel.down = true;
if (!e.ctrlKey) { removeSelected(); } if (!e.ctrlKey) { removeSelected(); }
var rect = e.currentTarget.getBoundingClientRect(); var rect = e.currentTarget.getBoundingClientRect();
@ -359,13 +360,15 @@ define([
}; };
$content.mousemove(sel.move); $content.mousemove(sel.move);
}); });
$content.on('mouseup', function (e) { $(ifrw).on('mouseup', function (e) {
if (!sel.down) { return; }
if (e.which !== 1) { return; } if (e.which !== 1) { return; }
sel.down = false; sel.down = false;
sel.$selectBox.hide(); sel.$selectBox.hide();
$content.off('mousemove', sel.move); $content.off('mousemove', sel.move);
delete sel.move; delete sel.move;
$content.find('.selectedTmp').removeClass('selectedTmp').addClass('selected'); $content.find('.selectedTmp').removeClass('selectedTmp').addClass('selected');
e.stopPropagation();
}); });
$(ifrw).keydown(function (e) { $(ifrw).keydown(function (e) {
@ -560,7 +563,7 @@ define([
var filterContextMenu = function ($menu, paths) { var filterContextMenu = function ($menu, paths) {
//var path = $element.data('path'); //var path = $element.data('path');
if (!paths || paths.length === 0) { console.error('no paths'); } if (!paths || paths.length === 0) { logError('no paths'); }
var hide = []; var hide = [];
var hasFolder = false; var hasFolder = false;
@ -2028,16 +2031,19 @@ define([
var search = APP.Search = {}; var search = APP.Search = {};
var createSearch = function ($container) { var createSearch = function ($container) {
var isInSearch = currentPath[0] === SEARCH; var isInSearch = currentPath[0] === SEARCH;
var $div = $('<div>', {'id': 'searchContainer'}); var $div = $('<div>', {'id': 'searchContainer', 'class': 'unselectable'});
var $input = $('<input>', { var $input = $('<input>', {
id: 'searchInput', id: 'searchInput',
type: 'text', type: 'text',
draggable: false,
tabindex: 1,
placeholder: Messages.fm_searchPlaceholder placeholder: Messages.fm_searchPlaceholder
}).keyup(function (e) { }).keyup(function (e) {
if (search.to) { window.clearTimeout(search.to); } if (search.to) { window.clearTimeout(search.to); }
if ([38, 39, 40, 41].indexOf(e.which) !== -1) { if ([38, 39, 40, 41].indexOf(e.which) !== -1) {
if (!$input.val()) { if (!$input.val()) {
$input.blur(); $input.blur();
$content.focus();
return; return;
} else { } else {
e.stopPropagation(); e.stopPropagation();
@ -2163,7 +2169,7 @@ define([
Cryptpad.getFileSize(el, function (e, bytes) { Cryptpad.getFileSize(el, function (e, bytes) {
if (e) { if (e) {
// there was a problem with the RPC // there was a problem with the RPC
console.error(e); logError(e);
// but we don't want to break the interface. // but we don't want to break the interface.
// continue as if there was no RPC // continue as if there was no RPC
@ -2239,7 +2245,7 @@ define([
if (paths.length !== 1) { return; } if (paths.length !== 1) { return; }
var el = filesOp.find(paths[0].path); var el = filesOp.find(paths[0].path);
getProperties(el, function (e, $prop) { getProperties(el, function (e, $prop) {
if (e) { return void console.error(e); } if (e) { return void logError(e); }
Cryptpad.alert('', undefined, true); Cryptpad.alert('', undefined, true);
$('.alertify .msg').html("").append($prop); $('.alertify .msg').html("").append($prop);
}); });
@ -2279,7 +2285,7 @@ define([
if (paths.length !== 1) { return; } if (paths.length !== 1) { return; }
var el = filesOp.find(paths[0].path); var el = filesOp.find(paths[0].path);
getProperties(el, function (e, $prop) { getProperties(el, function (e, $prop) {
if (e) { return void console.error(e); } if (e) { return void logError(e); }
Cryptpad.alert('', undefined, true); Cryptpad.alert('', undefined, true);
$('.alertify .msg').html("").append($prop); $('.alertify .msg').html("").append($prop);
}); });
@ -2369,9 +2375,18 @@ define([
module.hideMenu(); module.hideMenu();
}); });
$appContainer.on('mousedown', function (e) { // Chrome considers the double-click means "select all" in the window
$content.on('mousedown', function (e) {
$content.focus();
e.preventDefault();
});
$appContainer.on('mouseup', function (e) {
if (sel.down) { return; }
if (e.which !== 1) { return ; } if (e.which !== 1) { return ; }
removeSelected(e); removeSelected(e);
});
$appContainer.on('click', function (e) {
if (e.which !== 1) { return ; }
removeInput(); removeInput();
module.hideMenu(e); module.hideMenu(e);
hideNewButton(); hideNewButton();
@ -2676,7 +2691,7 @@ define([
history.onEnterHistory(obj); history.onEnterHistory(obj);
} catch (e) { } catch (e) {
// Probably a parse error // Probably a parse error
console.error(e); logError(e);
} }
}; };
histConfig.onClose = function () { histConfig.onClose = function () {

Loading…
Cancel
Save