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

Paste into editor (from external editor like Word or Google Docs) behaves differently on android and iphone. Iphone not useable.

Open taylor-hutyra opened this issue 10 months ago • 9 comments

Have you checked for an existing issue?

Flutter Quill Version

10.8.5

Steps to Reproduce

This is my first github bug report so please excuse me for bad formatting.

I use The quill editor for some notes storage in my app. Some of my users want to copy and paste from a Word document or other resource that they already had notes in. However, pasting on android loses some formatting (it's ok though, it looks mostly ok) while pasting on iphone leaves an invisible wall of text where some symbols used for bullets are still visible.

Here is my code for the editor.

import 'package:flutter_quill/flutter_quill.dart' as quill;
....
....
....
quill.QuillEditor.basic(
                controller: _controller,
                focusNode: editorFocusNode,
                configurations: quill.QuillEditorConfigurations(
                  autoFocus: false,
                  placeholder: 'Your notes here...',
                ),
              )

I'm using the focus node and auto focus to drop the keyboard on certain events, but other than that, it's pretty basic.

i have tried using extensions and the native_bridge packages but neither changed anything. I saw many adjacent issues but none just talking about this.

Expected results

Expect pasting text from external resources (word, google doc, etc) to be visible (and preferably formatted reasonably similar).

Actual results

There is no visible text on paste.

Additional Context

This is copy and paste from a word document with no extra functionality other than bullets, bold, italicize and maybe an emoji.

Image Image

taylor-hutyra avatar Jan 28 '25 00:01 taylor-hutyra

I added the text color button into the tool bar and so far what I'm seeing is that on iOS only, when I copy and paste in text from Word, it automatically applies a FF000000 color that is clear.

taylor-hutyra avatar Jan 29 '25 17:01 taylor-hutyra

Digging into this a little more, it seems that the way editors handle copying is interesting.

Both Word and Google docs, in their editor apps, did this (whether in print preview or not). However, if I exported as PDF opened the PDF and copy/pasted from there it copied over just fine.

I'm not an expert with this kind of thing, but am looking into some information about what goes to the clipboard from within editor apps.

taylor-hutyra avatar Jan 30 '25 16:01 taylor-hutyra

10.8.5

In v11 (pre-release), we have added enableRichTextPaste. We're considering disable the rich text paste feature by default as a breaking change.

This is my first github bug report

Looks pretty good for a first bug report.

Expect pasting text from external resources (word, google doc, etc) to be visible (and preferably formatted reasonably similar).

It can't be the same, this feature is platform-specific and retrieves the HTML from the system clipboard then paste it by converting it to Delta. We can improve it by having logic specifically for converting the HTML to Delta.

EchoEllet avatar Jan 31 '25 13:01 EchoEllet

Ok i see. So is it safe to say it is currently trying to convert the rich text in the clipboard to something plain text-like? From my search of similar issues, I did read that Android seems to bundle/provide a Plain Text paste functionality automatically (which would explain why the Android paste is currently useable, but not quite properly formatted).

It is still an interesting result to see on iOS that it would paste with FF000000 colors instead of the default theme colors or the editor/controller configuration colors. I guess that wouldn't help if the iOS paste if being squished into one giant unformatted text blob.

I will await the rich text paste implementation in v11 and encourage users to not paste notes from another platform yet.

Thank you for your response.

taylor-hutyra avatar Jan 31 '25 19:01 taylor-hutyra

rich text paste implementation in v11

Unfortunately, we don't expect any improvements unless we write specific logic for converting the HTML which is not a priority yet, we will disable the rich text paste by default for now.

EchoEllet avatar Jan 31 '25 20:01 EchoEllet

Oh sorry, I misunderstood. I will continue looking into some manual implementations.

Thank you.

taylor-hutyra avatar Jan 31 '25 23:01 taylor-hutyra

I'll take a look about HTML to Delta. Can you show me the HTML pasted? If the HTML does not have any color modification, then, we need to check other parts to see what can be happening.

CatHood0 avatar Feb 21 '25 05:02 CatHood0

Hi, sorry I missed this. I will do this first thing tomorrow.

taylor-hutyra avatar Feb 24 '25 03:02 taylor-hutyra

My development iPhone is out of commission, so I don't have a way to validate this anymore. However, it wasn't anything special. Regular text from the Word app and Google Docs. Both of them were being pasted as a transparent text all mashed together.

Do you know of a way I can get at the HTML in the clipboard on iOS? I can have one of my beta testers help me get that for you.

taylor-hutyra avatar Mar 04 '25 18:03 taylor-hutyra