File size: 1,035 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import { ColorPickerField } from '@react-page/editor';
import { pluginFactories } from '@react-page/plugins-slate';
import React from 'react';
export default pluginFactories.createComponentPlugin<{
color: string;
}>({
addHoverButton: true, // whether to show it above the text when selected
addToolbarButton: true, // whether to show it in the bottom toolbar
type: 'SetColor', // a well defined string, this is kind of the id of the plugin
object: 'mark', // mark is like a span, other options are inline and block
icon: <span>Color</span>, // an icon to show
label: 'Set Color',
Component: 'span', // the component to render
getStyle: ({ color }) => ({ color }),
controls: {
// identical to custom cell plugins
type: 'autoform',
schema: {
type: 'object',
required: ['color'],
properties: {
color: {
uniforms: {
component: ColorPickerField,
},
default: 'rgba(0,0,255,1)',
type: 'string',
},
},
},
},
});
|