Browse Source

Remove _innertext

pull/4141/head
Artur Arseniev 5 years ago
parent
commit
50b6d45073
  1. 9
      src/dom_components/model/ComponentText.js
  2. 6
      src/dom_components/view/ComponentView.js
  3. 1
      src/rich_text_editor/model/RichTextEditor.js

9
src/dom_components/model/ComponentText.js

@ -9,17 +9,8 @@ export default class ComponentText extends Component {
cmps.forEach(model => { cmps.forEach(model => {
const textable = !!model.get('textable'); const textable = !!model.get('textable');
const isBaseType = ['text', 'default', ''].some(type => model.is(type));
const selectable = !isBaseType || textable;
model.set( model.set(
{ {
_innertext: model.get('_innertext') ? true : !selectable,
// editable: selectable && model.get('editable'),
// selectable: selectable,
// hoverable: selectable,
// draggable: textable,
// highlightable: 0,
// copyable: textable,
...(!textable && { toolbar: '' }), ...(!textable && { toolbar: '' }),
}, },
opts opts

6
src/dom_components/view/ComponentView.js

@ -30,7 +30,7 @@ export default Backbone.View.extend({
this.attr = model.get('attributes'); this.attr = model.get('attributes');
this.classe = this.attr.class || []; this.classe = this.attr.class || [];
this.listenTo(model, 'change:style', this.updateStyle); this.listenTo(model, 'change:style', this.updateStyle);
this.listenTo(model, 'change:attributes change:_innertext', this.renderAttributes); this.listenTo(model, 'change:attributes', this.renderAttributes);
this.listenTo(model, 'change:highlightable', this.updateHighlight); this.listenTo(model, 'change:highlightable', this.updateHighlight);
this.listenTo(model, 'change:status', this.updateStatus); this.listenTo(model, 'change:status', this.updateStatus);
this.listenTo(model, 'change:script rerender', this.reset); this.listenTo(model, 'change:script rerender', this.reset);
@ -54,8 +54,8 @@ export default Backbone.View.extend({
__isDraggable() { __isDraggable() {
const { model, config } = this; const { model, config } = this;
const { _innertext, draggable } = model.attributes; const { draggable } = model.attributes;
return config.draggableComponents && draggable && !_innertext; return config.draggableComponents && draggable;
}, },
_clbObj() { _clbObj() {

1
src/rich_text_editor/model/RichTextEditor.js

@ -333,7 +333,6 @@ export default class RichTextEditor {
const toSel = cmp.find(`[${customElAttr}]`)[0]; const toSel = cmp.find(`[${customElAttr}]`)[0];
if (!toSel) return; if (!toSel) return;
toSel.removeAttributes(customElAttr); toSel.removeAttributes(customElAttr);
toSel.set({ _innertext: true });
editor.select(toSel); editor.select(toSel);
}); });
cmp.trigger('disable'); cmp.trigger('disable');

Loading…
Cancel
Save