singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.54k stars 814 forks source link

Setting font color or background color causes an error when pressing Enter. #2261

Open lingyun000 opened 5 days ago

lingyun000 commented 5 days ago

Is there an existing issue for this?

Flutter Quill version

No response

Steps to reproduce

As mentioned in the title, pressing Enter after setting the color without entering any content will cause an error. Please check the video.

https://github.com/user-attachments/assets/67707e8c-f1ca-4d1e-bcc2-60f0cea3ccd7

Expected results

After pressing Enter multiple times, I hope to clear the formatting.

Actual results

Restarted application in 1,257ms.

════════ Exception caught by services library ══════════════════════════════════ The following assertion was thrown during method call TextInputClient.updateEditingState: It is not allowed to apply inline attributes to line itself. 'package:flutter_quill/src/document/nodes/line.dart': Failed assertion: line 140 pos 11: 'style.values.every((attr) => attr.scope == AttributeScope.block || attr.scope == AttributeScope.ignore)'

When the exception was thrown, this was the stack:

2 Line.retain (package:flutter_quill/src/document/nodes/line.dart:140:11)

3 QuillContainer.retain (package:flutter_quill/src/document/nodes/container.dart:162:17)

4 Document.compose (package:flutter_quill/src/document/document.dart:415:15)

5 QuillController.replaceText (package:flutter_quill/src/controller/quill_controller.dart:327:18)

6 RawEditorStateTextInputClientMixin.updateEditingValue (package:flutter_quill/src/editor/raw_editor/raw_editor_state_text_input_client_mixin.dart:241:25)

7 TextInput._updateEditingValue (package:flutter/src/services/text_input.dart:2067:43)

8 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1903:29)

9 TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1803:20)

10 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:571:55)

11 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:564:34)

12 _DefaultBinaryMessenger.setMessageHandler. (package:flutter/src/services/binding.dart:618:35)

13 _invoke2 (dart:ui/hooks.dart:344:13)

14 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)

15 _Channel.push (dart:ui/channel_buffers.dart:135:31)

16 ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17)

17 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:750:22)

18 _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)

(elided 2 frames from class _AssertionError)

call: MethodCall(TextInputClient.updateEditingState, [3, {selectionBase: 1, composingExtent: -1, selectionAffinity: TextAffinity.downstream, text:

, selectionIsDirectional: false, selectionExtent: 1, composingBase: -1}]) ════════════════════════════════════════════════════════════════════════════════

Additional Context

Screenshots / Video demonstration [Upload media here]
Logs ```console [Paste your logs here] ```
CatHood0 commented 5 days ago

Which version are you using of Flutter Quill? It seems like another issue that was fixed.

lingyun000 commented 5 days ago

V 10.7.3 ---- Replied Message ---- | From | @.> | | Date | 09/21/2024 23:24 | | To | singerdmx/flutter-quill @.> | | Cc | lingyun000 @.>, Author @.> | | Subject | Re: [singerdmx/flutter-quill] Setting font color or background color causes an error when pressing Enter. (Issue #2261) |

Which version are you using? It seems like another issue that was fixed.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

CatHood0 commented 5 days ago

V 10.7.3

Thanks for reporting it. When i have time i will take a look what could be happening.