flutter-quill icon indicating copy to clipboard operation
flutter-quill copied to clipboard

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

Open lingyun000 opened this issue 1 year ago • 3 comments

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
[Paste your logs here]

lingyun000 avatar Sep 21 '24 13:09 lingyun000

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

CatHood0 avatar Sep 21 '24 15:09 CatHood0

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: @.***>

lingyun000 avatar Sep 21 '24 15:09 lingyun000

V 10.7.3

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

CatHood0 avatar Sep 21 '24 15:09 CatHood0

The same thing. If I tap"enter" with an empty string, inside the library works method "retain" from the document\line.dart. Inside, you do the check for attributes. If some of them are "inline" you do assert.

ifuterman avatar Feb 26 '25 19:02 ifuterman

Please, can you update to the v11.0.0 and check if the issue persists?

CatHood0 avatar Feb 26 '25 20:02 CatHood0

It is a challenge. I tried to do it, but I have my custom toolbar, and it is real headache.

ifuterman avatar Feb 27 '25 05:02 ifuterman

There's not much i can do in this case. If the bug persists in the current version, i might be able to help you, but we can't do much when the bugs come from older versions than the ones we're supporting. I strongly recommend that you upgrade to the latest version of Flutter Quill and if this bug still persists, reopen this issue.

CatHood0 avatar Feb 28 '25 03:02 CatHood0