Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Paste as plain text" feature #1946

Open
1 task done
Alspb opened this issue Jun 23, 2024 · 3 comments
Open
1 task done

Add "Paste as plain text" feature #1946

Alspb opened this issue Jun 23, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Alspb
Copy link
Contributor

Alspb commented Jun 23, 2024

Is there an existing issue for this?

Use case

It would be great to have "Paste as plain text" feature, as e.g. TextField on Android has.
Sometimes format is not needed, like when text is copied from browser.
Also, this should help avoid misunderstanding on when formatted or plain text is pasted, see #1772.

Proposal

Implement "Paste as plain text" feature and add it to the context menu for pasting. Maybe there should be an option on whether "Paste as plain text" should be included into that menu or not.

@Alspb Alspb added the enhancement New feature or request label Jun 23, 2024
@Alspb
Copy link
Contributor Author

Alspb commented Jun 23, 2024

It looks like to paste plain text one should disable the following code blocks from quill_controller.dart:

if (await _pasteHTML()) {
    updateEditor?.call();
    return true;
}
_applyPasteStyleAndEmbed(insertedText, index, containsEmbed);

But adding "Paste as plain text" to the context menu is not that straightforward, since the menu is implemented using EditableText.getEditableButtonItems.

@singerdmx
Copy link
Owner

@ellet0 Do you have any suggestion?

@ellet0
Copy link
Collaborator

ellet0 commented Jun 26, 2024

If the user paste using the paste button above the keyboard, it should alwats paste as text. This behavior is specific to Android and will apply to all apps. As for the paste as plain text, we could also add the option to always paste as plain text and disable rich text pasting feature.

Notice that if you don't use flutter_quill_extensions, it will be displayed by default.

As for paste as plain text, it's might not be common or known by users, I would suggest having this option only if rich text paste is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants