Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#21817 closed task (blessed) (fixed)

Insert galleries into the text editor using the new media modal

Reported by: koopersmith's profile koopersmith Owned by: koopersmith's profile koopersmith
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Gallery Keywords:
Focuses: Cc:

Description

We have a new media modal at #21390, but it's not particularly useful unless it integrates into our existing UI. Let's make it work for inserting galleries into the text editor.

For correctly ordering the attachments in the gallery, we'll need the gallery shortcode improvements from #21816.

Change History (7)

#1 @koopersmith
12 years ago

  • Component changed from General to Media
  • Milestone changed from Awaiting Review to 3.5
  • Type changed from defect (bug) to task (blessed)
  • Version set to trunk

#2 @sabreuse
12 years ago

  • Cc sabreuse added

#3 @nacin
12 years ago

  • Component changed from Media to Gallery
  • Owner set to koopersmith
  • Status changed from new to assigned

#4 @koopersmith
12 years ago

In [22120]:

Use the new media modal to insert galleries into TinyMCE and the text editor.

Galleries

  • Gallery insertion from the new media modal (into TinyMCE, the text editor, etc).
  • Gallery previews in TinyMCE now use the wp.mce.views API.
  • Disables the TinyMCE wpgallery plugin.
  • Gallery previews consist of the first image of the gallery and the appearance of a stack. This will later be fleshed out to include more images/functionality (including editing the gallery, gallery properties, and showing the number of images in the gallery).
  • Multiple galleries can be added to a single post.
  • The gallery MCE view provides a bridge between the wp.shortcode and Attachments representation of a gallery, which allows the existing collection to persist when a gallery is initially created (preventing a request to the server for the query).

Shortcodes

  • Renames wp.shortcode.Match to wp.shortcode to better expose the shortcode constructor.
  • The wp.shortcode constructor now accepts an object of options instead of a wp.shortcode.regexp() match.
  • A wp.shortcode instance can be created from a wp.shortcode.regexp() match by calling wp.shortcode.fromMatch( match ).
  • Adds wp.shortcode.string(), which takes a set of shortcode parameters and converts them into a string.* Renames wp.shortcode.prototype.text() to wp.shortcode.prototype.string().
  • Adds an additional capture group to wp.shortcode.regexp() that records whether or not the shortcode has a closing tag. This allows us to improve the accuracy of the syntax used when transforming a shortcode object back into a string.

Media Models

  • Prevents media Query models from observing the central Attachments.all object when query args without corresponding filters are set (otherwise, queries quickly amass false positives).
  • Adds post__in, post__not_in, and post_parent as acceptable JS attachment Query args.
  • Attachments.more() always returns a $.promise object.

see #21390, #21809, #21812, #21815, #21817.

#5 @pavelevap
12 years ago

  • Cc pavelevap@… added

Is there any chance to filter inserted HTML or shortcode? I do not want to insert exact HTML for selected image, but for example my own shortcode [wpimage id="X"]?

#6 @nacin
12 years ago

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

#7 @SergeyBiryukov
12 years ago

#20426 was marked as a duplicate.

Note: See TracTickets for help on using tickets.