fix history do after undo
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com> Former-commit-id: de84fcb501cd576e8546abc5b1d4e42933488252
This commit is contained in:
parent
f5b0369476
commit
8b20807c1b
1 changed files with 12 additions and 4 deletions
|
@ -25,18 +25,26 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_commands_events.on((message) => {
|
_commands_events.on((message) => {
|
||||||
|
if (message.action === "run") {
|
||||||
|
Array.from(historyView.children).forEach((child) => {
|
||||||
|
if (
|
||||||
|
!commands.history.find((entry) => `hist-${entry.id}` === child.id)
|
||||||
|
) {
|
||||||
|
console.log("Removing " + entry.id);
|
||||||
|
historyView.removeChild(child);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
commands.history.forEach((entry, index) => {
|
commands.history.forEach((entry, index) => {
|
||||||
console.log("Inserting " + entry.id);
|
|
||||||
if (!document.getElementById(`hist-${entry.id}`)) {
|
if (!document.getElementById(`hist-${entry.id}`)) {
|
||||||
|
console.log("Inserting " + entry.id);
|
||||||
historyView.appendChild(
|
historyView.appendChild(
|
||||||
makeHistoryEntry(index, `hist-${entry.id}`, entry.title)
|
makeHistoryEntry(index, `hist-${entry.id}`, entry.title)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
while (historyView.children.length > commands.history.length)
|
|
||||||
historyView.removeChild(historyView.lastElementChild);
|
|
||||||
|
|
||||||
Array.from(historyView.children).forEach((child, index) => {
|
Array.from(historyView.children).forEach((child, index) => {
|
||||||
if (index === commands.current) {
|
if (index === commands.current) {
|
||||||
child.classList.remove(["past"]);
|
child.classList.remove(["past"]);
|
||||||
|
|
Loading…
Reference in a new issue