Skip to content

Commit

Permalink
Avoid element update, from the model value change, if it comes from e…
Browse files Browse the repository at this point in the history
…lement itself
  • Loading branch information
artf committed Oct 31, 2017
1 parent 2850554 commit 1279ad7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/grapes.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/editor/index.js
Expand Up @@ -89,6 +89,7 @@
* style: '.txt-red{color: red}',
* });
*/
import $ from 'cash-dom';

module.exports = config => {
var c = config || {},
Expand All @@ -110,6 +111,8 @@ module.exports = config => {

return {

$,

/**
* @property {EditorModel}
* @private
Expand Down
8 changes: 6 additions & 2 deletions src/style_manager/view/PropertyView.js
Expand Up @@ -298,13 +298,17 @@ module.exports = Backbone.View.extend({
* @param {Mixed} val Value
* @param {Object} opt Options
* */
modelValueChanged(e, val, opt) {
modelValueChanged(e, val, opt = {}) {
const em = this.config.em;
const model = this.model;
const value = model.getFullValue();
const target = this.getTarget();
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
if (!target || !this.isTargetStylable() || !this.isComponentStylable()) {
Expand Down

0 comments on commit 1279ad7

Please sign in to comment.