<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27005] trunk/src/wp-includes/js/media-editor.js: Add inline docs to each method of the namespaced objects in `media-editor.js`, explaining what each does.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27005">27005</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-01-22 18:37:08 +0000 (Wed, 22 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add inline docs to each method of the namespaced objects in `media-editor.js`, explaining what each does. Add inline docs to params as well.
See <a href="http://core.trac.wordpress.org/ticket/26870">#26870</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsmediaeditorjs">trunk/src/wp-includes/js/media-editor.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjsmediaeditorjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-editor.js (27004 => 27005)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-editor.js 2014-01-22 18:16:39 UTC (rev 27004)
+++ trunk/src/wp-includes/js/media-editor.js 2014-01-22 18:37:08 UTC (rev 27005)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> * attachment's type.
</span><span class="cx"> *
</span><span class="cx"> * @global wp.media.view.settings
</span><ins>+ * @global getUserSetting()
</ins><span class="cx"> *
</span><span class="cx"> * @param {Object} [props={}] Attachment details (align, link, size, etc).
</span><span class="cx"> * @param {Object} attachment The attachment object, media version of Post.
</span><span class="lines">@@ -97,9 +98,8 @@
</span><span class="cx">
</span><span class="cx"> return fallbacks( props );
</span><span class="cx"> },
</span><del>-
</del><span class="cx"> /**
</span><del>- * Create the markup for a link
</del><ins>+ * Create link markup that is suitable for passing to the editor
</ins><span class="cx"> *
</span><span class="cx"> * @global wp.html.string
</span><span class="cx"> *
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx"> return wp.html.string( options );
</span><span class="cx"> },
</span><span class="cx"> /**
</span><del>- * Create an Audio shortcode
</del><ins>+ * Create an Audio shortcode string that is suitable for passing to the editor
</ins><span class="cx"> *
</span><span class="cx"> * @param {Object} props Attachment details (align, link, size, etc).
</span><span class="cx"> * @param {Object} attachment The attachment object, media version of Post.
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx"> return wp.media.string._audioVideo( 'audio', props, attachment );
</span><span class="cx"> },
</span><span class="cx"> /**
</span><del>- * Create a Video shortcode
</del><ins>+ * Create a Video shortcode string that is suitable for passing to the editor
</ins><span class="cx"> *
</span><span class="cx"> * @param {Object} props Attachment details (align, link, size, etc).
</span><span class="cx"> * @param {Object} attachment The attachment object, media version of Post.
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx"> return wp.media.string._audioVideo( 'video', props, attachment );
</span><span class="cx"> },
</span><span class="cx"> /**
</span><del>- * Helper function to create a media shortcode
</del><ins>+ * Helper function to create a media shortcode string
</ins><span class="cx"> *
</span><span class="cx"> * @access private
</span><span class="cx"> *
</span><span class="lines">@@ -195,7 +195,8 @@
</span><span class="cx"> return html;
</span><span class="cx"> },
</span><span class="cx"> /**
</span><del>- * Create image markup, optionally with a link and/or wrapped in a caption shortcode
</del><ins>+ * Create image markup, optionally with a link and/or wrapped in a caption shortcode,
+ * that is suitable for passing to the editor
</ins><span class="cx"> *
</span><span class="cx"> * @global wp.html
</span><span class="cx"> * @global wp.shortcode
</span><span class="lines">@@ -287,7 +288,10 @@
</span><span class="cx">
</span><span class="cx"> return {
</span><span class="cx"> /**
</span><ins>+ * Default gallery properties
+ *
</ins><span class="cx"> * @global wp.media.view.settings
</span><ins>+ * @readonly
</ins><span class="cx"> */
</span><span class="cx"> defaults: {
</span><span class="cx"> order: 'ASC',
</span><span class="lines">@@ -300,11 +304,12 @@
</span><span class="cx"> size: 'thumbnail',
</span><span class="cx"> orderby: 'menu_order ID'
</span><span class="cx"> },
</span><del>-
</del><span class="cx"> /**
</span><ins>+ * Retrieve attachments based on the properties of the passed shortcode
+ *
</ins><span class="cx"> * @global wp.media.query
</span><span class="cx"> *
</span><del>- * @param {wp.shortcode} shortcode
</del><ins>+ * @param {wp.shortcode} shortcode An instance of wp.shortcode().
</ins><span class="cx"> * @returns {wp.media.model.Attachments} A Backbone.Collection containing
</span><span class="cx"> * the images belonging to a gallery. The 'gallery' prop is a Backbone.Model
</span><span class="cx"> * containing the 'props' for the gallery.
</span><span class="lines">@@ -363,7 +368,6 @@
</span><span class="cx"> query.gallery = new Backbone.Model( others );
</span><span class="cx"> return query;
</span><span class="cx"> },
</span><del>-
</del><span class="cx"> /**
</span><span class="cx"> * Triggered when clicking 'Insert Gallery' or 'Update Gallery'
</span><span class="cx"> *
</span><span class="lines">@@ -441,7 +445,8 @@
</span><span class="cx"> * @global wp.media.model.Selection
</span><span class="cx"> * @global wp.media.view.l10n
</span><span class="cx"> *
</span><del>- * @param {string} content
</del><ins>+ * @param {string} content Content that is searched for possible
+ * shortcode markup matching the passed tag name,
</ins><span class="cx"> * @returns {wp.media.view.MediaFrame.Select} A media workflow.
</span><span class="cx"> */
</span><span class="cx"> edit: function( content ) {
</span><span class="lines">@@ -514,7 +519,6 @@
</span><span class="cx"> get: function() {
</span><span class="cx"> return wp.media.view.settings.post.featuredImageId;
</span><span class="cx"> },
</span><del>-
</del><span class="cx"> /**
</span><span class="cx"> * Set the featured image id, save the post thumbnail data and
</span><span class="cx"> * set the HTML in the post meta box to the new featured image.
</span><span class="lines">@@ -522,7 +526,7 @@
</span><span class="cx"> * @global wp.media.view.settings
</span><span class="cx"> * @global wp.media.post
</span><span class="cx"> *
</span><del>- * @param {number} id
</del><ins>+ * @param {number} id The post ID of the featured image, or -1 to unset it.
</ins><span class="cx"> */
</span><span class="cx"> set: function( id ) {
</span><span class="cx"> var settings = wp.media.view.settings;
</span><span class="lines">@@ -571,21 +575,22 @@
</span><span class="cx"> return this._frame;
</span><span class="cx"> },
</span><span class="cx"> /**
</span><ins>+ * 'select' callback for Featured Image workflow, triggered when
+ * the 'Set Featured Image' button is clicked in the media modal.
+ *
</ins><span class="cx"> * @global wp.media.view.settings
</span><span class="cx"> *
</span><span class="cx"> * @this wp.media.controller.FeaturedImage
</span><span class="cx"> */
</span><span class="cx"> select: function() {
</span><del>- var settings = wp.media.view.settings,
- selection = this.get('selection').single();
</del><ins>+ var selection = this.get('selection').single();
</ins><span class="cx">
</span><del>- if ( ! settings.post.featuredImageId ) {
</del><ins>+ if ( ! wp.media.view.settings.post.featuredImageId ) {
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> wp.media.featuredImage.set( selection ? selection.id : -1 );
</span><span class="cx"> },
</span><del>-
</del><span class="cx"> /**
</span><span class="cx"> * Open the content media manager to the 'featured image' tab when
</span><span class="cx"> * the post thumbnail is clicked.
</span><span class="lines">@@ -615,11 +620,14 @@
</span><span class="cx"> */
</span><span class="cx"> wp.media.editor = {
</span><span class="cx"> /**
</span><ins>+ * Send content to the editor
+ *
</ins><span class="cx"> * @global tinymce
</span><span class="cx"> * @global QTags
</span><span class="cx"> * @global wpActiveEditor
</span><ins>+ * @global tb_remove() - Possibly overloaded by legacy plugins
</ins><span class="cx"> *
</span><del>- * @param {string} html
</del><ins>+ * @param {string} html Content to send to the editor
</ins><span class="cx"> */
</span><span class="cx"> insert: function( html ) {
</span><span class="cx"> var editor,
</span><span class="lines">@@ -661,6 +669,9 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Setup 'workflow' and add to the 'workflows' cache. 'open' can
+ * subsequently be called upon it.
+ *
</ins><span class="cx"> * @global wp.media.view.l10n
</span><span class="cx"> *
</span><span class="cx"> * @param {string} id A slug used to identify the workflow.
</span><span class="lines">@@ -753,14 +764,14 @@
</span><span class="cx"> workflow.setState( workflow.options.state );
</span><span class="cx"> return workflow;
</span><span class="cx"> },
</span><del>-
</del><span class="cx"> /**
</span><span class="cx"> * Determines the proper current workflow id
</span><span class="cx"> *
</span><span class="cx"> * @global wpActiveEditor
</span><span class="cx"> * @global tinymce
</span><span class="cx"> *
</span><del>- * @param {string} [id='']
</del><ins>+ * @param {string} [id=''] A slug used to identify the workflow.
+ *
</ins><span class="cx"> * @returns {wpActiveEditor|string|tinymce.activeEditor.id}
</span><span class="cx"> */
</span><span class="cx"> id: function( id ) {
</span><span class="lines">@@ -783,7 +794,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Return the workflow specified by id
</span><span class="cx"> *
</span><del>- * @param {string} id
</del><ins>+ * @param {string} id A slug used to identify the workflow.
</ins><span class="cx"> *
</span><span class="cx"> * @this wp.media.editor
</span><span class="cx"> *
</span><span class="lines">@@ -796,7 +807,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Remove the workflow represented by id from the workflow cache
</span><span class="cx"> *
</span><del>- * @param {string} id
</del><ins>+ * @param {string} id A slug used to identify the workflow.
</ins><span class="cx"> *
</span><span class="cx"> * @this wp.media.editor
</span><span class="cx"> */
</span><span class="lines">@@ -804,7 +815,9 @@
</span><span class="cx"> id = this.id( id );
</span><span class="cx"> delete workflows[ id ];
</span><span class="cx"> },
</span><del>-
</del><ins>+ /**
+ * @namespace
+ */
</ins><span class="cx"> send: {
</span><span class="cx"> /**
</span><span class="cx"> * Called when sending an attachment to the editor
</span><span class="lines">@@ -884,7 +897,9 @@
</span><span class="cx"> }
</span><span class="cx"> },
</span><span class="cx"> /**
</span><del>- * @param {string} id
</del><ins>+ * Open a workflow
+ *
+ * @param {string} [id=undefined] Optional. A slug used to identify the workflow.
</ins><span class="cx"> * @param {Object} [options={}]
</span><span class="cx"> *
</span><span class="cx"> * @this wp.media.editor
</span></span></pre>
</div>
</div>
</body>
</html>