|
|
@ -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) {
|
|
|
@ -520,6 +523,10 @@ define([
|
|
|
|
placeholder: name,
|
|
|
|
placeholder: name,
|
|
|
|
value: name
|
|
|
|
value: name
|
|
|
|
}).data('path', path);
|
|
|
|
}).data('path', path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stop propagation on keydown to avoid issues with arrow keys
|
|
|
|
|
|
|
|
$input.on('keydown', function (e) { e.stopPropagation(); });
|
|
|
|
|
|
|
|
|
|
|
|
$input.on('keyup', function (e) {
|
|
|
|
$input.on('keyup', function (e) {
|
|
|
|
if (e.which === 13) {
|
|
|
|
if (e.which === 13) {
|
|
|
|
removeInput(true);
|
|
|
|
removeInput(true);
|
|
|
@ -560,7 +567,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;
|
|
|
@ -763,6 +770,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var displayMenu = function (e, $menu) {
|
|
|
|
var displayMenu = function (e, $menu) {
|
|
|
|
$menu.css({ display: "block" });
|
|
|
|
$menu.css({ display: "block" });
|
|
|
|
|
|
|
|
if (APP.mobile()) { 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;
|
|
|
@ -1785,7 +1793,7 @@ define([
|
|
|
|
module.resetTree();
|
|
|
|
module.resetTree();
|
|
|
|
|
|
|
|
|
|
|
|
// 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) { $tree.find('#searchInput').focus(); }
|
|
|
|
if (!history.isHistoryMode && !APP.mobile()) { $tree.find('#searchInput').focus(); }
|
|
|
|
$tree.find('#searchInput')[0].selectionStart = getSearchCursor();
|
|
|
|
$tree.find('#searchInput')[0].selectionStart = getSearchCursor();
|
|
|
|
$tree.find('#searchInput')[0].selectionEnd = getSearchCursor();
|
|
|
|
$tree.find('#searchInput')[0].selectionEnd = getSearchCursor();
|
|
|
|
|
|
|
|
|
|
|
@ -2028,16 +2036,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();
|
|
|
@ -2056,6 +2067,7 @@ define([
|
|
|
|
if (!filesOp.comparePath(newLocation, currentPath.slice())) { displayDirectory(newLocation); }
|
|
|
|
if (!filesOp.comparePath(newLocation, currentPath.slice())) { displayDirectory(newLocation); }
|
|
|
|
return;
|
|
|
|
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()];
|
|
|
@ -2163,7 +2175,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 +2251,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 +2291,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 +2381,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();
|
|
|
@ -2514,7 +2535,6 @@ define([
|
|
|
|
setEditable(!bool);
|
|
|
|
setEditable(!bool);
|
|
|
|
if (!bool && update) {
|
|
|
|
if (!bool && update) {
|
|
|
|
history.onLeaveHistory();
|
|
|
|
history.onLeaveHistory();
|
|
|
|
//init(); //TODO real proxy here
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -2667,33 +2687,20 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* add a history button */
|
|
|
|
/* add a history button */
|
|
|
|
var histConfig = {};
|
|
|
|
var histConfig = {
|
|
|
|
histConfig.onRender = function (val) {
|
|
|
|
onLocal: function () {
|
|
|
|
if (typeof val === "undefined") { return; }
|
|
|
|
proxy.drive = history.currentObj.drive;
|
|
|
|
try {
|
|
|
|
},
|
|
|
|
|
|
|
|
onRemote: function () {},
|
|
|
|
|
|
|
|
setHistory: setHistory,
|
|
|
|
|
|
|
|
applyVal: function (val) {
|
|
|
|
var obj = JSON.parse(val || '{}');
|
|
|
|
var obj = JSON.parse(val || '{}');
|
|
|
|
history.currentObj = obj;
|
|
|
|
history.currentObj = obj;
|
|
|
|
history.onEnterHistory(obj);
|
|
|
|
history.onEnterHistory(obj);
|
|
|
|
} catch (e) {
|
|
|
|
},
|
|
|
|
// Probably a parse error
|
|
|
|
$toolbar: APP.$bar,
|
|
|
|
console.error(e);
|
|
|
|
href: window.location.origin + window.location.pathname + APP.hash
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
histConfig.onClose = function () {
|
|
|
|
|
|
|
|
// Close button clicked
|
|
|
|
|
|
|
|
setHistory(false, true);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
histConfig.onRevert = function () {
|
|
|
|
|
|
|
|
// Revert button clicked
|
|
|
|
|
|
|
|
setHistory(false, false);
|
|
|
|
|
|
|
|
proxy.drive = history.currentObj.drive;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
histConfig.onReady = function () {
|
|
|
|
|
|
|
|
// Called when the history is loaded and the UI displayed
|
|
|
|
|
|
|
|
setHistory(true);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
histConfig.$toolbar = APP.$bar;
|
|
|
|
|
|
|
|
histConfig.href = window.location.origin + window.location.pathname + APP.hash;
|
|
|
|
|
|
|
|
var $hist = Cryptpad.createButton('history', true, {histConfig: histConfig});
|
|
|
|
var $hist = Cryptpad.createButton('history', true, {histConfig: histConfig});
|
|
|
|
$rightside.append($hist);
|
|
|
|
$rightside.append($hist);
|
|
|
|
|
|
|
|
|
|
|
|