Issue #2028💬 AnsweredOpened May 23, 2019by WebEtSolutions0 reactions

Unit don't change on Composite Type

快速解答by WebEtSolutions

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...

Read full answer below ↓

Question

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.

Answers (2)

WebEtSolutionsMay 23, 2019

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);
  },
artfMay 31, 2019

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

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.