86914[BUGFIX] Add color preview for color field
Commit message
Review
-
Code review CR +2 Done
- Oli Bartsch +2
- Garvin Hicking +1
-
Verified V +2 Done
- Oli Bartsch +2
- Garvin Hicking +1
- core-ci +1 CI
Issues 1
Files 17
- Build/Sources/Sass/component/forms/_input-group.scss4+4 −2
- Build/Sources/Sass/element/typo3-backend-color-picker.scssnew+11 −0
- Build/Sources/Sass/backend.scss+1 −0
- Build/Sources/TypeScript/backend/form-engine/element/color-element.ts+15 −17
- Build/Sources/TypeScript/backend/settings/type/color.ts4+23 −23
- Build/Sources/TypeScript/backend/color-picker.ts3+92 −40
- Build/Sources/TypeScript/install/module/settings/extension-configuration.ts+2 −6
- Build/Sources/TypeScript/tstemplate/constant-editor.ts+3 −9
- typo3/sysext/backend/Classes/Form/Element/ColorElement.php+29 −22
- typo3/sysext/backend/Resources/Public/Css/backend.css+4 −2
- typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/color-element.js+1 −1
- typo3/sysext/backend/Resources/Public/JavaScript/settings/type/color.js+12 −10
- typo3/sysext/backend/Resources/Public/JavaScript/color-picker.js+25 −1
- typo3/sysext/install/Resources/Private/Partials/Settings/ExtensionConfiguration/ExtensionForm.html+10 −8
- typo3/sysext/install/Resources/Public/JavaScript/module/settings/extension-configuration.js+1 −1
- typo3/sysext/tstemplate/Resources/Private/Partials/ConstantEditorFields.html2+20 −9
- typo3/sysext/tstemplate/Resources/Public/JavaScript/constant-editor.js+1 −1
Review log 3443
Show 1318 earlier messages
-
Dennis Purisevic uploaded patch set 1 11/07/24, 10:57
-
core-ci voted on patch set 1 V +1 11/07/24, 11:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69178
-
Dennis Purisevic uploaded patch set 2
V +111/07/24, 18:39 -
core-ci voted on patch set 2 V +1 11/07/24, 18:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69200
-
Oli Bartsch commented on patch set 2 11/08/24, 08:15
Hi, thanks a lot for your patch! I've also worked on this issue, see https://review.typo3.org/c/Packages/TYPO3.CMS/+/86914. However, I think your patch is way better and therefore abandoned mine. I already tested yours and it works quite well. There is however a place not covered yet. The site settings module also allows to choose a color, we should therefore also add the preview to this component: https://github.com/TYPO3/typo3/blob/main/Build/Sources/TypeScript/backend/settings/type/color.ts. -
Dennis Purisevic uploaded patch set 3
V +111/08/24, 09:38 -
core-ci voted on patch set 3 V +1 11/08/24, 09:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69225
-
Dennis Purisevic commented on patch set 3 11/08/24, 10:29
Reply
Hey, thanks for your feedback. I saw your patch as well and optimized my code accordingly. I’ve adjusted the Site Settings module, and it should be working now. Thanks for pointing it out! -
Oli Bartsch commented on patch set 3 CR +1 V +1 11/08/24, 10:44
Reply
Thanks for the fast adjustments. Works good! -
Simon Schaufelberger commented on patch set 3 11/08/24, 10:50
ConstantEditorFields.html:174'color' in quotes as it is not a variable, or? -
Benjamin Franzke commented on patch set 3 CR -1 11/08/24, 10:51
color.ts:42This removes the handler that updates the form-value. That means updates will not be stored. Important info: `ColorTypeElement` provides the value to the settings form and therefore needs to sync from the underlying input element. -
Oli Bartsch commented on patch set 3 CR 0 V -1 11/08/24, 10:52
Reply
Unfortunately I found a bug. Initially and on fields without a value the preview now renders a black color preview instead of the "transparent". -
Dennis Purisevic uploaded patch set 4
CR -1V +111/08/24, 17:28 -
Dennis Purisevic commented on patch set 4 11/08/24, 17:34
Reply
Found the bug and made an update to that. Now if the field is empty the preview is always "transparent".color.ts:42ReplyChecked it and made an update. Should now work as intended.ConstantEditorFields.html:174ReplyChecked with the documentation and current implementation of <f:if> and you are right. I've made adjustments to the line. -
core-ci voted on patch set 4 V -1 11/08/24, 17:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69237
-
Dennis Purisevic uploaded patch set 5
V -111/08/24, 20:28 -
core-ci voted on patch set 5 V +1 11/08/24, 20:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69238
-
Simon Schaufelberger commented on patch set 5 11/08/24, 21:19
color-preview.ts:16this is not TYPO3 code style. Please close the comment with just one asteriskcolor-preview.ts:31this is not TYPO3 code style. Please close the comment with just one asterisk
-
Dennis Purisevic uploaded patch set 6
V +111/08/24, 22:01 -
Dennis Purisevic commented on patch set 6 11/08/24, 22:01
color-preview.ts:16ReplyDonecolor-preview.ts:31ReplyDone -
core-ci voted on patch set 6 V +1 11/08/24, 22:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69239
-
Oli Bartsch uploaded patch set 7
V +111/09/24, 09:54 -
Oli Bartsch voted on patch set 7 CR +1 V +1 11/09/24, 09:55
-
core-ci voted on patch set 7 V +1 11/09/24, 10:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69253
-
Garvin Hicking commented on patch set 7 V +1 11/11/24, 09:22
Works quite well, this is a great enhancement, thanks! With the current code we have a bit of redundancy due to https://review.typo3.org/c/Packages/TYPO3.CMS/+/86914/7/typo3/sysext/backend/Classes/Form/Element/ColorElement.php#99 and https://review.typo3.org/c/Packages/TYPO3.CMS/+/86914/7/typo3/sysext/tstemplate/Resources/Private/Partials/ConstantEditorFields.html#174 basically doing the same like the JS counterpart https://review.typo3.org/c/Packages/TYPO3.CMS/+/86914/7/Build/Sources/TypeScript/backend/form-engine/element/extra/color-preview.ts#21 Since I'm not too deep into the webcomponents/JS and how it best suits Formengine, I guess it needs to be like this? -
Benjamin Franzke commented on patch set 7 CR -1 11/11/24, 09:29
color.ts:18I don't want settings to import from form-engine code. I'd rather keep them separate. Will move color-preview into color-picker. -
Benjamin Franzke uploaded patch set 8
CR +1V +111/11/24, 09:34 -
Benjamin Franzke commented on patch set 8 11/11/24, 09:34
color.ts:18ReplyDone -
Oli Bartsch voted on patch set 8 CR +1 V +1 11/11/24, 09:43
-
core-ci voted on patch set 8 V +1 11/11/24, 09:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69295
-
Andreas Kienast commented on patch set 8 V -1 11/11/24, 10:00
_input-group.scss:47This breaks with right-to-left backends. -
Benjamin Franzke commented on patch set 8 11/11/24, 10:01
Sorry, we need to polish this a bit. found some issues_colorpicker.scss:438t3js is not to be used for styling_form-group.scss:7Should be defined for `.form-control` (and not use t3js)_input-group.scss:44Should detect input-groups (or try to avoid those workarounds) instead of hardcoding cases.color-picker.ts:33This should ideally be server rendered as a markup-contract, and for site settings rendered via the color-type settings component. (Or we transform color-picker into a web component with a stable API) -
Oli Bartsch voted on patch set 8 CR 0 V 0 11/11/24, 10:03
-
Dennis Purisevic commented on patch set 8 11/11/24, 11:15
_colorpicker.scss:438ReplyWould just ".colorpicker-preview-color" be better and ".t3js-colorpicker-preview-color" just for js?_form-group.scss:7ReplyAcknowledged_input-group.scss:44ReplyAcknowledged_input-group.scss:47ReplyAcknowledgedcolor-picker.ts:33ReplyI think a web component would be good. It could remove some of the duplicate code in https://github.com/TYPO3/typo3/blob/main/Build/Sources/TypeScript/backend/settings/type/color.ts and https://github.com/TYPO3/typo3/blob/main/Build/Sources/TypeScript/backend/color-picker.ts and would streamline the overall usage of the color input. I will take a look into that later today. -
Dennis Purisevic uploaded patch set 9
V +111/12/24, 07:49 -
core-ci voted on patch set 9 V +1 11/12/24, 07:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69346
-
Dennis Purisevic commented on patch set 9 11/13/24, 10:53
_colorpicker.scss:438ReplyDonecolor-picker.ts:33ReplyDone -
Garvin Hicking commented on patch set 9 V +1 12/09/24, 12:56
Seems to work for me in current state, sadly I can't comment too much on the JS-side of things. I would guess instead of: ``` <typo3-backend-color-picker> <input type="text" id=${this.formid} class="form-control" ... </typo3-backend-color-picker> ``` it should probably rather be used like this: ``` <typo3-backend-color-picker type="text" id=${this.formid} class="form-control" ... </typo3-backend-color-picker> ``` so that the webcomponent takes care of emitting the input element? Not sure what in the DOM then could possibly break or be inaccessible. -
Oli Bartsch voted on patch set 9 CR +1 V +1 12/16/24, 08:50
-
Garvin Hicking commented on patch set 9 CR +1 12/16/24, 09:34
(After some talk with Oli about this I agree we -
Oli Bartsch commented on patch set 9 CR +2 V +2 12/16/24, 09:52
@dennispurisevic@gmail.com Thank you really much for this bugfix! -
Oli Bartsch merged patch set 10 12/16/24, 09:52
-
Nikita Hovratov commented on patch set 10 01/16/25, 15:15
This patch was breaking for consumers of @typo3/backend/color-picker module. See Mask extension e.g.: https://github.com/Gernott/mask/issues/660