Fix the trash button in toolbar not always working

pull/1/head
yflory 8 years ago
parent aae3fba284
commit 92050eb04f

@ -400,6 +400,7 @@ define([
};
var getRelativeHref = common.getRelativeHref = function (href) {
if (!href) { return; }
var parsed = common.parsePadUrl(href);
return '/' + parsed.type + '/#' + parsed.hash;
};
@ -563,7 +564,7 @@ define([
};
if (typeof(getStore().forgetPad) === "function") {
getStore().forgetPad(href, callback);
getStore().forgetPad(common.getRelativeHref(href), callback);
}
};

@ -698,6 +698,7 @@ define([
var forgetPad = exp.forgetPad = function (href) {
if (workgroup) { return; }
if (!href) { return; }
var rootFiles = getRootFiles().slice();
if (rootFiles.indexOf(href) !== -1) {
removeFileFromRoot(files[ROOT], href);
@ -712,6 +713,7 @@ define([
var addUnsortedPad = exp.addPad = function (href, path, name) {
if (workgroup) { return; }
if (!href) { return; }
var unsortedFiles = getUnsortedFiles();
var rootFiles = getRootFiles();
var trashFiles = getTrashFiles();

@ -1810,6 +1810,8 @@ define([
return false;
}).on('remove', [], function (o, p) {
var path = arguments[1];
if (path[0] !== 'drive') { return false; }
path = path.slice(1);
var cPath = currentPath.slice();
if ((filesOp.isPathInUnsorted(cPath) && filesOp.isPathInUnsorted(path)) ||
(filesOp.isPathInTemplate(cPath) && filesOp.isPathInTemplate(path)) ||

Loading…
Cancel
Save