Browse Source

Add `component:type:add` and `component:type:update` events

pull/1874/head
Artur Arseniev 8 years ago
parent
commit
0c1a272073
  1. 4
      src/dom_components/index.js
  2. 2
      src/editor/index.js

4
src/dom_components/index.js

@ -520,6 +520,7 @@ module.exports = () => {
* @return {this}
*/
addType(type, methods) {
const { em } = this;
const {
model = {},
view = {},
@ -571,6 +572,9 @@ module.exports = () => {
componentTypes.unshift(methods);
}
const event = `component:type:${compType ? 'update' : 'add'}`;
em && em.trigger(event, compType || methods);
return this;
},

2
src/editor/index.js

@ -30,6 +30,8 @@
* * `component:selected` - New component selected, the selected model is passed as an argument to the callback
* * `component:deselected` - Component deselected, the deselected model is passed as an argument to the callback
* * `component:toggled` - Component selection changed, toggled model is passed as an argument to the callback
* * `component:type:add` - New component type added, the new type is passed as an argument to the callback
* * `component:type:update` - Component type updated, the updated type is passed as an argument to the callback
* ### Blocks
* * `block:add` - New block added
* * `block:remove` - Block removed

Loading…
Cancel
Save