Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#27185 closed defect (bug) (fixed)

[[gallery]] not supported by editor

Reported by: wpweaver's profile wpweaver Owned by:
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.8.1
Component: TinyMCE Keywords: has-patch
Focuses: javascript, administration Cc:

Description (last modified by ocean90)

Unlike other shortcode descriptions included in a page/post using the [[shortcode]] double [[ ... ]] convention to enable displaying the shortcode name in a post instead of the results, [[gallery]] does not work. The editor insists on detecting [[gallery]] as a reference to the gallery for the special display treatment. This makes it nearly impossible to write a post about the gallery shortcode.

I have not checked, but this may apply to other special case shortcodes (like images inserted via shortcodes from the media library), but it could be a general failure of TinyMCE to follow the [[shortcode]] convention for shortcodes that get special treatment by the editor.

Sorry about the issues with using [[ and ]] - I couldn't find any way to escape the square brackets correctly.

Attachments (2)

27185.patch (728 bytes) - added by ocean90 11 years ago.
27185.2.patch (2.2 KB) - added by ocean90 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @Clorith
11 years ago

  • Component changed from General to TinyMCE
  • Focuses javascript administration added

This seems to be related to TinyMCE, as the initial save does not trigger the shortcode, but consecutive saves of the post does make the gallery trigger (And the gallery gets a gallery display in TinyMCE on post reload as well as added newlines to stop the secondary closing bracket from being inline to prevent this)

#2 @ocean90
11 years ago

  • Description modified (diff)

Sorry about the issues with using [[ and ]] - I couldn't find any way to escape the square brackets correctly.

Fixed this by using the backtick `.

@ocean90
11 years ago

#3 @ocean90
11 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.9

27185.patch changes the RegEx to match an optional second opening and closing bracket. (Same as in get_shortcode_regex()). The callback checks if the match starts with [[. If true, just return the match, otherwise call the html callback.

We probably need the same for the video and audio shortcode.

@ocean90
11 years ago

#4 @ocean90
11 years ago

27185.2.patch copies the RegEx from wp.shortcodes to getShortcodeRegex() and uses it for the gallery, video and audio shortcode.

This ticket was mentioned in IRC in #wordpress-dev by ocean90. View the logs.


11 years ago

#6 @ocean90
11 years ago

The [gallery] shortcode is using wp.shortcode now ~ azaozz

See [27408]. So currently we only need this for video/audio/playlists?.

#7 @gcorne
11 years ago

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

With wpviews in place for gallery, audio, video, and playlist shortcodes, I think this is safe to close as fixed.

Note: See TracTickets for help on using tickets.