Skip to content

Commit

Permalink
Update how Text Component handle children on change. Fixes #1593
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Nov 21, 2018
1 parent 47e20d7 commit b074aa5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/dom_components/view/ComponentImageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ module.exports = ComponentView.extend({
tagName: 'img',

events: {
dblclick: 'openModal',
dblclick: 'onActive',
click: 'initResize'
},

initialize(o) {
console.log('init image', this.el);
const model = this.model;
ComponentView.prototype.initialize.apply(this, arguments);
this.listenTo(model, 'change:src', this.updateSrc);
this.listenTo(model, 'dblclick active', this.openModal);
this.classEmpty = `${this.ppfx}plh-image`;
const config = this.config;
config.modal && (this.modal = config.modal);
Expand Down Expand Up @@ -60,7 +60,8 @@ module.exports = ComponentView.extend({
* @param {Object} e Event
* @private
* */
openModal(e) {
onActive(ev) {
ev && ev.stopPropagation();
var em = this.opts.config.em;
var editor = em ? em.get('Editor') : '';

Expand Down
6 changes: 4 additions & 2 deletions src/dom_components/view/ComponentTextView.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ module.exports = ComponentView.extend({
model.set('content', content, contentOpt);
} else {
const clean = model => {
const selectable = !model.is('text');
const selectable = !['text', 'default', ''].some(type =>
model.is(type)
);
model.set({
editable: 0,
editable: selectable && model.get('editable'),
highlightable: 0,
removable: 0,
draggable: 0,
Expand Down

0 comments on commit b074aa5

Please sign in to comment.