Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#32616 closed defect (bug) (fixed)

HTML in Gallery Captions Not Rending in Visual Editor

Reported by: macmanx's profile macmanx Owned by: azaozz's profile azaozz
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.9
Component: TinyMCE Keywords: has-patch needs-testing
Focuses: javascript Cc:

Description

When a caption including HTML is added to a gallery image, the HTML is not rendered in the Visual editor and instead displays as plain text. See attached screenshot.

This is in contraction to regular image captions containing HTML which do render in the Visual editor.

Issue reproduced in WordPress 4.2.2 and 4.3-alpha-32724 with no plugins and the Twenty Fifteen theme.

Attachments (3)

Screen Shot 2015-06-11 at 11.47.30 AM.png (129.7 KB) - added by macmanx 10 years ago.
screenshot of issue
32616.patch (457 bytes) - added by polevaultweb 9 years ago.
32616.2.patch (1.7 KB) - added by iseulde 9 years ago.

Download all attachments as: .zip

Change History (15)

@macmanx
10 years ago

screenshot of issue

#1 @ocean90
10 years ago

#32669 was marked as a duplicate.

#2 @ocean90
10 years ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 3.9

#3 @iseulde
10 years ago

  • Component changed from Editor to TinyMCE

@polevaultweb
9 years ago

#4 @polevaultweb
9 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Patch added to use the triple mustache to not HTML escape the caption

#5 @iseulde
9 years ago

  • Summary changed from Gallery Captions Not Rending in Visual Editor to HTML in Gallery Captions Not Rending in Visual Editor

#6 @polevaultweb
9 years ago

It would be great to get this patch tested @iseulde, @ocean90 :) It still applies cleanly.

#7 @SergeyBiryukov
9 years ago

  • Milestone changed from Future Release to 4.4

#8 @SergeyBiryukov
9 years ago

Introduced in [27408].

I have a concern about unfiltered HTML, see comment:10:ticket:27574.

With 32616.patch, I was able to get a JS alert via the caption field. Single (non-gallery) image captions appear to handle this differently, could not trigger an alert there.

Last edited 9 years ago by SergeyBiryukov (previous) (diff)

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


9 years ago

#10 @SergeyBiryukov
9 years ago

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

Could you take a look?

@iseulde
9 years ago

#11 @iseulde
9 years ago

  • Owner changed from iseulde to azaozz
  • Status changed from assigned to reviewing

New patch, not sure if it's the best solution.

#12 @azaozz
9 years ago

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

In 35341:

TinyMCE:

  • Sanitize and render HTML in captions when showing a gallery preview (wpView).
  • Encode/escape HTML entered in the text field in the wpLink dialog.

Props iseulde, kraftbj, jnylen0, shawarkhan.
Fixes #32616.

Note: See TracTickets for help on using tickets.