history: always store items per target (i.e. always wrap in array)
This commit is contained in:
parent
ce8ea1361f
commit
d0ab48cdbc
1 changed files with 8 additions and 9 deletions
|
@ -314,8 +314,8 @@ pandora.createLinks = function($element) {
|
||||||
);
|
);
|
||||||
pandora.history.add({
|
pandora.history.add({
|
||||||
action: action,
|
action: action,
|
||||||
items: action == 'cut' || action == 'delete' ? items
|
items: action == 'cut' || action == 'delete' ? [items]
|
||||||
: action == 'copy' || action == 'paste' ? addedItems
|
: action == 'copy' || action == 'paste' ? [addedItems]
|
||||||
: [items, addedItems],
|
: [items, addedItems],
|
||||||
targets: targets,
|
targets: targets,
|
||||||
text: text
|
text: text
|
||||||
|
@ -330,9 +330,9 @@ pandora.createLinks = function($element) {
|
||||||
if (object) {
|
if (object) {
|
||||||
pandora.$ui.mainMenu.replaceItemMenu();
|
pandora.$ui.mainMenu.replaceItemMenu();
|
||||||
if (object.action == 'copy' || object.action == 'paste') {
|
if (object.action == 'copy' || object.action == 'paste') {
|
||||||
addItems(object.items, object.targets[0], done);
|
addItems(object.items[0], object.targets[0], done);
|
||||||
} else if (object.action == 'cut' || object.action == 'delete') {
|
} else if (object.action == 'cut' || object.action == 'delete') {
|
||||||
removeItems(object.items, object.targets[0], done);
|
removeItems(object.items[0], object.targets[0], done);
|
||||||
} else if (object.action == 'move') {
|
} else if (object.action == 'move') {
|
||||||
removeItems(object.items[0], object.targets[0], function() {
|
removeItems(object.items[0], object.targets[0], function() {
|
||||||
addItems(object.items[1], object.targets[1], done);
|
addItems(object.items[1], object.targets[1], done);
|
||||||
|
@ -349,9 +349,9 @@ pandora.createLinks = function($element) {
|
||||||
if (object) {
|
if (object) {
|
||||||
pandora.$ui.mainMenu.replaceItemMenu();
|
pandora.$ui.mainMenu.replaceItemMenu();
|
||||||
if (object.action == 'copy' || object.action == 'paste') {
|
if (object.action == 'copy' || object.action == 'paste') {
|
||||||
removeItems(object.items, object.targets[0], done);
|
removeItems(object.items[0], object.targets[0], done);
|
||||||
} else if (object.action == 'cut' || object.action == 'delete') {
|
} else if (object.action == 'cut' || object.action == 'delete') {
|
||||||
addItems(object.items, object.targets[0], done);
|
addItems(object.items[0], object.targets[0], done);
|
||||||
} else if (object.action == 'move') {
|
} else if (object.action == 'move') {
|
||||||
removeItems(object.items[1], object.targets[1], function() {
|
removeItems(object.items[1], object.targets[1], function() {
|
||||||
addItems(object.items[0], object.targets[0], done);
|
addItems(object.items[0], object.targets[0], done);
|
||||||
|
@ -392,7 +392,7 @@ pandora.createLinks = function($element) {
|
||||||
|
|
||||||
function doneHistory(object, callback) {
|
function doneHistory(object, callback) {
|
||||||
var list, listData,
|
var list, listData,
|
||||||
type = getType(object.items),
|
type = getType(object.items[0]),
|
||||||
ui = pandora.user.ui;
|
ui = pandora.user.ui;
|
||||||
if (type == 'item' && ui.section == 'items') {
|
if (type == 'item' && ui.section == 'items') {
|
||||||
Ox.Request.clearCache('find');
|
Ox.Request.clearCache('find');
|
||||||
|
@ -422,8 +422,7 @@ pandora.createLinks = function($element) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getType(items) {
|
function getType(items) {
|
||||||
var item = Ox.isArray(items[0]) ? items[0][0] : items[0];
|
return items[0] && Ox.contains(items[0], '/') ? 'clip' : 'item';
|
||||||
return item && Ox.contains(item, '/') ? 'clip' : 'item';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function removeItems(items, target, callback) {
|
function removeItems(items, target, callback) {
|
||||||
|
|
Loading…
Reference in a new issue