WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#31571 closed enhancement (fixed)

If you select text, and paste a URL from the clipboard, auto-link the selected text rather than replace it with the URL

Reported by: matt Owned by: azaozz
Milestone: 4.2 Priority: low
Severity: minor Version: 4.2
Component: TinyMCE Keywords: has-patch
Focuses: javascript Cc:

Description

The summary kind of says it, but I think this is a text editor interaction pattern I'm seeing more and more now that is pretty addictive once you use it, and makes a very common task much faster.

I think this would be a groovy enhancement to our WYSIWYG, but isn't urgent or a blocker for anything.

Attachments (4)

31571.patch (1.1 KB) - added by iseulde 3 years ago.
31571.2.patch (1.6 KB) - added by iseulde 3 years ago.
31571.3.patch (1.9 KB) - added by iseulde 3 years ago.
31571.4.patch (545 bytes) - added by iseulde 3 years ago.

Download all attachments as: .zip

Change History (18)

This ticket was mentioned in Slack in #core-editor by matt. View the logs.


3 years ago

@iseulde
3 years ago

#2 @iseulde
3 years ago

  • Keywords has-patch added

I like this idea. :)
Works for images too.

#3 @azaozz
3 years ago

  • Milestone changed from Awaiting Review to 4.2

31571.patch is looking good. Only thinking we should look at what exactly is selected and check that the selection is not inside a link already.

It is possible to select several paragraphs and turn them into a link, not sure we want that whit this method. Also, we (probably) want to support that when an image is selected, need to exclude placeholder images, etc.

#4 @iseulde
3 years ago

Also, we (probably) want to support that when an image is selected, need to exclude placeholder images, etc.

That's right, though we should probably prevent any commands for these, just like wpviews.

#5 @iseulde
3 years ago

Only thinking we should look at what exactly is selected and check that the selection is not inside a link already.

So if there's a link already, it should insert, not update? I think updating is fine. :)

@iseulde
3 years ago

#6 @iseulde
3 years ago

This will prevent the execution of any commands on a placeholder.

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


3 years ago

@iseulde
3 years ago

#8 @azaozz
3 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 31691:

TinyMCE: when pasting an URL over a selection, insert a link with the URL instead of replacing the selection with it. Props iseulde. Fixes #31571.

#9 @iseulde
3 years ago

  • Component changed from Editor to TinyMCE
  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

We can't ignore all commands. Toggling the toolbar is impossible now if a placeholder is selected. We'll probably need to handle this like the views.

@iseulde
3 years ago

#10 @iseulde
3 years ago

  • Keywords has-patch added; needs-patch removed

Played a bit with the formatter and data-mce-contenteditable="false", but there doesn't seem to be an easy way to ignore certain elements. So better to remove that part. After all placeholders could be linked before using the button.

#11 @iseulde
3 years ago

And again #29804 would make this better. :)

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


3 years ago

#13 @azaozz
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 31738:

TinyMCE: remove blocking of commands on placeholder images. Breaks some execCommand.
Props iseulde. Fixes #31571.

This ticket was mentioned in Slack in #core by johnbillion. View the logs.


3 years ago

Note: See TracTickets for help on using tickets.