Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24263 closed defect (bug) (invalid)

Revision view should display shortcodes the same as the visual editor

Reported by: ahoereth's profile a.hoereth Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Revisions Keywords: dev-feedback has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Follow up on ticket:24254:10:

The revision viewer changes to feel more like the visual editor with 3.6 . It no longer uses htmlspecialchars but wp_kses_post ([23506]). So it now displays images, links etc no longer just as code.

To be consistent the revisions view should also have the same behavior as the visual editor for [caption] and [gallery] shortcodes.

For [gallery] it is important changes are still being displayed if present. The shortcode is just replaced by a placeholder in the editor - not very meaningful for revisions. Or don't display it at all?

Attachments (3)

24263.patch (2.5 KB) - added by a.hoereth 11 years ago.
tinyMCE style caption-shortcode in revisions
24263.2.patch (1.1 KB) - added by a.hoereth 11 years ago.
Applying all shortcodes when rendering diffs
24263.3.patch (1.9 KB) - added by a.hoereth 11 years ago.
Applying selected shortcodes when rendering diffs

Download all attachments as: .zip

Change History (9)

@a.hoereth
11 years ago

tinyMCE style caption-shortcode in revisions

#1 follow-up: @a.hoereth
11 years ago

24263.patch is a rudimentary migration of the "do shortcode" function from editor_plugin.js to the revisions interface.

It displays the captions nicely, but only when nothing inside the caption shortcode changed in any of the compared revisions.

Todo: Caption should also be displayed visually when newly added or only caption text was changed..

Waiting for dev feedback before further investigating on this

Last edited 11 years ago by a.hoereth (previous) (diff)

#2 in reply to: ↑ 1 ; follow-up: @adamsilverstein
11 years ago

Replying to a.hoereth:

#24263 is a rudimentary migration of the "do shortcode" function from editor_plugin.js to the revisions interface.

It displays the captions nicely, but only when nothing inside the caption shortcode changed in any of the compared revisions.

Todo: Caption should also be displayed visually when newly added or only caption text was changed..

Waiting for dev feedback before further investigating on this

works, except this looks like old code, looking for the current code to include instead of reproduce

#3 in reply to: ↑ 2 @a.hoereth
11 years ago

Replying to adamsilverstein:

Replying to a.hoereth:

#24263 is a rudimentary migration of the "do shortcode" function from editor_plugin.js to the revisions interface.

It displays the captions nicely, but only when nothing inside the caption shortcode changed in any of the compared revisions.

Todo: Caption should also be displayed visually when newly added or only caption text was changed..

Waiting for dev feedback before further investigating on this

works, except this looks like old code, looking for the current code to include instead of reproduce

I think we could also make this happen on the server side. For the visual editor the flexibility of JS is needed, for revisions we can also do it using PHP with a regex and call to img_caption_shortcode.

@a.hoereth
11 years ago

Applying all shortcodes when rendering diffs

@a.hoereth
11 years ago

Applying selected shortcodes when rendering diffs

#4 @a.hoereth
11 years ago

  • Keywords has-patch added; needs-patch removed

24263.2.patch uses do_shortcode in addition to wp_kses_post. This could result in errors when plugins register shortcodes in admin, but not all required scripts etc.
24263.3.patch uses a custom array for defining which shortcodes should be applyed. The regex is copyied from wp-incudes/shortcodes.php:191ff.

#5 @SergeyBiryukov
11 years ago

  • Description modified (diff)

#6 @markjaquith
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Doing plain text diffs for now:


In [24192]:

Go back to plain text diffs between revisions instead of attempting partial rendering.

fixes #24254

Note: See TracTickets for help on using tickets.