TimOetting / kirby-color

Color picker field for Kirby 3
46 stars 8 forks source link

Bugfixes and compatibility with RC4 #5

Closed sylvainjule closed 5 years ago

sylvainjule commented 5 years ago

Fixes https://github.com/TimOetting/kirby-color/issues/3

Fixes an error thrown when there's no preset (presets is then undefined so checking for presets before checking presets.length is needed)

Removes the vue-on-click-outside dependency, which had some flaws:

blur-before

Instead there's a simpler way of doing it : listening to the blur event to close it as soon as the field loses focus. (edit: with the pitfall of having to check whether the focus has been lost in favor of the color-picker, see https://github.com/TimOetting/kirby-color/pull/5/commits/9ab35a5d53ba3c85b79addbfcecacc0ede530abf)

blur-after

Since the field doesn't rely on the value prop itself, value needs to be watched in order to set the color prop when it changes through actions outside of the field itself (ie when a structure fieldset changes, for example):

Issue before: not-reactive

Fix: reactive

Anticipating when my previews plugin will not be needed anymore for core fields, remaining previews will only be for plugin fields, I think it's best to have them directly handled by plugins themselves, rather than by an additional one.

capture d ecran 2019-01-11 a 15 57 24
SebastianEberlein commented 5 years ago

Thanks a lot for forking and updating the field, @sylvainjule .

Could you also add the help: and translate: false options for the field?