[@mantine/tiptap] RichTextEditor.ColorPicker: optional value/onChange props so it can drive things other than the text color mark #9226
jdamner
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
RichTextEditor.ColorPickeris hard-wired to thetextStylecolor mark: it readseditor.getAttributes('textStyle').colorand callssetColor/unsetColordirectly. I'm building an editor where colours apply to node attributes as well as text marks — a table's background, a callout's background — and I'd like the same palette-plus-picker popover for those. Today the only way is to copy the component.Would you take optional
value/onChange/onClearprops, defaulting to the current mark behaviour so nothing changes for existing users?Roughly:
const currentColor = value ?? editor?.getAttributes('textStyle').color ?? 'var(--mantine-color-text)', andhandleChange/handleClearcall the prop when one is given, otherwise run the existing chain.One wrinkle if you like the idea: the labels (
colorPickerControlLabel,colorPickerColorLabel) say "text color", which reads wrong on a background picker, so alabelprop would round it off.Happy to open a PR if you want it.
All reactions