Browse Source

Avoid element update, from the model value change, if it comes from element itself

pull/487/head
Artur Arseniev 8 years ago
parent
commit
1279ad7b03
  1. 4
      dist/grapes.min.js
  2. 3
      src/editor/index.js
  3. 8
      src/style_manager/view/PropertyView.js

4
dist/grapes.min.js

File diff suppressed because one or more lines are too long

3
src/editor/index.js

@ -89,6 +89,7 @@
* style: '.txt-red{color: red}', * style: '.txt-red{color: red}',
* }); * });
*/ */
import $ from 'cash-dom';
module.exports = config => { module.exports = config => {
var c = config || {}, var c = config || {},
@ -110,6 +111,8 @@ module.exports = config => {
return { return {
$,
/** /**
* @property {EditorModel} * @property {EditorModel}
* @private * @private

8
src/style_manager/view/PropertyView.js

@ -298,13 +298,17 @@ module.exports = Backbone.View.extend({
* @param {Mixed} val Value * @param {Mixed} val Value
* @param {Object} opt Options * @param {Object} opt Options
* */ * */
modelValueChanged(e, val, opt) { modelValueChanged(e, val, opt = {}) {
const em = this.config.em; const em = this.config.em;
const model = this.model; const model = this.model;
const value = model.getFullValue(); const value = model.getFullValue();
const target = this.getTarget(); const target = this.getTarget();
const onChange = this.onChange; const onChange = this.onChange;
this.setRawValue(value);
// I don't need to update the input if the change comes from it
if (!opt.fromInput) {
this.setRawValue(value);
}
// Check if component is allowed to be styled // Check if component is allowed to be styled
if (!target || !this.isTargetStylable() || !this.isComponentStylable()) { if (!target || !this.isTargetStylable() || !this.isComponentStylable()) {

Loading…
Cancel
Save