visual-space / visual-editor

Rich text editor for Flutter based on Delta format (Quill fork)
MIT License
283 stars 44 forks source link

Document - Keyboard hotkey loses styling when restoring text #52

Closed adrian-moisa closed 7 months ago

adrian-moisa commented 2 years ago
      RawKeyboardListener(
        focusNode: FocusNode(),
        onKey: (event) {
          if (event.data.isControlPressed && event.character == 'b') {
            if (_controller!
                .getSelectionStyle()
                .attributes
                .keys
                .contains('bold')) {
              _controller!.formatSelection(
                AttributeM.clone(AttributeM.bold, null),
              );
            } else {
              _controller!.formatSelection(AttributeM.bold);
            }
          }
        },
        child: _editor(),
      ),