Media: UI tweaks for Insert from URL.

"Title" field is now labeled as "Link Text", to reflect how it's actually used. It's also hidden whenever the embed is updating, to make it clearer that something is happening. Embed dimension fields are shown below the preview, much like image property fields are shown below.

fixes #29476, see #31139.


git-svn-id: https://develop.svn.wordpress.org/trunk@31642 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2015-03-06 15:02:08 +00:00
parent c9913583e3
commit df65776f88
3 changed files with 12 additions and 10 deletions

View File

@ -4605,6 +4605,7 @@ EmbedLink = Settings.extend({
// clear out previous results // clear out previous results
this.$('.embed-container').hide().find('.embed-preview').html(''); this.$('.embed-container').hide().find('.embed-preview').html('');
this.$( '.setting' ).hide();
// only proceed with embed if the field contains more than 6 characters // only proceed with embed if the field contains more than 6 characters
if ( url && url.length < 6 ) { if ( url && url.length < 6 ) {
@ -4641,7 +4642,7 @@ EmbedLink = Settings.extend({
}, },
renderFail: function () { renderFail: function () {
this.$( '.setting' ).hide().filter( '.title' ).show(); this.$( '.setting' ).hide().filter( '.link-text' ).show();
}, },
renderoEmbed: function( response ) { renderoEmbed: function( response ) {
@ -4650,7 +4651,7 @@ EmbedLink = Settings.extend({
opts = { silent: true }; opts = { silent: true };
this.$( '.setting' ).hide() this.$( '.setting' ).hide()
.filter( '.title' )[ html ? 'hide' : 'show' ](); .filter( '.link-text' )[ html ? 'hide' : 'show' ]();
if ( response && response.attr ) { if ( response && response.attr ) {
attr = response.attr; attr = response.attr;

View File

@ -28,6 +28,7 @@ EmbedLink = Settings.extend({
// clear out previous results // clear out previous results
this.$('.embed-container').hide().find('.embed-preview').html(''); this.$('.embed-container').hide().find('.embed-preview').html('');
this.$( '.setting' ).hide();
// only proceed with embed if the field contains more than 6 characters // only proceed with embed if the field contains more than 6 characters
if ( url && url.length < 6 ) { if ( url && url.length < 6 ) {
@ -64,7 +65,7 @@ EmbedLink = Settings.extend({
}, },
renderFail: function () { renderFail: function () {
this.$( '.setting' ).hide().filter( '.title' ).show(); this.$( '.setting' ).hide().filter( '.link-text' ).show();
}, },
renderoEmbed: function( response ) { renderoEmbed: function( response ) {
@ -73,7 +74,7 @@ EmbedLink = Settings.extend({
opts = { silent: true }; opts = { silent: true };
this.$( '.setting' ).hide() this.$( '.setting' ).hide()
.filter( '.title' )[ html ? 'hide' : 'show' ](); .filter( '.link-text' )[ html ? 'hide' : 'show' ]();
if ( response && response.attr ) { if ( response && response.attr ) {
attr = response.attr; attr = response.attr;

View File

@ -815,10 +815,13 @@ function wp_print_media_templates() {
</script> </script>
<script type="text/html" id="tmpl-embed-link-settings"> <script type="text/html" id="tmpl-embed-link-settings">
<label class="setting title"> <label class="setting link-text">
<span><?php _e( 'Title' ); ?></span> <span><?php _e( 'Link Text' ); ?></span>
<input type="text" class="alignment" data-setting="title" /> <input type="text" class="alignment" data-setting="link-text" />
</label> </label>
<div class="embed-container" style="display: none;">
<div class="embed-preview"></div>
</div>
<div class="embed-link-dimensions"> <div class="embed-link-dimensions">
<label class="setting width"> <label class="setting width">
<span><?php _e( 'Maximum Width' ); ?></span> <span><?php _e( 'Maximum Width' ); ?></span>
@ -829,9 +832,6 @@ function wp_print_media_templates() {
<input type="text" class="alignment" data-setting="height" /> <input type="text" class="alignment" data-setting="height" />
</label> </label>
</div> </div>
<div class="embed-container" style="display: none;">
<div class="embed-preview"></div>
</div>
</script> </script>
<script type="text/html" id="tmpl-embed-image-settings"> <script type="text/html" id="tmpl-embed-image-settings">