mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Make tab operations undoable
This commit is contained in:
parent
c810edc10e
commit
386520e65b
@ -36,7 +36,15 @@ RED.history = function() {
|
|||||||
for (var i in ev.links) {
|
for (var i in ev.links) {
|
||||||
RED.nodes.removeLink(ev.links[i]);
|
RED.nodes.removeLink(ev.links[i]);
|
||||||
}
|
}
|
||||||
|
for (var i in ev.workspaces) {
|
||||||
|
RED.nodes.removeWorkspace(ev.workspaces[i].id);
|
||||||
|
RED.view.removeWorkspace(ev.workspaces[i]);
|
||||||
|
}
|
||||||
} else if (ev.t == "delete") {
|
} else if (ev.t == "delete") {
|
||||||
|
for (var i in ev.workspaces) {
|
||||||
|
RED.nodes.addWorkspace(ev.workspaces[i]);
|
||||||
|
RED.view.addWorkspace(ev.workspaces[i]);
|
||||||
|
}
|
||||||
for (var i in ev.nodes) {
|
for (var i in ev.nodes) {
|
||||||
RED.nodes.add(ev.nodes[i]);
|
RED.nodes.add(ev.nodes[i]);
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,9 @@ RED.view = function() {
|
|||||||
RED.nodes.addWorkspace(ws);
|
RED.nodes.addWorkspace(ws);
|
||||||
workspace_tabs.addTab(ws);
|
workspace_tabs.addTab(ws);
|
||||||
workspace_tabs.activateTab(tabId);
|
workspace_tabs.activateTab(tabId);
|
||||||
|
|
||||||
|
RED.history.push({t:'add',workspaces:[ws],dirty:dirty});
|
||||||
|
RED.view.dirty(true);
|
||||||
});
|
});
|
||||||
$('#btn-workspace-edit').on("click",function() {
|
$('#btn-workspace-edit').on("click",function() {
|
||||||
showRenameWorkspaceDialog(activeWorkspace);
|
showRenameWorkspaceDialog(activeWorkspace);
|
||||||
@ -1047,7 +1050,11 @@ RED.view = function() {
|
|||||||
var workspace = $(this).dialog('option','workspace');
|
var workspace = $(this).dialog('option','workspace');
|
||||||
workspace_tabs.removeTab(workspace.id);
|
workspace_tabs.removeTab(workspace.id);
|
||||||
// TODO: make undoable
|
// TODO: make undoable
|
||||||
RED.nodes.removeWorkspace(workspace.id);
|
var historyEvent = RED.nodes.removeWorkspace(workspace.id);
|
||||||
|
historyEvent.t = 'delete';
|
||||||
|
historyEvent.dirty = dirty;
|
||||||
|
historyEvent.workspaces = [workspace];
|
||||||
|
RED.history.push(historyEvent);
|
||||||
RED.view.dirty(true);
|
RED.view.dirty(true);
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
}
|
}
|
||||||
@ -1074,6 +1081,9 @@ RED.view = function() {
|
|||||||
workspace_tabs.addTab(ws);
|
workspace_tabs.addTab(ws);
|
||||||
workspace_tabs.resize();
|
workspace_tabs.resize();
|
||||||
},
|
},
|
||||||
|
removeWorkspace: function(ws) {
|
||||||
|
workspace_tabs.removeTab(ws.id);
|
||||||
|
},
|
||||||
getWorkspace: function() {
|
getWorkspace: function() {
|
||||||
return activeWorkspace;
|
return activeWorkspace;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user