appflowy-editor
appflowy-editor copied to clipboard
Where to find the list of available attributes?
I'm creating a simple custom toolbar. I'm not being able to find the right attributes to call editorState.toggleAttribute or it just doesn't work for attributes like quote.
The only ones I've found that are working are the ones inside AppFlowyRichTextKeys like AppFlowyRichTextKeys.bold. But whenever I use quote or quotes nothing happens.
What I want to achieve: quote a selected text based on a custom button event.
I was able to achieve it by:
onTap: () {
final editor = widget.editorState;
final selection = editor.selectionNotifier.value;
if (selection != null) {
final node = editor.getNodeAtPath(selection.start.path);
final isQuote = node != null && node.type == QuoteBlockKeys.type;
editor.formatNode(
selection,
(node) => node.copyWith(
type: isQuote ? ParagraphBlockKeys.type : QuoteBlockKeys.type,
attributes: {
ParagraphBlockKeys.delta: (node.delta ?? Delta()).toJson(),
},
),
);
}
}
Wondering why it's not in the docs project docs.