System Information
- Strapi Version: 3.5.4
- Operating System:
- Database:
- Node Version:
- NPM Version:
- Yarn Version:
I’m find this tutorial : " How to create a Color Picker plugin for Strapi CMS" and try to repeat it
In tutorial new ColorPicker type was created and then it used in Strapi.
Short descripton:
- create plugin
- call
strapi.registerField({ type: "colorpicker", Component: ColorPicker });
-
in component ColorPicker you must support value and onChange props.
onChange function send to Strapi result of editing -
In model collection specify additional field like:
for example in file:
api/testfld/models/testfld.settings.json
add to attributes new field type and specify standart database type:
"color": {
"type": "colorpicker",
"columnType": "string"
}
Result: I see and can change values of colorpicker type in content manager, and after save - I can see my color value in database.
Problem : after I’m save data in edit form, return to Tesflds list and click record to edit - initial value don’t pass to custom field.
Let’s see: I’m made two custom field:
strapi.registerField({ type: “colorpicker”, Component: ColorPicker });
strapi.registerField({ type: “bool”, Component: Toggle });
One - replace standart bool type, second - colorpicker type.
In component I’m write props.value to console.log
In picture - you can see that bool component recieved inititial value prop - but colorpicker don’t recieve initial value prop and that’s why editing of colorpicker is imposiible - but after edit - it save it’s value to database.
How is possible to pass value, readed from database to custom field component ?
5 month ago Paul can run it - bu I’m can’t.
My github is: