Browse Source

Update onclick arguments on blocks

pull/3725/head
Artur Arseniev 5 years ago
parent
commit
61b00cb3b9
  1. 2
      src/block_manager/config/config.js
  2. 2
      src/block_manager/model/Block.js
  3. 2
      src/block_manager/view/BlockView.js

2
src/block_manager/config/config.js

@ -8,7 +8,7 @@ export default {
// If there is no selected component, the block will be appened to the wrapper.
// You can also pass a function to this option, use it as a catch-all for all block
// clicks and implement a custom logic for each block.
// appendOnClick: (editor, block) => {
// appendOnClick: (block, editor) => {
// if (block.get('id') === 'some-id')
// editor.getSelected().append(block.get('content'))
// else

2
src/block_manager/model/Block.js

@ -9,7 +9,7 @@ import { Model } from 'common';
* @property {Boolean} [select=false] If true, the dropped component will be selected
* @property {Boolean} [resetId=false] If true, all IDs of dropped components and their styles will be changed
* @property {Boolean} [disable=false] Disable the block from being interacted
* @property {Function} [onClick] Custom behavior on click, eg. `(editor, block) => editor.getWrapper().append(block.get('content'))`
* @property {Function} [onClick] Custom behavior on click, eg. `(block, editor) => editor.getWrapper().append(block.get('content'))`
* @property {Object} [attributes={}] Block attributes to apply in the view element
*/
export default class Block extends Model {

2
src/block_manager/view/BlockView.js

@ -28,7 +28,7 @@ export default Backbone.View.extend({
if (!onClick) {
return;
} else if (isFunction(onClick)) {
return onClick(em.getEditor(), model, { event: ev });
return onClick(model, em.getEditor(), { event: ev });
}
const sorter = config.getSorter();
const content = model.get('content');

Loading…
Cancel
Save