Media modal documentation:

Add some clarity to default values for controllers.

Props ericlewis.
See #28459.


Built from https://develop.svn.wordpress.org/trunk@28675


git-svn-id: http://core.svn.wordpress.org/trunk@28493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-05 14:54:14 +00:00
parent f769530af3
commit 5d89ee4b3b
2 changed files with 108 additions and 77 deletions

View File

@ -546,24 +546,25 @@
*/ */
media.controller.Library = media.controller.State.extend({ media.controller.Library = media.controller.State.extend({
defaults: { defaults: {
id: 'library', id: 'library',
multiple: false, // false, 'add', 'reset' title: l10n.mediaLibraryTitle,
describe: false, // Selection defaults. @see media.model.Selection
toolbar: 'select', multiple: false,
sidebar: 'settings', // Initial region modes.
content: 'upload', content: 'upload',
router: 'browse', menu: 'default',
menu: 'default', router: 'browse',
searchable: true, toolbar: 'select',
filterable: false, // Attachments browser defaults. @see media.view.AttachmentsBrowser
sortable: true, searchable: true,
title: l10n.mediaLibraryTitle, filterable: false,
sortable: true,
describe: false,
// Uses a user setting to override the content mode. // Uses a user setting to override the content mode.
contentUserSetting: true, contentUserSetting: true,
// Sync the selection from the last state when 'multiple' matches. // Sync the selection from the last state when 'multiple' matches.
syncSelection: true syncSelection: true
}, },
/** /**
@ -754,15 +755,16 @@
*/ */
media.controller.ImageDetails = media.controller.State.extend({ media.controller.ImageDetails = media.controller.State.extend({
defaults: _.defaults({ defaults: _.defaults({
id: 'image-details', id: 'image-details',
toolbar: 'image-details', title: l10n.imageDetailsTitle,
title: l10n.imageDetailsTitle, // Initial region modes.
content: 'image-details', content: 'image-details',
menu: 'image-details', menu: 'image-details',
router: false, router: false,
attachment: false, toolbar: 'image-details',
priority: 60,
editing: false editing: false,
priority: 60
}, media.controller.Library.prototype.defaults ), }, media.controller.Library.prototype.defaults ),
initialize: function( options ) { initialize: function( options ) {
@ -786,18 +788,22 @@
media.controller.GalleryEdit = media.controller.Library.extend({ media.controller.GalleryEdit = media.controller.Library.extend({
defaults: { defaults: {
id: 'gallery-edit', id: 'gallery-edit',
title: l10n.editGalleryTitle,
// Selection defaults. @see media.model.Selection
multiple: false, multiple: false,
// Attachments browser defaults. @see media.view.AttachmentsBrowser
searchable: false,
sortable: true,
// Initial region modes.
content: 'browse',
toolbar: 'gallery-edit',
describe: true, describe: true,
displaySettings: true,
dragInfo: true,
edge: 199, edge: 199,
editing: false, editing: false,
sortable: true,
searchable: false,
toolbar: 'gallery-edit',
content: 'browse',
title: l10n.editGalleryTitle,
priority: 60, priority: 60,
dragInfo: true,
displaySettings: true,
// Don't sync the selection, as the Edit Gallery library // Don't sync the selection, as the Edit Gallery library
// *is* the selection. // *is* the selection.
@ -880,14 +886,17 @@
*/ */
media.controller.GalleryAdd = media.controller.Library.extend({ media.controller.GalleryAdd = media.controller.Library.extend({
defaults: _.defaults({ defaults: _.defaults({
id: 'gallery-library', id: 'gallery-library',
filterable: 'uploaded', title: l10n.addToGalleryTitle,
multiple: 'add', // Selection defaults. @see media.model.Selection
menu: 'gallery', multiple: 'add',
toolbar: 'gallery-add', // Attachments browser defaults. @see media.view.AttachmentsBrowser
title: l10n.addToGalleryTitle, filterable: 'uploaded',
priority: 100, // Initial region modes.
menu: 'gallery',
toolbar: 'gallery-add',
priority: 100,
// Don't sync the selection, as the Edit Gallery library // Don't sync the selection, as the Edit Gallery library
// *is* the selection. // *is* the selection.
syncSelection: false syncSelection: false
@ -935,15 +944,19 @@
*/ */
media.controller.CollectionEdit = media.controller.Library.extend({ media.controller.CollectionEdit = media.controller.Library.extend({
defaults: { defaults: {
// Selection defaults. @see media.model.Selection
multiple: false, multiple: false,
describe: true, // Attachments browser defaults. @see media.view.AttachmentsBrowser
edge: 199,
editing: false,
sortable: true, sortable: true,
searchable: false, searchable: false,
// Region mode defaults.
content: 'browse', content: 'browse',
priority: 60,
describe: true,
dragInfo: true, dragInfo: true,
edge: 199,
editing: false,
priority: 60,
SettingsView: false, SettingsView: false,
// Don't sync the selection, as the Edit {Collection} library // Don't sync the selection, as the Edit {Collection} library
@ -1044,8 +1057,11 @@
*/ */
media.controller.CollectionAdd = media.controller.Library.extend({ media.controller.CollectionAdd = media.controller.Library.extend({
defaults: _.defaults( { defaults: _.defaults( {
filterable: 'uploaded', // Selection defaults. @see media.model.Selection
multiple: 'add', multiple: 'add',
// Attachments browser defaults. @see media.view.AttachmentsBrowser
filterable: 'uploaded',
priority: 100, priority: 100,
syncSelection: false syncSelection: false
}, media.controller.Library.prototype.defaults ), }, media.controller.Library.prototype.defaults ),
@ -1104,12 +1120,16 @@
*/ */
media.controller.FeaturedImage = media.controller.Library.extend({ media.controller.FeaturedImage = media.controller.Library.extend({
defaults: _.defaults({ defaults: _.defaults({
id: 'featured-image', id: 'featured-image',
filterable: 'uploaded', title: l10n.setFeaturedImageTitle,
multiple: false, // Selection defaults. @see media.model.Selection
toolbar: 'featured-image', multiple: false,
title: l10n.setFeaturedImageTitle, // Attachments browser defaults. @see media.view.AttachmentsBrowser
priority: 60, filterable: 'uploaded',
// Region mode defaults.
toolbar: 'featured-image',
priority: 60,
syncSelection: true syncSelection: true
}, media.controller.Library.prototype.defaults ), }, media.controller.Library.prototype.defaults ),
@ -1185,12 +1205,16 @@
*/ */
media.controller.ReplaceImage = media.controller.Library.extend({ media.controller.ReplaceImage = media.controller.Library.extend({
defaults: _.defaults({ defaults: _.defaults({
id: 'replace-image', id: 'replace-image',
filterable: 'uploaded', title: l10n.replaceImageTitle,
multiple: false, // Selection defaults. @see media.model.Selection
toolbar: 'replace', multiple: false,
title: l10n.replaceImageTitle, // Attachments browser defaults. @see media.view.AttachmentsBrowser
priority: 60, filterable: 'uploaded',
// Region mode defaults.
toolbar: 'replace',
priority: 60,
syncSelection: true syncSelection: true
}, media.controller.Library.prototype.defaults ), }, media.controller.Library.prototype.defaults ),
@ -1250,12 +1274,14 @@
*/ */
media.controller.EditImage = media.controller.State.extend({ media.controller.EditImage = media.controller.State.extend({
defaults: { defaults: {
id: 'edit-image', id: 'edit-image',
url: '', title: l10n.editImage,
menu: false, // Region mode defaults.
menu: false,
toolbar: 'edit-image', toolbar: 'edit-image',
title: l10n.editImage, content: 'edit-image',
content: 'edit-image'
url: ''
}, },
activate: function() { activate: function() {
@ -1301,10 +1327,12 @@
*/ */
media.controller.MediaLibrary = media.controller.Library.extend({ media.controller.MediaLibrary = media.controller.Library.extend({
defaults: _.defaults({ defaults: _.defaults({
filterable: 'uploaded', // Attachments browser defaults. @see media.view.AttachmentsBrowser
priority: 80, filterable: 'uploaded',
syncSelection: false,
displaySettings: false displaySettings: false,
priority: 80,
syncSelection: false
}, media.controller.Library.prototype.defaults ), }, media.controller.Library.prototype.defaults ),
initialize: function( options ) { initialize: function( options ) {
@ -1333,15 +1361,16 @@
*/ */
media.controller.Embed = media.controller.State.extend({ media.controller.Embed = media.controller.State.extend({
defaults: { defaults: {
id: 'embed', id: 'embed',
url: '',
menu: 'default',
content: 'embed',
toolbar: 'main-embed',
type: 'link',
title: l10n.insertFromUrlTitle, title: l10n.insertFromUrlTitle,
priority: 120 // Region mode defaults.
content: 'embed',
menu: 'default',
toolbar: 'main-embed',
priority: 120,
type: 'link',
url: ''
}, },
// The amount of time used when debouncing the scan. // The amount of time used when debouncing the scan.
@ -1445,11 +1474,13 @@
*/ */
media.controller.Cropper = media.controller.State.extend({ media.controller.Cropper = media.controller.State.extend({
defaults: { defaults: {
id: 'cropper', id: 'cropper',
title: l10n.cropImage, title: l10n.cropImage,
toolbar: 'crop', // Region mode defaults.
content: 'crop', toolbar: 'crop',
router: false, content: 'crop',
router: false,
canSkipCrop: false canSkipCrop: false
}, },

File diff suppressed because one or more lines are too long