Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Style manager] Unit don't change on Composite Type #2028

Closed
WebEtSolutions opened this issue May 23, 2019 · 2 comments
Closed

[Style manager] Unit don't change on Composite Type #2028

WebEtSolutions opened this issue May 23, 2019 · 2 comments

Comments

@WebEtSolutions
Copy link
Contributor

Hi,

I have an error on your demo :(

1- In the style, on the "Build your templates without coding" text, set TOP to 5px
2- In the same element, set Dimension > Margin > Top to 10px
3- In the "Hover me" button, set TOP to 1% and Margin > Top to 2%
4- Select "Build your templates ..."

The TOP value change top 5px -> OK
The Margin > Top value change to 10% -> :(

Globaly, the unit change with the interger is out of a composite.

@WebEtSolutions
Copy link
Contributor Author

For fix this issue, you must change PropertyView.targetUpdated() and change this line
let targetValue = this.getTargetValue({ ignoreDefault: 1 });
by this one
let targetValue = this.getTargetValue({ ignoreDefault: 1, ignoreCustomValue: 1 });

Other fix, in PropertySelectView, you need to add setValue. When the value is !important, the input.val is set to 'value !important' and the select is empty

/**
   * Update the element input.
   * Usually the value is a result of `model.getFullValue()`
   * @param {String} value The value from the model
   * */
  setValue: function setValue(value) {
    var model = this.model;
    var val = (0, _underscore.isUndefined)(value) ? model.getDefaultValue() : value;
    var input = this.getInputEl();
    if (typeof val === 'string')
      val = val.replace(' !important', '').trim();
    input && (input.value = val);
  },

@artf
Copy link
Member

artf commented May 30, 2019

Thanks @WebEtSolutions I'm not totally sure about the solution but the bug is confirmed

@artf artf added this to To do in Release v0.14.62 via automation May 30, 2019
@artf artf added the bug label May 30, 2019
@artf artf closed this as completed in ff33171 Jun 3, 2019
Release v0.14.62 automation moved this from To do to Done Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

2 participants