@node-projects/web-component-designer 0.1.59 → 0.1.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ export interface IUndoService extends IService {
7
7
  canUndo(): boolean;
8
8
  canRedo(): boolean;
9
9
  clear(): any;
10
+ clearTransactionstackIfNotEmpty(): any;
10
11
  undo(): any;
11
12
  redo(): any;
12
13
  getUndoEntries(count?: number): Generator<string, void, unknown>;
@@ -13,6 +13,7 @@ export declare class UndoService implements IUndoService {
13
13
  private abortTransactionItem;
14
14
  execute(item: ITransactionItem): void;
15
15
  clear(): void;
16
+ clearTransactionstackIfNotEmpty(): void;
16
17
  undo(): void;
17
18
  redo(): void;
18
19
  canUndo(): boolean;
@@ -62,6 +62,12 @@ export class UndoService {
62
62
  this._redoStack = [];
63
63
  this._transactionStack = [];
64
64
  }
65
+ clearTransactionstackIfNotEmpty() {
66
+ if (this._transactionStack.length) {
67
+ console.warn("transactionStack was not empty, but should be", this._transactionStack);
68
+ this._transactionStack = [];
69
+ }
70
+ }
65
71
  undo() {
66
72
  if (!this.canUndo())
67
73
  return;
@@ -667,6 +667,7 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
667
667
  this.snapLines.clearSnaplines();
668
668
  }
669
669
  setDesignItems(designItems) {
670
+ this.instanceServiceContainer.undoService.clearTransactionstackIfNotEmpty();
670
671
  const setItemsAction = new SetDesignItemsAction(designItems, [...this.rootDesignItem.children()]);
671
672
  this.instanceServiceContainer.undoService.execute(setItemsAction);
672
673
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.1.59",
4
+ "version": "0.1.60",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",