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

Autolink selected text on link paste #5656

Closed
jodator opened this issue Oct 24, 2019 · 2 comments · Fixed by #15134
Closed

Autolink selected text on link paste #5656

jodator opened this issue Oct 24, 2019 · 2 comments · Fixed by #15134
Labels
package:link squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@jodator
Copy link
Contributor

jodator commented Oct 24, 2019

📝 Provide a description of the new feature

We have the #4715 (auto-link feature) so this might duplicate in some sense.

While using Notion I've discovered one handy feature by accident:

  1. Select a text
  2. Paste link
  3. The selected text get a link added instead of being replaced by the pasted link text.

If you'd like to see this feature implemented, add a 👍 reaction to this post.

@jodator jodator added type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:link labels Oct 24, 2019
@Mgsy Mgsy added this to the backlog milestone Nov 4, 2019
@jodator jodator added release:potential-blocker This issue potentially blocks the upcoming release (should be checked). type:regression This issue reports a bug that was not present in the previous releases. and removed release:potential-blocker This issue potentially blocks the upcoming release (should be checked). type:regression This issue reports a bug that was not present in the previous releases. labels Sep 25, 2020
@mlewand mlewand added the squad:core Issue to be handled by the Core team. label Oct 26, 2020
@pomek pomek removed this from the backlog milestone Feb 21, 2022
@lslowikowska lslowikowska added the support:2 An issue reported by a commercially licensed client. label Oct 7, 2022
@scofalik scofalik added squad:collaboration Issue to be handled by the Collaboration team. and removed squad:core Issue to be handled by the Core team. labels Oct 10, 2022
@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Oct 10, 2022
@CKEditorBot CKEditorBot removed the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Oct 24, 2022
@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Nov 4, 2022
@scofalik
Copy link
Contributor

scofalik commented Nov 16, 2022

Business context:

  • If clipboard contains URL and text is selected inside the editor, after paste, we want to apply link on the selection instead of replacing the selection with the clipboard content.
  • If the selection includes more than one element, then we want to keep the earlier behavior (selection content is removed, clipboard content is inserted).
  • Images on links are nicely handled, so we can apply the same logic for images (pasting link over image adds link to the image).
  • We will handle just text and images. Tables or other widgets will work as earlier.
  • Clipboard must include link and only link.
  • If formatted link was copied (e.g. a link that had bold, etc.) then we also apply the described behavior.
  • If text selected in the editor already has a link, we still replace that link (in other words, it doesn't matter if selected text has a link, we still apply described behavior).

Technical notes:

  • When it comes to checking whether clipboard data is an URL, we have RegExps in Link plugin so we can look there.
  • Clipboard also "saves" plain text contents, in addition to HTML contents, so we don't need to strip formatting on our own (dataTransfer type -> text/plain).
  • The improvement should most probably land in Link plugin as clipboard should not know anything about links or other features.
  • This improvement should use LinkCommand and should be applied only if LinkCommand is enabled. This covers integration with multiple parts of the editor.

@CKEditorBot CKEditorBot removed the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Nov 20, 2022
@scofalik
Copy link
Contributor

Aaaand it appears that our friend @mlewand already prepared a plugin for this some time ago: https://github.com/mlewand/ckeditor5-paste-link

scofalik added a commit that referenced this issue Dec 1, 2023
Feature (link): Links can now be applied by pasting a URL on selected text. Closes #5656.
@CKEditorBot CKEditorBot added this to the iteration 69 milestone Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:link squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants