MCPcopy
hub / github.com/GrapesJS/grapesjs / getStackGroup

Method getStackGroup

packages/core/src/undo_manager/index.ts:326–339  ·  view source on GitHub ↗

* Get grouped undo manager stack. * The difference between `getStack` is when you do multiple operations at a time, * like appending multiple components: * `editor.getWrapper().append(' C1 C2 ');` * `getStack` will return a collection length of 2. * `getStackGroup`

()

Source from the content-addressed store, hash-verified

324 * @private
325 */
326 getStackGroup() {
327 const result: any = [];
328 const inserted: any = [];
329
330 this.getStack().forEach((item: any) => {
331 const index = item.get('magicFusionIndex');
332 if (inserted.indexOf(index) < 0) {
333 inserted.push(index);
334 result.push(item);
335 }
336 });
337
338 return result;
339 }
340
341 /**
342 * Execute the provided callback temporarily stopping tracking changes

Callers 2

index.tsFile · 0.80
datasources.tsFile · 0.80

Calls 2

getStackMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected