Browse Source

fix: update the selection after render completed

Lucas.Xu 2 years ago
parent
commit
90fa1312f2

+ 1 - 3
frontend/app_flowy/packages/flowy_editor/lib/editor_state.dart

@@ -60,10 +60,8 @@ class EditorState {
     for (final op in transaction.operations) {
       _applyOperation(op);
     }
-    // updateCursorSelection(transaction.afterSelection);
 
-    // FIXME: don't use delay
-    Future.delayed(const Duration(milliseconds: 16), () {
+    WidgetsBinding.instance.addPostFrameCallback((_) {
       updateCursorSelection(transaction.afterSelection);
     });
 

+ 0 - 2
frontend/app_flowy/packages/flowy_editor/lib/service/internal_key_event_handlers/slash_handler.dart

@@ -153,8 +153,6 @@ class _PopupListWidgetState extends State<PopupListWidget> {
 
   @override
   Widget build(BuildContext context) {
-    // TODO: Is there a better way to get focus?
-
     return Focus(
       focusNode: focusNode,
       onKey: _onKey,