GrapesJS / style-gradient

Add gradient input to the Style Manager in GrapesJS
BSD 3-Clause "New" or "Revised" License
20 stars 20 forks source link

BUG: Gradients not working in specific browsers due to browser / vendor prefixes. #8

Closed germanclear closed 3 years ago

germanclear commented 4 years ago

Hi The resulting css declarations when adding a new gradient through the plugin have -webkit- prefix. This causes issues when rendering in browsers like IE11.

Note this is not an issue when loading an element which already has defined gradients (without prefixes). It's only an issue when applying a new gradient to an element.

You can replicate this in the demo page by adding a gradient to one of the text blocks. Compare this with the existing gradient in the main container.

  1. Load Demo page at: https://codepen.io/artf/full/bYwdQG/
  2. Inspect container element with pre-defined gradient: image
  3. Add any sort of gradient using the plugin to one of the text blocks. Upon inspection would look something like this: image

Possible fix: Use getValue() instead of getSafeValue() when reading the value from https://github.com/artf/grapick at: https://github.com/artf/grapesjs-style-gradient/blob/cd2e9fc6da5a1c2d873b36d0ec6cc503645c430e/src/styles.js#L79 Or Update https://github.com/artf/grapick to return by default the non prefixed value instead of the prefixed one at: https://github.com/artf/grapick/blob/6e759fe5726cf6e616880c7aab00f5eec5f20478/src/Grapick.js#L138

artf commented 3 years ago

Should be fixed in the latest release