Browse Source

Update insert custom command

pull/36/head
Artur Arseniev 10 years ago
parent
commit
de0b35b39a
  1. 22
      src/commands/view/InsertCustom.js
  2. 97
      src/demo.js
  3. 4
      src/panels/view/ButtonView.js

22
src/commands/view/InsertCustom.js

@ -10,12 +10,11 @@ define(['backbone', './SelectPosition'],
* Run method
* @private
* */
run: function(em, sender){
run: function(em, sender, options){
this.enable();
this.em = em;
this.sender = sender;
this.opt = sender.get('options') || {};
this.content = this.opt.content;
this.em = em;
this.sender = sender;
this.opt = options || {};
},
enable: function(){
@ -42,7 +41,7 @@ define(['backbone', './SelectPosition'],
this.enable();
if(this.em)
this.em.initChildrenComp(model);
this.em.editor.initChildrenComp(model);
this.afterInsert(model, this);
},
@ -68,16 +67,7 @@ define(['backbone', './SelectPosition'],
* @private
* */
buildContent: function(){
var result = {};
if(typeof this.content === 'string'){
result = {
content : this.content,
tagName : 'span',
};
}else if(typeof this.content === 'object'){
result = this.content;
}
return result;
return this.opt.content;
},
});
});

97
src/demo.js

File diff suppressed because one or more lines are too long

4
src/panels/view/ButtonView.js

@ -155,7 +155,7 @@ function(Backbone, require) {
this.parentM.set('active', true, { silent: true }).trigger('checkActive');
if(command)
command.run(editor, this.model);
command.run(editor, this.model, this.model.get('options'));
}else{
this.$el.removeClass(this.activeCls);
@ -165,7 +165,7 @@ function(Backbone, require) {
this.parentM.set('active', false, { silent: true }).trigger('checkActive');
if(command)
command.stop(editor, this.model);
command.stop(editor, this.model, this.model.get('options'));
}
},

Loading…
Cancel
Save