diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bae0d1812..ff1ef9f63b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## UNRELEASED + +### Fixes + +* Fixes ability to change color hue by clicking the color hue bar rather than dragging the indicator +* Prevents the rich text control bar from closing while using certain UI within the color picker + +### Adds + +* Ability to disable the color spectrum UI of a color picker + +### Changes + +* The `pickerOptions` sub property of a color field's configuration has been merged with it's parent `options` object. + ## 4.11.2 (2024-12-29) ### Fixes diff --git a/modules/@apostrophecms/color-field/index.js b/modules/@apostrophecms/color-field/index.js index bee8cbc929..95f149819d 100644 --- a/modules/@apostrophecms/color-field/index.js +++ b/modules/@apostrophecms/color-field/index.js @@ -10,6 +10,17 @@ module.exports = { self.name = self.options.name; self.addFieldType(); self.enableBrowserData(); + self.defaultOptions = { + format: 'hex8', + disableAlpha: false, + disableFields: false, + disableSpectrum: false, + presetColors: [ + '#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', + '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', + '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF' + ] + }; }, methods(self) { return { @@ -36,7 +47,8 @@ module.exports = { getBrowserData(req) { return { name: self.name, - action: self.action + action: self.action, + defaultOptions: self.defaultOptions }; } }; diff --git a/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue b/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue index 4d532bddd2..7be8256302 100644 --- a/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue +++ b/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue @@ -3,14 +3,22 @@ role="application" aria-label="Color picker" class="apos-color" - :class="[disableAlpha ? 'apos-color--disable-alpha' : '']" + :class="[ + disableAlpha ? 'apos-color--disable-alpha' : null, + disableSpectrum ? 'apos-color--disable-spectrum' : null, + disableFields ? 'apos-color--disable-fields' : null, + !presetColors ? 'apos-color--disable-presets' : null + ]" > -