@sequent-org/moodboard 1.4.65 → 1.4.66

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequent-org/moodboard",
3
- "version": "1.4.65",
3
+ "version": "1.4.66",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -41,7 +41,9 @@ export class HistoryManager {
41
41
  lastCommand.mergeWith(command);
42
42
  this._executeCommandSafely(lastCommand);
43
43
  this.eventBus.emit('history:changed', {
44
- historySize: this.history.length
44
+ historySize: this.history.length,
45
+ canUndo: this.currentIndex >= 0,
46
+ canRedo: this.currentIndex < this.history.length - 1,
45
47
  });
46
48
  return;
47
49
  }
@@ -67,7 +69,9 @@ export class HistoryManager {
67
69
  // Уведомляем об изменении истории
68
70
  this.eventBus.emit(Events.History.Changed, {
69
71
  historySize: this.history.length,
70
- currentCommand: command.toString()
72
+ currentCommand: command.toString(),
73
+ canUndo: this.currentIndex >= 0,
74
+ canRedo: this.currentIndex < this.history.length - 1,
71
75
  });
72
76
 
73
77
 
@@ -107,7 +111,9 @@ export class HistoryManager {
107
111
  this.currentIndex = -1;
108
112
 
109
113
  this.eventBus.emit(Events.History.Changed, {
110
- historySize: 0
114
+ historySize: 0,
115
+ canUndo: false,
116
+ canRedo: false,
111
117
  });
112
118
 
113
119
 
package/src/core/index.js CHANGED
@@ -230,6 +230,12 @@ export class CoreMoodBoard {
230
230
  historySize: data.historySize,
231
231
  });
232
232
  }
233
+ if (data && ('canUndo' in data || 'canRedo' in data)) {
234
+ this.eventBus.emit(Events.UI.UpdateHistoryButtons, {
235
+ canUndo: !!data.canUndo,
236
+ canRedo: !!data.canRedo,
237
+ });
238
+ }
233
239
  });
234
240
  }
235
241