diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 377f020..6a01aa6 100644
|
|
|
6060 | 6060 | 'click .edit-attachment': 'editAttachment', |
6061 | 6061 | 'click .replace-attachment': 'replaceAttachment', |
6062 | 6062 | 'click .advanced-toggle': 'toggleAdvanced', |
6063 | | 'change [data-setting="customWidth"]': 'syncCustomSize', |
6064 | | 'change [data-setting="customHeight"]': 'syncCustomSize', |
6065 | | 'keyup [data-setting="customWidth"]': 'syncCustomSize', |
6066 | | 'keyup [data-setting="customHeight"]': 'syncCustomSize' |
| 6063 | 'change [data-setting="customWidth"]': 'onCustomSize', |
| 6064 | 'change [data-setting="customHeight"]': 'onCustomSize', |
| 6065 | 'keyup [data-setting="customWidth"]': 'onCustomSize', |
| 6066 | 'keyup [data-setting="customHeight"]': 'onCustomSize' |
6067 | 6067 | } ), |
6068 | 6068 | initialize: function() { |
6069 | 6069 | // used in AttachmentDisplay.prototype.updateLinkTo |
… |
… |
|
6136 | 6136 | } |
6137 | 6137 | }, |
6138 | 6138 | |
6139 | | syncCustomSize: function( event ) { |
| 6139 | onCustomSize: function( event ) { |
6140 | 6140 | var dimension = $( event.target ).data('setting'), |
| 6141 | num = $( event.target ).val(), |
6141 | 6142 | value; |
6142 | 6143 | |
| 6144 | // Ignore bogus input |
| 6145 | if ( ! /^\d+/.test( num ) || parseInt( num, 10 ) < 1 ) { |
| 6146 | event.preventDefault(); |
| 6147 | return; |
| 6148 | } |
| 6149 | |
6143 | 6150 | if ( dimension === 'customWidth' ) { |
6144 | | value = Math.round( 1 / this.model.get( 'aspectRatio' ) * $( event.target ).val() ); |
| 6151 | value = Math.round( 1 / this.model.get( 'aspectRatio' ) * num ); |
6145 | 6152 | this.model.set( 'customHeight', value, { silent: true } ); |
6146 | 6153 | this.$( '[data-setting="customHeight"]' ).val( value ); |
6147 | 6154 | } else { |
6148 | | value = Math.round( this.model.get( 'aspectRatio' ) * $( event.target ).val() ); |
| 6155 | value = Math.round( this.model.get( 'aspectRatio' ) * num ); |
| 6156 | this.model.set( 'customWidth', value, { silent: true } ); |
6149 | 6157 | this.$( '[data-setting="customWidth"]' ).val( value ); |
6150 | | this.model.set( 'customWidth', value, { silent: true } ); |
| 6158 | |
6151 | 6159 | } |
6152 | 6160 | }, |
6153 | 6161 | |
diff --git src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
index b7dcbae..9148410 100644
|
|
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
114 | 114 | } |
115 | 115 | |
116 | 116 | function extractImageData( imageNode ) { |
117 | | var classes, extraClasses, metadata, captionBlock, caption, link, width, height, |
| 117 | var classes, extraClasses, metadata, captionBlock, caption, link, width, |
118 | 118 | dom = editor.dom; |
119 | 119 | |
120 | 120 | // default attributes |
121 | 121 | metadata = { |
122 | 122 | attachment_id: false, |
123 | | url: false, |
124 | | height: '', |
125 | | width: '', |
126 | | customWidth: '', |
127 | | customHeight: '', |
128 | 123 | size: 'custom', |
129 | 124 | caption: '', |
130 | | alt: '', |
131 | 125 | align: 'none', |
132 | 126 | extraClasses: '', |
133 | 127 | link: false, |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
141 | 135 | metadata.url = dom.getAttrib( imageNode, 'src' ); |
142 | 136 | metadata.alt = dom.getAttrib( imageNode, 'alt' ); |
143 | 137 | metadata.title = dom.getAttrib( imageNode, 'title' ); |
144 | | width = dom.getAttrib( imageNode, 'width' ) || imageNode.width; |
145 | | height = dom.getAttrib( imageNode, 'height' ) || imageNode.height; |
146 | | metadata.width = parseInt( width, 10 ); |
147 | | metadata.height = parseInt( height, 10 ); |
148 | | metadata.customWidth = metadata.width; |
149 | | metadata.customHeight = metadata.height; |
| 138 | metadata.customWidth = metadata.width = width = imageNode.width; |
| 139 | metadata.customHeight = metadata.height = imageNode.height; |
150 | 140 | |
151 | 141 | classes = tinymce.explode( imageNode.className, ' ' ); |
152 | 142 | extraClasses = []; |