chore: format code

This commit is contained in:
Lucas.Xu 2022-07-29 15:36:17 +08:00
parent ed1dc8ccef
commit 966eea2179
2 changed files with 31 additions and 33 deletions

View File

@ -3,17 +3,6 @@
"type": "editor", "type": "editor",
"attributes": {}, "attributes": {},
"children": [ "children": [
{
"type": "text",
"delta": [
{
"insert": "Hello world"
}
],
"attributes": {
"subtype": "quote"
}
},
{ {
"type": "image", "type": "image",
"attributes": { "attributes": {

View File

@ -1,24 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flowy_editor/editor_state.dart';
import 'package:flowy_editor/render/editor/editor_entry.dart'; import 'package:flowy_editor/render/editor/editor_entry.dart';
import 'package:flowy_editor/render/rich_text/bulleted_list_text.dart';
import 'package:flowy_editor/render/rich_text/checkbox_text.dart'; import 'package:flowy_editor/render/rich_text/checkbox_text.dart';
import 'package:flowy_editor/render/rich_text/flowy_rich_text.dart'; import 'package:flowy_editor/render/rich_text/flowy_rich_text.dart';
import 'package:flowy_editor/render/selection/floating_shortcut_widget.dart';
import 'package:flowy_editor/service/input_service.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/enter_in_edge_of_text_node_handler.dart';
import 'package:flowy_editor/service/render_plugin_service.dart';
import 'package:flowy_editor/service/shortcut_service.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/arrow_keys_handler.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/delete_nodes_handler.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/delete_single_text_node_handler.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/shortcut_handler.dart';
import 'package:flowy_editor/service/keyboard_service.dart';
import 'package:flowy_editor/service/selection_service.dart';
import 'package:flowy_editor/editor_state.dart';
import 'package:flowy_editor/render/rich_text/bulleted_list_text.dart';
import 'package:flowy_editor/render/rich_text/heading_text.dart'; import 'package:flowy_editor/render/rich_text/heading_text.dart';
import 'package:flowy_editor/render/rich_text/number_list_text.dart'; import 'package:flowy_editor/render/rich_text/number_list_text.dart';
import 'package:flowy_editor/render/rich_text/quoted_text.dart'; import 'package:flowy_editor/render/rich_text/quoted_text.dart';
import 'package:flowy_editor/render/selection/floating_shortcut_widget.dart';
import 'package:flutter/material.dart'; import 'package:flowy_editor/service/input_service.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/arrow_keys_handler.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/delete_nodes_handler.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/delete_single_text_node_handler.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/enter_in_edge_of_text_node_handler.dart';
import 'package:flowy_editor/service/internal_key_event_handlers/shortcut_handler.dart';
import 'package:flowy_editor/service/keyboard_service.dart';
import 'package:flowy_editor/service/render_plugin_service.dart';
import 'package:flowy_editor/service/selection_service.dart';
import 'package:flowy_editor/service/shortcut_service.dart';
NodeWidgetBuilders defaultBuilders = { NodeWidgetBuilders defaultBuilders = {
'editor': EditorEntryWidgetBuilder(), 'editor': EditorEntryWidgetBuilder(),
@ -61,13 +61,14 @@ class _FlowyEditorState extends State<FlowyEditor> {
void initState() { void initState() {
super.initState(); super.initState();
editorState.service.renderPluginService = FlowyRenderPlugin( editorState.service.renderPluginService = _createRenderPlugin();
editorState: editorState, }
builders: {
...defaultBuilders, @override
...widget.customBuilders, void didUpdateWidget(covariant FlowyEditor oldWidget) {
}, super.didUpdateWidget(oldWidget);
);
editorState.service.renderPluginService = _createRenderPlugin();
} }
@override @override
@ -106,4 +107,12 @@ class _FlowyEditorState extends State<FlowyEditor> {
), ),
); );
} }
FlowyRenderPlugin _createRenderPlugin() => FlowyRenderPlugin(
editorState: editorState,
builders: {
...defaultBuilders,
...widget.customBuilders,
},
);
} }