Ticket #22257: 22257.patch
File 22257.patch, 3.5 KB (added by , 13 years ago) |
---|
-
wp-includes/js/mce-view.js
236 236 // To render the views, call `wp.mce.view.render( scope )`. 237 237 toViews: function( content ) { 238 238 var pieces = [ { content: content } ], 239 current ;239 current, string = ''; 240 240 241 241 _.each( views, function( view, viewType ) { 242 242 current = pieces.slice(); … … 254 254 255 255 // Iterate through the string progressively matching views 256 256 // and slicing the string as we go. 257 while ( remaining && ( result = view.toView( remaining )) ) {257 while ( remaining && ( result = view.toView( remaining ) ) ) { 258 258 // Any text before the match becomes an unprocessed piece. 259 259 if ( result.index ) 260 260 pieces.push({ content: remaining.substring( 0, result.index ) }); … … 276 276 }); 277 277 }); 278 278 279 return _.pluck( pieces, 'content' ).join(''); 279 // Put the content back together. 280 // Add padding before and after a view to allow the caret to go there. 281 _.each( pieces, function( piece ) { 282 if ( piece.processed ) { 283 // Pad before a view if it's first or the current string doesn't end with a space 284 if ( ! (/[ \uFEFF]$/).test(string) ) 285 string += '\uFEFF ' 286 287 string += piece.content; 288 return; 289 } 290 291 // Pad after a view if the current piece doesn't begin with a space 292 if ( string && ! (/^[ \uFEFF]/).test(piece.content) ) 293 string += ' \uFEFF'; 294 295 string += piece.content; 296 }); 297 298 // Last bit is a view, pad the end 299 if ( pieces[ pieces.length - 1 ].processed ) 300 string += ' \uFEFF'; 301 302 return string; 280 303 }, 281 304 282 305 toView: function( viewType, options ) { … … 300 323 // called in the view's `render` method without a conditional. 301 324 instance.$wrapper = $(); 302 325 326 // todo: remove "tag" from options 303 327 return wp.html.string({ 304 // If the view is a span, wrap it in a span. 305 tag: 'span' === instance.tagName ? 'span' : 'div', 306 328 tag: 'span', 307 329 attrs: { 308 330 'class': 'wp-view-wrap wp-view-type-' + viewType, 309 331 'data-wp-view': id, … … 344 366 // Scans an HTML `content` string and replaces any view instances with 345 367 // their respective text representations. 346 368 toText: function( content ) { 347 return content.replace( / <(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?<span[^>]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) {369 return content.replace( /(?:\uFEFF )?<span[^>]+?data-wp-view="([^"]+)"[^>]*>.*?<span[^>]+data-wp-view-end[^>]*><\/span><\/span>(?: \uFEFF)?/g, function( match, id ) { 348 370 var instance = instances[ id ], 349 371 view; 350 372 … … 721 743 } 722 744 } 723 745 }); 724 }(jQuery)); 725 No newline at end of file 746 }(jQuery)); -
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
161 161 box-shadow: none; 162 162 } 163 163 164 .wp-view-wrap.alignnone {165 display: block;166 }167 168 164 .wp-view-wrap.aligncenter { 169 165 display: block; 170 166 text-align: center; … … 264 260 .editor-attachment { 265 261 display: inline-block; 266 262 position: relative; 267 margin-top: 10px;268 margin-right: 10px;269 263 overflow: hidden; 270 264 } 271 265 … … 285 279 } 286 280 287 281 .wp-view-type-gallery { 288 display: block;282 width: 99%; 289 283 } 290 284 291 285 .editor-gallery {