mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: implement revert text in toolbar service
This commit is contained in:
parent
9b6afcc5c9
commit
1ba15b321b
@ -17,12 +17,14 @@ ToolbarEventHandlers defaultToolbarEventHandlers = {
|
||||
'quote': (editorState) => formatQuote(editorState),
|
||||
'number_list': (editorState) {},
|
||||
'bulleted_list': (editorState) => formatBulletedList(editorState),
|
||||
'Text': (editorState) => formatText(editorState),
|
||||
'H1': (editorState) => formatHeading(editorState, StyleKey.h1),
|
||||
'H2': (editorState) => formatHeading(editorState, StyleKey.h2),
|
||||
'H3': (editorState) => formatHeading(editorState, StyleKey.h3),
|
||||
};
|
||||
|
||||
List<String> defaultListToolbarEventNames = [
|
||||
'Text',
|
||||
'H1',
|
||||
'H2',
|
||||
'H3',
|
||||
|
@ -5,6 +5,10 @@ import 'package:flowy_editor/extensions/text_node_extensions.dart';
|
||||
import 'package:flowy_editor/operation/transaction_builder.dart';
|
||||
import 'package:flowy_editor/render/rich_text/rich_text_style.dart';
|
||||
|
||||
void formatText(EditorState editorState) {
|
||||
formatTextNodes(editorState, {});
|
||||
}
|
||||
|
||||
void formatHeading(EditorState editorState, String heading) {
|
||||
formatTextNodes(editorState, {
|
||||
StyleKey.subtype: StyleKey.heading,
|
||||
|
Loading…
Reference in New Issue
Block a user