Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#36211 closed enhancement (fixed)

TinyMCE: allow pasting in image captions

Reported by: azaozz's profile azaozz Owned by: azaozz's profile 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 8 years ago.
36211.2.patch (2.9 KB) - added by azaozz 8 years ago.

Download all attachments as: .zip

Change History (19)

@azaozz
8 years ago

#1 @azaozz
8 years 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 8 years ago by azaozz (previous) (diff)

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


8 years ago

#3 @iseulde
8 years ago

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

This sounds good! Would need some tests.

@azaozz
8 years ago

#4 @azaozz
8 years 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
8 years 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
8 years ago

  • Milestone changed from Future Release to 4.7

#7 @azaozz
8 years 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.


8 years ago

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


8 years ago

#10 @jorbin
8 years ago

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

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


8 years ago

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


8 years ago

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


8 years ago

#14 @Clorith
8 years 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.


8 years ago

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


8 years ago

#17 @azaozz
8 years 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.