|
|
|
@ -44,7 +44,7 @@ |
|
|
|
* |
|
|
|
* @module Blocks |
|
|
|
*/ |
|
|
|
import { isArray } from 'underscore'; |
|
|
|
import { isArray, debounce } from 'underscore'; |
|
|
|
import defaults, { BlockManagerConfig } from './config/config'; |
|
|
|
import Block, { BlockProperties } from './model/Block'; |
|
|
|
import Blocks from './model/Blocks'; |
|
|
|
@ -117,6 +117,8 @@ export default class BlockManager extends ItemManagerModule<BlockManagerConfig, |
|
|
|
this.blocks.on('remove', model => this.blocksVisible.remove(model)); |
|
|
|
this.blocks.on('reset', coll => this.blocksVisible.reset(coll.models)); |
|
|
|
|
|
|
|
this.__onAllEvent = debounce(() => this.__trgCustom(), 0); |
|
|
|
|
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
@ -137,13 +139,13 @@ export default class BlockManager extends ItemManagerModule<BlockManagerConfig, |
|
|
|
bm: this as BlockManager, |
|
|
|
blocks: this.getAll().models, |
|
|
|
container: bhv.container, |
|
|
|
dragStart: (block: Block, ev: Event) => this.startDrag(block, ev), |
|
|
|
dragStart: (block: Block, ev?: Event) => this.startDrag(block, ev), |
|
|
|
drag: (ev: Event) => this.__drag(ev), |
|
|
|
dragStop: (cancel: boolean) => this.endDrag(cancel), |
|
|
|
dragStop: (cancel?: boolean) => this.endDrag(cancel), |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
__startDrag(block: Block, ev: Event) { |
|
|
|
__startDrag(block: Block, ev?: Event) { |
|
|
|
const { em, events, blocks } = this; |
|
|
|
const content = block.getContent ? block.getContent() : block; |
|
|
|
this._dragBlock = block; |
|
|
|
@ -209,12 +211,12 @@ export default class BlockManager extends ItemManagerModule<BlockManagerConfig, |
|
|
|
return this._bhv || {}; |
|
|
|
} |
|
|
|
|
|
|
|
startDrag(block: Block, ev: Event) { |
|
|
|
startDrag(block: Block, ev?: Event) { |
|
|
|
this.__startDrag(block, ev); |
|
|
|
this.__getFrameViews().forEach((fv: any) => fv.droppable.startCustom()); |
|
|
|
} |
|
|
|
|
|
|
|
endDrag(cancel: boolean) { |
|
|
|
endDrag(cancel?: boolean) { |
|
|
|
this.__getFrameViews().forEach((fv: any) => fv.droppable.endCustom(cancel)); |
|
|
|
this.__endDrag(); |
|
|
|
} |
|
|
|
|