WordPress.org

Make WordPress Core

#36211 closed enhancement (fixed)

TinyMCE: allow pasting in image captions

Reported by: azaozz Owned by: azaozz
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords: has-patch needs-testing
Focuses: Cc:

Description

Currently when trying to paste in an image caption, the pasted content is moved under the caption. This is to prevent inserting block elements, other images, audio or video in the caption and not "block" the user from being able to paste (as that looks like an editor error).

Better behaviour would be if we allow pasting of text and inline tags in the caption, and move images and media files below.

Attachments (2)

36211.patch (2.9 KB) - added by azaozz 19 months ago.
36211.2.patch (2.9 KB) - added by azaozz 12 months ago.

Download all attachments as: .zip

Change History (19)

@azaozz
19 months ago

#1 @azaozz
19 months ago

In 36211.patch:

  • Replace block elements with <br> when pasting in a caption element.
  • If the pasted HTML contains image, audio or video, move the paste under the caption like before.
Last edited 19 months ago by azaozz (previous) (diff)

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


12 months ago

#3 @iseulde
12 months ago

  • Keywords has-patch needs-testing added
  • Type changed from defect (bug) to enhancement

This sounds good! Would need some tests.

@azaozz
12 months ago

#4 @azaozz
12 months ago

In 36211.2.patch:

  • When pasting in the caption element (<dd class="wp-caption-dd">), remove blocks and insert <br> instead. Also other elements that are going to break the caption. Then let the paste go through.
  • "Trim" BRs and remove more than one constitutive BRs.

#5 @azaozz
12 months ago

Going to commit 36211.2.patch to make it easier for testing. We still may need to tweak it a bit, but seems it behaves properly in most cases.

#6 @azaozz
12 months ago

  • Milestone changed from Future Release to 4.7

#7 @azaozz
12 months ago

In 38756:

TinyMCE: Allow pasting in image captions. Remove blocks and insert <br> tags instead, also remove elements that would break the caption like other images, video, audio, etc.

See #36211.

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


12 months ago

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


12 months ago

#10 @jorbin
12 months ago

  • Owner set to azaozz
  • Status changed from new to assigned

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


11 months ago

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


11 months ago

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


11 months ago

#14 @Clorith
11 months ago

When pasting paragraphed content, we only introduce a single newline, we might want to do a "reverse wpautop" and get two <br>'s introduced if there's more than one paragraph in the paste, to represent the copied content more clearly.

Pasting in an image URL, are we able to drop the auto-<img> tag generation? If I paste an image URL in a caption it is with the presumption that I am linking to an original source for the image, and not that I want another image there instead (others mileage may vary, I'm not sure how others would think here, presumptions on peoples workflows are a rocky path to take, but that was my initial impression with that behavior).

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


11 months ago

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


11 months ago

#17 @azaozz
11 months ago

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

Lets close this and handle bugs in new tickets.

Note: See TracTickets for help on using tickets.