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):
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.
Fixes https://github.com/TimOetting/kirby-color/issues/3
Fixes an error thrown when there's no preset (presets is then
undefined
so checking forpresets
before checkingpresets.length
is needed)Removes the
vue-on-click-outside
dependency, which had some flaws: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)
Since the field doesn't rely on the
value
prop itself,value
needs to be watched in order to set thecolor
prop when it changes through actions outside of the field itself (ie when a structure fieldset changes, for example):Issue before:
Fix:
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.