appflowy-editor icon indicating copy to clipboard operation
appflowy-editor copied to clipboard

[Bug] Incorrect calculation of skip value in moveVertical

Open Jei-sKappa opened this issue 1 year ago • 2 comments

Bug Description

When going up starting from a single line node to a multiline node the caret goes in the first line of the multiline node instead of the last. The reason is that the current calculation of the skip value does not take into account the editorStyle's global set in the AppFlowyEditor parameters. (Previously it uses only the padding of the node).

How to Reproduce

Press the up key in a single line node when above it there is a multiline node.

Expected Behavior

The caret should go in the last line of the multiline node.

Operating System

MacOS

AppFlowy Editor Version(s)

2.3.4 (ref: d9e6178859bab6de606f1750973691f144b67342)

Screenshots

No response

Additional Context

No response

Jei-sKappa avatar May 05 '24 15:05 Jei-sKappa

Hi, @Jei-sKappa. I can't reproduce the issue you mentioned on the latest main branch.

https://github.com/AppFlowy-IO/appflowy-editor/assets/11863087/51f3b2d2-628e-44f6-8b21-8f96451a0a32

LucasXu0 avatar May 06 '24 01:05 LucasXu0

Hi @LucasXu0 Sorry, I forgot to mention that you should add a little bit of padding in AppFlowyEditor.editorStyle. If you are running the example app. This is my updated _buildDesktopEditorStyle function:

  // showcase 1: customize the editor style.
  EditorStyle _buildDesktopEditorStyle() {
    return EditorStyle.desktop(
      cursorWidth: 2.0,
      cursorColor: Colors.blue,
      selectionColor: Colors.grey.shade300,
      textStyleConfiguration: TextStyleConfiguration(
        text: GoogleFonts.poppins(
          fontSize: 16,
          color: Colors.black,
        ),
        code: GoogleFonts.architectsDaughter(),
        bold: GoogleFonts.poppins(
          fontWeight: FontWeight.w500,
        ),
      ),
      padding: const EdgeInsets.symmetric(
        horizontal: 200.0,
        vertical: 2, // <-- Added vertical padding
      ),
    );
  }

If somehow with this update you still can't reproduce the bug try adding a little bit more vertical padding. Otherwise let me know and i'll record a short video showcasing the bug. Hope it helps!

Jei-sKappa avatar May 06 '24 06:05 Jei-sKappa