|
|
|
@ -25,7 +25,7 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
import UndoManager from 'backbone-undo'; |
|
|
|
import { isArray, isBoolean, isEmpty } from 'underscore'; |
|
|
|
import { isArray, isBoolean, isEmpty, unique } from 'underscore'; |
|
|
|
|
|
|
|
export default () => { |
|
|
|
let em; |
|
|
|
@ -316,24 +316,39 @@ export default () => { |
|
|
|
this.start(); |
|
|
|
}, |
|
|
|
|
|
|
|
__getStackRead() { |
|
|
|
getGroupedStack() { |
|
|
|
const result = {}; |
|
|
|
const stack = this.getStack(); |
|
|
|
const createItem = item => { |
|
|
|
const { type, after, before, object } = item.attributes; |
|
|
|
return { |
|
|
|
type, |
|
|
|
after, |
|
|
|
before, |
|
|
|
object, |
|
|
|
}; |
|
|
|
const { type, after, before, object, options = {} } = item.attributes; |
|
|
|
return { type, after, before, object, options }; |
|
|
|
}; |
|
|
|
this.getStack().forEach(item => { |
|
|
|
stack.forEach(item => { |
|
|
|
const index = item.get('magicFusionIndex'); |
|
|
|
const value = createItem(item); |
|
|
|
if (!result[index]) result[index] = [value]; |
|
|
|
else result[index].push(value); |
|
|
|
|
|
|
|
if (!result[index]) { |
|
|
|
result[index] = [value]; |
|
|
|
} else { |
|
|
|
result[index].push(value); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return Object.keys(result).map(index => { |
|
|
|
const actions = result[index]; |
|
|
|
return { |
|
|
|
// index: stack.models.indexOf(actions[0]),
|
|
|
|
index, |
|
|
|
actions, |
|
|
|
labels: unique( |
|
|
|
actions.reduce((res, item) => { |
|
|
|
const label = item.options?.action; |
|
|
|
label && res.push(label); |
|
|
|
return res; |
|
|
|
}, []) |
|
|
|
), |
|
|
|
}; |
|
|
|
}); |
|
|
|
return Object.keys(result).map(i => result[i]); |
|
|
|
}, |
|
|
|
|
|
|
|
getPointer() { |
|
|
|
|