Error after updating to version 3.1.2
JoeriE opened this issue · comments
Hi,
I updated to the latest version (3.1.2) of the plugin to use it with Statamic 3.4, but I get several javascript errors:
The problem only occurs on existing bard fields with content. The content is hidden and nothing is clickable.
If I add a new field or add content to a existing field, there's no problem.
Best wishes,
Joeri
Weird, I can't get it to happen. I'm gonna try and make a fix for it though.
I'm experiencing the same issue, with the same JS errors in the console. The only "fix" is to completely remove the textColor marks from the content yaml.
can confirm.
this issue seems to have been introduced by 3.1.0
however, whilst 3.0 is working fine in the CP, the frontend output leads to: #22
-
type: textColor
attrs:
color: 'rgb(255, 255, 255) !important'
seems that this has changed from
attrs:
color: ..
to:
attrs:
key: ...
which is causing this https://github.com/xndbogdan/statamic-bard-text-color/blob/main/resources/js/TextColor.js#L63 (HTMLAttributes.key
) to be empty and this https://github.com/xndbogdan/statamic-bard-text-color/blob/main/resources/js/TextColor.js#L34 returning an Error
PS: this also breaks any yaml with bard colors on saving as it just rips out the old color
attr..
found the culprit:
60e6cf2
here you rename the "color" attribute to "key". this breaks everything.
and this: https://github.com/xndbogdan/statamic-bard-text-color/blob/main/resources/js/TextColor.js#L29 fails in the example above where there's an !important
flag..
PR added. this should fix the JS errors as it uses a proper js lib (tinycolor2) that can handle the color conversions properly.