Skip to content

Inserting Chinese text after an image converts the image to 'obj' #2503

Open
@mchangtian

Description

@mchangtian

Have you checked for an existing issue?

Flutter Quill Version

11.0.0

Steps to Reproduce

When inserting Chinese text using an IME (Input Method Editor) after an embedded image in flutter_quill, the image gets converted to a plain "obj" string. This does NOT occur when typing English text after the image.

Environment

flutter_quill: 11.0.0
Device: windows 11
Input Method: Sogou Pinyin IME

Image
Additional Notes from Reporter

I've attempted a potential fix by adjusting the cursor position calculation during IME composition. This modification appears to resolve the Chinese input issue specifically, but requires further validation:

lib/src/editor/raw_editor/raw_editor_state_text_input_client_mixin.dart:199
void updateEditingValue(TextEditingValue value)

    // modify by lonwan 2025年3月8日12:17:44 关键修正:动态计算光标位置, 解决输入中文时光标位置偏移问题
    final effectiveCursorPosition = value.isComposingRangeValid
        ? value.composing.end
        : value.selection.extentOffset;

    final diff = getDiff(oldText, text, effectiveCursorPosition);

Expected results

The embedded image should remain intact when inserting Chinese text after it, just like when inserting English text.

Actual results

Inserting Chinese text after an image converts the image to 'obj'

Image

Additional Context

Screenshots / Video demonstration

[Attach media here]

Logs
[Paste logs here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmoderateIssues that are important for improving functionality or user experience.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions