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

[FR] Pasting url should paste a link and when there's a highlighted selection it should make it into a link #7214

Closed
chrisirhc opened this issue Jan 15, 2025 · 10 comments
Assignees
Labels
bug Something isn't working editor features related to the rich-text editor

Comments

@chrisirhc
Copy link

chrisirhc commented Jan 15, 2025

Description

This is a behaviour documented over at yzhang-gh/vscode-markdown#20 .

Current behaviour on Mobile iOS

Pasting a link results in noop, nothing happens, nothing is pasted. Regardless of whether a selection is highlighted or not.

Expected behaviour

During a past of a URL:

  • If some text is highlighted, that text becomes a link pointing to the URL.
  • Else, paste the URL as text and make it into a link pointing to that URL.

Impact

  • Easier to add links into a document (down from 4 taps on a mobile, to 1 paste action)

Additional Context

No response

@LucasXu0 LucasXu0 added bug Something isn't working editor features related to the rich-text editor labels Jan 15, 2025
@LucasXu0
Copy link
Collaborator

Hi @chrisirhc, we support making the selected text into a link format when there is a highlighted selection. If it's not working on your end, there might be an issue. Could you tell me your iOS system version?

ScreenRecording_01-15-2025.12-46-32_1.mov

@chrisirhc
Copy link
Author

chrisirhc commented Jan 15, 2025

Ah, tested it a bit more and found that I saw a few issues I'm facing:

  • Safari's (or GitHub) Share button -> Copy copies a rich text link that results in noop in the Appflowy when pasting. Workaround: tap in the address bar to copy and paste
  • Non-http protocol urls aren't recognized (e.g. bear://x-callback-url/open-note?... ) and so none of the paste functionality works (highlighted selection or not all no-op)
  • When I do copy and paste http url, a system asks whether to "Allow a Paste from Safari". If I click Allow, nothing happens. However, subsequent pastes work.

I'm on iOS 18.2 .

Recording with behavior of GitHub:
https://github.com/user-attachments/assets/f5b05311-d5ad-4b50-9309-df5716cc2079

@asjqkkkk
Copy link
Collaborator

473_1737194797.mp4

I have found a stable way to reproduce it, it can be reproduced simply by pasting from the clipboard of the input method

@Craigp23
Copy link

Is this a related issue...?

Since v0.80 on android, urls are no longer being converted to links. Tried top and tailing the url with markdown ie. [ ]

@chrisirhc
Copy link
Author

chrisirhc commented Jan 24, 2025

Created 2 PRs to demonstrate the issues and potential fixes. The fixes are ugly/hacky because I'm a flutter newbie. They're mainly to illustrate the issue.

  • Safari's (or GitHub) Share button -> Copy copies a rich text link that results in noop in the Appflowy when pasting. Workaround: tap in the address bar to copy and paste

#7280

  • Non-http protocol urls aren't recognized (e.g. bear://x-callback-url/open-note?... ) and so none of the paste functionality works (highlighted selection or not all no-op)

This is due to the following regex only checking for urls that begin with http:
https://github.com/AppFlowy-IO/appflowy-editor/blob/d24a7fc2c3cbb988b4f8e6a0d972bfb5091e2323/lib/src/service/internal_key_event_handlers/copy_paste_handler.dart#L6

  • When I do copy and paste http url, a system asks whether to "Allow a Paste from Safari". If I click Allow, nothing happens. However, subsequent pastes work.

AppFlowy-IO/appflowy-editor#1027

Happy to update the fixes based on review suggestions if I receive any review feedback.

@asjqkkkk
Copy link
Collaborator

Hi @chrisirhc , Have you had any issues pasting HTTP links on mobile? Such as https://github.com/, or perhaps only links that don't start with HTTP cause the issue? Such as bear://x-callback-url/open-note

@chrisirhc
Copy link
Author

Hi @chrisirhc , Have you had any issues pasting HTTP links on mobile? Such as https://github.com/, or perhaps only links that don't start with HTTP cause the issue? Such as bear://x-callback-url/open-note

Yes, I'm seeing issues whenever there's the permission screen to allow paste from the application. See AppFlowy-IO/appflowy-editor#1027 .

I'm also seeing issues whenever pasting what's copied from the Share button. See #7280 .

@asjqkkkk
Copy link
Collaborator

Hi @chrisirhc , Have you had any issues pasting HTTP links on mobile? Such as https://github.com/, or perhaps only links that don't start with HTTP cause the issue? Such as bear://x-callback-url/open-note

Yes, I'm seeing issues whenever there's the permission screen to allow paste from the application. See AppFlowy-IO/appflowy-editor#1027 .

I'm also seeing issues whenever pasting what's copied from the Share button. See #7280 .

Thank you, there might indeed be a permission issue currently. As for whether links that don't start with HTTP can be pasted as links, we may need to double-check the specifications for links

@chrisirhc
Copy link
Author

chrisirhc commented Jan 24, 2025

Thank you, there might indeed be a permission issue currently.

Links that don't start with HTTP can be pasted as links. There's no permission issue for that.
The permission dialog I'm referring to is in AppFlowy-IO/appflowy-editor#1027 .

As for whether links that don't start with HTTP can be pasted as links, we may need to double-check the specifications for links

They can be, you can test this behaviour today by creating a link manually and using a non-http url works fine. I have clicked on it and it navigates to the other app as expected.

Update: I'll split up the bug reports, since they're 3 distinct issues with separate reproduction steps.

@chrisirhc
Copy link
Author

chrisirhc commented Jan 25, 2025

I created 2 bug reports:

I didn't create a bug for non-http protocol urls because I can see potential security concerns and also because there is a workaround (via manually pasting into link text field).

@chrisirhc chrisirhc closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working editor features related to the rich-text editor
Projects
None yet
Development

No branches or pull requests

4 participants