You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our case, the problem is mostly related to some styles being missed after it was processed by the plugin.
For instance, we have node: <span style="color:red!important;font-size:14px">Text</span>
After the conversion becomes: <span style="font-size:14px">Text</span>
As you can see "color" style is missing.
Can we have the possibility of "saving" style even if it was passed with "!important"?
like: <span style="color:red;font-size:14px">Text</span>
@ArtsiomReutovich can replace work as a workaround for you? If it doesn't, a quick hack would be to do a replaceAll('!important', '') for your HTML string.
Activity
remarkablemark commentedon Feb 9, 2024
@piszczu4 this is expected behavior because this library parses inline styles and inline styles do not support
!importantpiszczu4 commentedon Feb 9, 2024
Why does not support? Look here: https://codepen.io/degel123/pen/poYOLzE
remarkablemark commentedon Feb 9, 2024
@piszczu4 can you provide a reproducible example of this not working for you?
piszczu4 commentedon Feb 9, 2024
Here it is: https://codesandbox.io/p/sandbox/parser-hf4g76?file=%2Fsrc%2FApp.tsx%3A30%2C44-30%2C53
If you remove
!important, it starts to work.remarkablemark commentedon Feb 9, 2024
@piszczu4 I can't seem to open the CodeSandbox?
piszczu4 commentedon Feb 9, 2024
Try this: https://codesandbox.io/p/sandbox/parser-hf4g76?file=%2Fsrc%2FApp.tsx
Here is the code:
piszczu4 commentedon Feb 12, 2024
Any feeedbaack?
piszczu4 commentedon Feb 29, 2024
Any progress on that one?
ArtsiomReutovich commentedon Apr 4, 2024
Hello Guys, are you going to fix the issue?
remarkablemark commentedon Apr 4, 2024
I've been really busy these days so I haven't had a chance to look into this. If anyone has a solution, feel free to open a PR and I can review it.
I did a quick search and it looks like React does not support important inline styles: https://stackoverflow.com/questions/23074748/important-inline-styles-in-react
ArtsiomReutovich commentedon Apr 4, 2024
Hello @remarkablemark,
In our case, the problem is mostly related to some styles being missed after it was processed by the plugin.
For instance, we have node:
<span style="color:red!important;font-size:14px">Text</span>After the conversion becomes:
<span style="font-size:14px">Text</span>As you can see "color" style is missing.
Can we have the possibility of "saving" style even if it was passed with "!important"?
like:
<span style="color:red;font-size:14px">Text</span>remarkablemark commentedon Apr 4, 2024
@ArtsiomReutovich can replace work as a workaround for you? If it doesn't, a quick hack would be to do a
replaceAll('!important', '')for your HTML string.ArtsiomReutovich commentedon Apr 5, 2024
Hello @remarkablemark,
Yes, I'm doing it this way.