Ticket #30949: 30949.patch
File 30949.patch, 52.2 KB (added by , 10 years ago) |
---|
-
src/wp-admin/admin-ajax.php
56 56 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax', 57 57 'menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink', 58 58 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', 59 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',59 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 60 60 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 61 61 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', 62 62 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', … … 65 65 'press-this-add-category', 66 66 ); 67 67 68 // Deprecated 69 $core_actions_post[] = 'wp-fullscreen-save-post'; 70 68 71 // Register core Ajax calls. 69 72 if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) 70 73 add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); -
src/wp-admin/css/edit.css
70 70 padding: 11px 10px; 71 71 } 72 72 73 #wp-fullscreen-save .fs-saved {74 color: #999;75 float: right;76 margin-top: 4px;77 }78 79 73 #poststuff .inside-submitbox, 80 74 #side-sortables .inside-submitbox { 81 75 margin: 0 3px; … … 390 384 border: 1px solid transparent; 391 385 } 392 386 393 .wp-fullscreen-wrap #content-textarea-clone {394 display: none;395 }396 397 /* editor-expand.js override */398 .wp-fullscreen-wrap {399 padding-top: 0 !important;400 }401 402 .wp-fullscreen-wrap .wp-editor-area {403 margin-top: 0 !important;404 }405 406 .wp-fullscreen-wrap .mce-edit-area {407 padding-top: 0 !important;408 }409 /* end editor-expand.js override */410 411 387 .wp-editor-expand #wp-content-editor-tools { 412 388 z-index: 1000; 413 389 border-bottom: 1px solid #e5e5e5; -
src/wp-admin/css/ie.css
50 50 width: 35%; 51 51 } 52 52 53 .wp-fullscreen-title {54 width: 97%;55 }56 57 #wp_mce_fullscreen_ifr {58 background-color: #f9f9f9;59 }60 61 #wp-fullscreen-tagline {62 color: #82878c;63 font-size: 14px;64 }65 66 53 #adminmenuback { 67 54 left: 0; 68 55 background-image: none; -
src/wp-admin/css/l10n.css
54 54 /* zn_CH: Enlarge font size, set font-size: normal */ 55 55 .locale-zh-cn form.upgrade .hint { font-style: normal; font-size: 100%; } 56 56 57 /* Zn_CH: Distraction-free writing.58 * More beautiful font for "Just write."59 * Larger text for HTML/Visual mode.60 */61 .locale-zh-cn #wp-fullscreen-tagline { font-family: KaiTi, "楷体", sans-serif; }62 .locale-zh-cn #wp-fullscreen-modes a { font-size: 12px; }63 64 57 /* zh_CN: Enlarge font-size. */ 65 58 .locale-zh-cn #sort-buttons { font-size: 1em !important; } 66 59 -
src/wp-admin/includes/ajax-actions.php
2069 2069 } 2070 2070 2071 2071 /** 2072 * Ajax handler for saving posts from the fullscreen editor.2073 *2074 * @since 3.1.02075 */2076 function wp_ajax_wp_fullscreen_save_post() {2077 $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;2078 2079 $post = null;2080 2081 if ( $post_id )2082 $post = get_post( $post_id );2083 2084 check_ajax_referer('update-post_' . $post_id, '_wpnonce');2085 2086 $post_id = edit_post();2087 2088 if ( is_wp_error( $post_id ) ) {2089 wp_send_json_error();2090 }2091 2092 if ( $post ) {2093 $last_date = mysql2date( get_option('date_format'), $post->post_modified );2094 $last_time = mysql2date( get_option('time_format'), $post->post_modified );2095 } else {2096 $last_date = date_i18n( get_option('date_format') );2097 $last_time = date_i18n( get_option('time_format') );2098 }2099 2100 if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) {2101 $last_user = get_userdata( $last_id );2102 $last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time );2103 } else {2104 $last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time );2105 }2106 2107 wp_send_json_success( array( 'last_edited' => $last_edited ) );2108 }2109 2110 /**2111 2072 * Ajax handler for removing a post lock. 2112 2073 * 2113 2074 * @since 3.1.0 -
src/wp-admin/includes/deprecated.php
1181 1181 function _relocate_children( $old_ID, $new_ID ) { 1182 1182 _deprecated_function( __FUNCTION__, '3.9' ); 1183 1183 } 1184 1185 /** 1186 * Ajax handler for saving posts from the fullscreen editor. 1187 * 1188 * @since 3.1.0 1189 * @deprecated 4.3.0 1190 */ 1191 function wp_ajax_wp_fullscreen_save_post() { 1192 // Should not output errors, will break the JSON response. 1193 if ( defined( 'WP_DEBUG_DISPLAY' ) && false === WP_DEBUG_DISPLAY ) { 1194 _deprecated_function( __FUNCTION__, '4.3' ); 1195 } 1196 1197 $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; 1198 1199 $post = null; 1200 1201 if ( $post_id ) 1202 $post = get_post( $post_id ); 1203 1204 check_ajax_referer('update-post_' . $post_id, '_wpnonce'); 1205 1206 $post_id = edit_post(); 1207 1208 if ( is_wp_error( $post_id ) ) { 1209 wp_send_json_error(); 1210 } 1211 1212 if ( $post ) { 1213 $last_date = mysql2date( get_option('date_format'), $post->post_modified ); 1214 $last_time = mysql2date( get_option('time_format'), $post->post_modified ); 1215 } else { 1216 $last_date = date_i18n( get_option('date_format') ); 1217 $last_time = date_i18n( get_option('time_format') ); 1218 } 1219 1220 if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) { 1221 $last_user = get_userdata( $last_id ); 1222 $last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time ); 1223 } else { 1224 $last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time ); 1225 } 1226 1227 wp_send_json_success( array( 'last_edited' => $last_edited ) ); 1228 } -
src/wp-admin/js/editor.js
322 322 return o.data; 323 323 } 324 324 }; 325 326 /** 327 * Distraction-Free Writing (wp-fullscreen) backwards compatibility stub. 328 * Todo: remove in mid 2016. 329 * 330 * Deprecated in 4.1, removed in 4.3. 331 */ 332 ( function() { 333 var noop = function(){}; 334 335 window.wp = window.wp || {}; 336 window.wp.editor = window.wp.editor || {}; 337 window.wp.editor.fullscreen = { 338 bind_resize: noop, 339 dfwWidth: noop, 340 off: noop, 341 on: noop, 342 refreshButtons: noop, 343 resizeTextarea: noop, 344 save: noop, 345 switchmode: noop, 346 toggleUI: noop, 347 348 settings: {}, 349 pubsub: { 350 publish: noop, 351 subscribe: noop, 352 unsubscribe: noop, 353 topics: {} 354 }, 355 fade: { 356 In: noop, 357 Out: noop 358 }, 359 ui: { 360 fade: noop, 361 init: noop 362 } 363 }; 364 }()); -
src/wp-admin/js/wp-fullscreen.js
1 /* global deleteUserSetting, setUserSetting, switchEditors, tinymce, tinyMCEPreInit */2 /**3 * Distraction-Free Writing4 * (wp-fullscreen)5 *6 * Access the API globally using the window.wp.editor.fullscreen variable.7 */8 ( function( $, window ) {9 var api, ps, s, toggleUI, uiTimer, PubSub,10 uiScrollTop = 0,11 transitionend = 'transitionend webkitTransitionEnd',12 $body = $( document.body ),13 $document = $( document );14 15 /**16 * PubSub17 *18 * A lightweight publish/subscribe implementation.19 *20 * @access private21 */22 PubSub = function() {23 this.topics = {};24 25 this.subscribe = function( topic, callback ) {26 if ( ! this.topics[ topic ] )27 this.topics[ topic ] = [];28 29 this.topics[ topic ].push( callback );30 return callback;31 };32 33 this.unsubscribe = function( topic, callback ) {34 var i, l,35 topics = this.topics[ topic ];36 37 if ( ! topics )38 return callback || [];39 40 // Clear matching callbacks41 if ( callback ) {42 for ( i = 0, l = topics.length; i < l; i++ ) {43 if ( callback == topics[i] )44 topics.splice( i, 1 );45 }46 return callback;47 48 // Clear all callbacks49 } else {50 this.topics[ topic ] = [];51 return topics;52 }53 };54 55 this.publish = function( topic, args ) {56 var i, l, broken,57 topics = this.topics[ topic ];58 59 if ( ! topics )60 return;61 62 args = args || [];63 64 for ( i = 0, l = topics.length; i < l; i++ ) {65 broken = ( topics[i].apply( null, args ) === false || broken );66 }67 return ! broken;68 };69 };70 71 // Initialize the fullscreen/api object72 api = {};73 74 // Create the PubSub (publish/subscribe) interface.75 ps = api.pubsub = new PubSub();76 77 s = api.settings = { // Settings78 visible: false,79 mode: 'tinymce',80 id: '',81 title_id: '',82 timer: 0,83 toolbar_shown: false84 };85 86 function _hideUI() {87 $body.removeClass('wp-dfw-show-ui');88 }89 90 /**91 * toggleUI92 *93 * Toggle the CSS class to show/hide the toolbar, borders and statusbar.94 */95 toggleUI = api.toggleUI = function( show ) {96 clearTimeout( uiTimer );97 98 if ( ! $body.hasClass('wp-dfw-show-ui') || show === 'show' ) {99 $body.addClass('wp-dfw-show-ui');100 } else if ( show !== 'autohide' ) {101 $body.removeClass('wp-dfw-show-ui');102 }103 104 if ( show === 'autohide' ) {105 uiTimer = setTimeout( _hideUI, 2000 );106 }107 };108 109 function resetCssPosition( add ) {110 s.$dfwWrap.parents().each( function( i, parent ) {111 var cssPosition, $parent = $(parent);112 113 if ( add ) {114 if ( parent.style.position ) {115 $parent.data( 'wp-dfw-css-position', parent.style.position );116 }117 118 $parent.css( 'position', 'static' );119 } else {120 cssPosition = $parent.data( 'wp-dfw-css-position' );121 cssPosition = cssPosition || '';122 $parent.css( 'position', cssPosition );123 }124 125 if ( parent.nodeName === 'BODY' ) {126 return false;127 }128 });129 }130 131 /**132 * on()133 *134 * Turns fullscreen on.135 *136 * @param string mode Optional. Switch to the given mode before opening.137 */138 api.on = function() {139 var id, $dfwWrap, titleId;140 141 if ( s.visible ) {142 return;143 }144 145 if ( ! s.$fullscreenFader ) {146 api.ui.init();147 }148 149 // Settings can be added or changed by defining "wp_fullscreen_settings" JS object.150 if ( typeof window.wp_fullscreen_settings === 'object' )151 $.extend( s, window.wp_fullscreen_settings );152 153 id = s.id || window.wpActiveEditor;154 155 if ( ! id ) {156 if ( s.hasTinymce ) {157 id = tinymce.activeEditor.id;158 } else {159 return;160 }161 }162 163 s.id = id;164 $dfwWrap = s.$dfwWrap = $( '#wp-' + id + '-wrap' );165 166 if ( ! $dfwWrap.length ) {167 return;168 }169 170 s.$dfwTextarea = $( '#' + id );171 s.$editorContainer = $dfwWrap.find( '.wp-editor-container' );172 uiScrollTop = $document.scrollTop();173 174 if ( s.hasTinymce ) {175 s.editor = tinymce.get( id );176 }177 178 if ( s.editor && ! s.editor.isHidden() ) {179 s.origHeight = $( '#' + id + '_ifr' ).height();180 s.mode = 'tinymce';181 } else {182 s.origHeight = s.$dfwTextarea.height();183 s.mode = 'html';184 }185 186 // Try to find title field187 if ( typeof window.adminpage !== 'undefined' &&188 ( window.adminpage === 'post-php' || window.adminpage === 'post-new-php' ) ) {189 190 titleId = 'title';191 } else {192 titleId = id + '-title';193 }194 195 s.$dfwTitle = $( '#' + titleId );196 197 if ( ! s.$dfwTitle.length ) {198 s.$dfwTitle = null;199 }200 201 api.ui.fade( 'show', 'showing', 'shown' );202 };203 204 /**205 * off()206 *207 * Turns fullscreen off.208 */209 api.off = function() {210 if ( ! s.visible )211 return;212 213 api.ui.fade( 'hide', 'hiding', 'hidden' );214 };215 216 /**217 * switchmode()218 *219 * @return string - The current mode.220 *221 * @param string to - The fullscreen mode to switch to.222 * @event switchMode223 * @eventparam string to - The new mode.224 * @eventparam string from - The old mode.225 */226 api.switchmode = function( to ) {227 var from = s.mode;228 229 if ( ! to || ! s.visible || ! s.hasTinymce || typeof switchEditors === 'undefined' ) {230 return from;231 }232 233 // Don't switch if the mode is the same.234 if ( from == to )235 return from;236 237 if ( to === 'tinymce' && ! s.editor ) {238 s.editor = tinymce.get( s.id );239 240 if ( ! s.editor && typeof tinyMCEPreInit !== 'undefined' &&241 tinyMCEPreInit.mceInit && tinyMCEPreInit.mceInit[ s.id ] ) {242 243 // If the TinyMCE instance hasn't been created, set the "wp_fulscreen" flag on creating it244 tinyMCEPreInit.mceInit[ s.id ].wp_fullscreen = true;245 }246 }247 248 s.mode = to;249 switchEditors.go( s.id, to );250 api.refreshButtons( true );251 252 if ( to === 'html' ) {253 setTimeout( api.resizeTextarea, 200 );254 }255 256 return to;257 };258 259 /**260 * General261 */262 263 api.save = function() {264 var $hidden = $('#hiddenaction'),265 oldVal = $hidden.val(),266 $spinner = $('#wp-fullscreen-save .spinner'),267 $saveMessage = $('#wp-fullscreen-save .wp-fullscreen-saved-message'),268 $errorMessage = $('#wp-fullscreen-save .wp-fullscreen-error-message');269 270 $spinner.addClass( 'is-active' );271 $errorMessage.hide();272 $saveMessage.hide();273 $hidden.val('wp-fullscreen-save-post');274 275 if ( s.editor && ! s.editor.isHidden() ) {276 s.editor.save();277 }278 279 $.ajax({280 url: window.ajaxurl,281 type: 'post',282 data: $('form#post').serialize(),283 dataType: 'json'284 }).done( function( response ) {285 $spinner.removeClass( 'is-active' );286 287 if ( response && response.success ) {288 $saveMessage.show();289 290 setTimeout( function() {291 $saveMessage.fadeOut(300);292 }, 3000 );293 294 if ( response.data && response.data.last_edited ) {295 $('#wp-fullscreen-save input').attr( 'title', response.data.last_edited );296 }297 } else {298 $errorMessage.show();299 }300 }).fail( function() {301 $spinner.removeClass( 'is-active' );302 $errorMessage.show();303 });304 305 $hidden.val( oldVal );306 };307 308 api.dfwWidth = function( pixels, total ) {309 var width;310 311 if ( pixels && pixels.toString().indexOf('%') !== -1 ) {312 s.$editorContainer.css( 'width', pixels );313 s.$statusbar.css( 'width', pixels );314 315 if ( s.$dfwTitle ) {316 s.$dfwTitle.css( 'width', pixels );317 }318 return;319 }320 321 if ( ! pixels ) {322 // Reset to theme width323 width = $('#wp-fullscreen-body').data('theme-width') || 800;324 s.$editorContainer.width( width );325 s.$statusbar.width( width );326 327 if ( s.$dfwTitle ) {328 s.$dfwTitle.width( width - 16 );329 }330 331 deleteUserSetting('dfw_width');332 return;333 }334 335 if ( total ) {336 width = pixels;337 } else {338 width = s.$editorContainer.width();339 width += pixels;340 }341 342 if ( width < 200 || width > 1200 ) {343 // sanity check344 return;345 }346 347 s.$editorContainer.width( width );348 s.$statusbar.width( width );349 350 if ( s.$dfwTitle ) {351 s.$dfwTitle.width( width - 16 );352 }353 354 setUserSetting( 'dfw_width', width );355 };356 357 // This event occurs before the overlay blocks the UI.358 ps.subscribe( 'show', function() {359 var title = $('#last-edit').text();360 361 if ( title ) {362 $('#wp-fullscreen-save input').attr( 'title', title );363 }364 });365 366 // This event occurs while the overlay blocks the UI.367 ps.subscribe( 'showing', function() {368 $body.addClass( 'wp-fullscreen-active' );369 s.$dfwWrap.addClass( 'wp-fullscreen-wrap' );370 371 if ( s.$dfwTitle ) {372 s.$dfwTitle.after( '<span id="wp-fullscreen-title-placeholder">' );373 s.$dfwWrap.prepend( s.$dfwTitle.addClass('wp-fullscreen-title') );374 }375 376 api.refreshButtons();377 resetCssPosition( true );378 $('#wpadminbar').hide();379 380 // Show the UI for 2 sec. when opening381 toggleUI('autohide');382 383 api.bind_resize();384 385 if ( s.editor ) {386 s.editor.execCommand( 'wpFullScreenOn' );387 }388 389 if ( 'ontouchstart' in window ) {390 api.dfwWidth( '90%' );391 } else {392 api.dfwWidth( $( '#wp-fullscreen-body' ).data('dfw-width') || 800, true );393 }394 395 // scroll to top so the user is not disoriented396 scrollTo(0, 0);397 });398 399 // This event occurs after the overlay unblocks the UI400 ps.subscribe( 'shown', function() {401 s.visible = true;402 403 if ( s.editor && ! s.editor.isHidden() ) {404 s.editor.execCommand( 'wpAutoResize' );405 } else {406 api.resizeTextarea( 'force' );407 }408 });409 410 ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW.411 $document.unbind( '.fullscreen' );412 s.$dfwTextarea.unbind('.wp-dfw-resize');413 });414 415 ps.subscribe( 'hiding', function() { // This event occurs while the overlay blocks the DFW UI.416 $body.removeClass( 'wp-fullscreen-active' );417 418 if ( s.$dfwTitle ) {419 $( '#wp-fullscreen-title-placeholder' ).before( s.$dfwTitle.removeClass('wp-fullscreen-title').css( 'width', '' ) ).remove();420 }421 422 s.$dfwWrap.removeClass( 'wp-fullscreen-wrap' );423 s.$editorContainer.css( 'width', '' );424 s.$dfwTextarea.add( '#' + s.id + '_ifr' ).height( s.origHeight );425 426 if ( s.editor ) {427 s.editor.execCommand( 'wpFullScreenOff' );428 }429 430 resetCssPosition( false );431 432 window.scrollTo( 0, uiScrollTop );433 $('#wpadminbar').show();434 });435 436 // This event occurs after DFW is removed.437 ps.subscribe( 'hidden', function() {438 s.visible = false;439 });440 441 api.refreshButtons = function( fade ) {442 if ( s.mode === 'html' ) {443 $('#wp-fullscreen-mode-bar').removeClass('wp-tmce-mode').addClass('wp-html-mode')444 .find('a').removeClass( 'active' ).filter('.wp-fullscreen-mode-html').addClass( 'active' );445 446 if ( fade ) {447 $('#wp-fullscreen-button-bar').fadeOut( 150, function(){448 $(this).addClass('wp-html-mode').fadeIn( 150 );449 });450 } else {451 $('#wp-fullscreen-button-bar').addClass('wp-html-mode');452 }453 } else if ( s.mode === 'tinymce' ) {454 $('#wp-fullscreen-mode-bar').removeClass('wp-html-mode').addClass('wp-tmce-mode')455 .find('a').removeClass( 'active' ).filter('.wp-fullscreen-mode-tinymce').addClass( 'active' );456 457 if ( fade ) {458 $('#wp-fullscreen-button-bar').fadeOut( 150, function(){459 $(this).removeClass('wp-html-mode').fadeIn( 150 );460 });461 } else {462 $('#wp-fullscreen-button-bar').removeClass('wp-html-mode');463 }464 }465 };466 467 /**468 * UI Elements469 *470 * Used for transitioning between states.471 */472 api.ui = {473 init: function() {474 var toolbar;475 476 s.toolbar = toolbar = $('#fullscreen-topbar');477 s.$fullscreenFader = $('#fullscreen-fader');478 s.$statusbar = $('#wp-fullscreen-status');479 s.hasTinymce = typeof tinymce !== 'undefined';480 481 if ( ! s.hasTinymce )482 $('#wp-fullscreen-mode-bar').hide();483 484 $document.keyup( function(e) {485 var c = e.keyCode || e.charCode, modKey;486 487 if ( ! s.visible ) {488 return;489 }490 491 if ( navigator.platform && navigator.platform.indexOf('Mac') !== -1 ) {492 modKey = e.ctrlKey; // Ctrl key for Mac493 } else {494 modKey = e.altKey; // Alt key for Win & Linux495 }496 497 if ( modKey && ( 61 === c || 107 === c || 187 === c ) ) { // +498 api.dfwWidth( 25 );499 e.preventDefault();500 }501 502 if ( modKey && ( 45 === c || 109 === c || 189 === c ) ) { // -503 api.dfwWidth( -25 );504 e.preventDefault();505 }506 507 if ( modKey && 48 === c ) { // 0508 api.dfwWidth( 0 );509 e.preventDefault();510 }511 });512 513 $( window ).on( 'keydown.wp-fullscreen', function( event ) {514 // Turn fullscreen off when Esc is pressed.515 if ( 27 === event.keyCode && s.visible ) {516 api.off();517 event.stopImmediatePropagation();518 }519 });520 521 if ( 'ontouchstart' in window ) {522 $body.addClass('wp-dfw-touch');523 }524 525 toolbar.on( 'mouseenter', function() {526 toggleUI('show');527 }).on( 'mouseleave', function() {528 toggleUI('autohide');529 });530 531 // Bind buttons532 $('#wp-fullscreen-buttons').on( 'click.wp-fullscreen', 'button', function( event ) {533 var command = event.currentTarget.id ? event.currentTarget.id.substr(6) : null;534 535 if ( s.editor && 'tinymce' === s.mode ) {536 switch( command ) {537 case 'bold':538 s.editor.execCommand('Bold');539 break;540 case 'italic':541 s.editor.execCommand('Italic');542 break;543 case 'bullist':544 s.editor.execCommand('InsertUnorderedList');545 break;546 case 'numlist':547 s.editor.execCommand('InsertOrderedList');548 break;549 case 'link':550 s.editor.execCommand('WP_Link');551 break;552 case 'unlink':553 s.editor.execCommand('unlink');554 break;555 case 'help':556 s.editor.execCommand('WP_Help');557 break;558 case 'blockquote':559 s.editor.execCommand('mceBlockQuote');560 break;561 }562 } else if ( command === 'link' && window.wpLink ) {563 window.wpLink.open();564 }565 566 if ( command === 'wp-media-library' && typeof wp !== 'undefined' && wp.media && wp.media.editor ) {567 wp.media.editor.open( s.id );568 }569 });570 },571 572 fade: function( before, during, after ) {573 if ( ! s.$fullscreenFader ) {574 api.ui.init();575 }576 577 // If any callback bound to before returns false, bail.578 if ( before && ! ps.publish( before ) ) {579 return;580 }581 582 api.fade.In( s.$fullscreenFader, 200, function() {583 if ( during ) {584 ps.publish( during );585 }586 587 api.fade.Out( s.$fullscreenFader, 200, function() {588 if ( after ) {589 ps.publish( after );590 }591 });592 });593 }594 };595 596 api.fade = {597 // Sensitivity to allow browsers to render the blank element before animating.598 sensitivity: 100,599 600 In: function( element, speed, callback, stop ) {601 602 callback = callback || $.noop;603 speed = speed || 400;604 stop = stop || false;605 606 if ( api.fade.transitions ) {607 if ( element.is(':visible') ) {608 element.addClass( 'fade-trigger' );609 return element;610 }611 612 element.show();613 element.first().one( transitionend, function() {614 callback();615 });616 617 setTimeout( function() { element.addClass( 'fade-trigger' ); }, this.sensitivity );618 } else {619 if ( stop ) {620 element.stop();621 }622 623 element.css( 'opacity', 1 );624 element.first().fadeIn( speed, callback );625 626 if ( element.length > 1 ) {627 element.not(':first').fadeIn( speed );628 }629 }630 631 return element;632 },633 634 Out: function( element, speed, callback, stop ) {635 636 callback = callback || $.noop;637 speed = speed || 400;638 stop = stop || false;639 640 if ( ! element.is(':visible') ) {641 return element;642 }643 644 if ( api.fade.transitions ) {645 element.first().one( transitionend, function() {646 if ( element.hasClass('fade-trigger') ) {647 return;648 }649 650 element.hide();651 callback();652 });653 setTimeout( function() { element.removeClass( 'fade-trigger' ); }, this.sensitivity );654 } else {655 if ( stop ) {656 element.stop();657 }658 659 element.first().fadeOut( speed, callback );660 661 if ( element.length > 1 ) {662 element.not(':first').fadeOut( speed );663 }664 }665 666 return element;667 },668 669 // Check if the browser supports CSS 3.0 transitions670 transitions: ( function() {671 var style = document.documentElement.style;672 673 return ( typeof style.WebkitTransition === 'string' ||674 typeof style.MozTransition === 'string' ||675 typeof style.OTransition === 'string' ||676 typeof style.transition === 'string' );677 })()678 };679 680 /**681 * Resize API682 *683 * Automatically updates textarea height.684 */685 api.bind_resize = function() {686 s.$dfwTextarea.on( 'keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize', function() {687 api.resizeTextarea();688 });689 };690 691 api.resizeTextarea = function() {692 var node = s.$dfwTextarea[0];693 694 if ( node.scrollHeight > node.clientHeight ) {695 node.style.height = node.scrollHeight + 50 + 'px';696 }697 };698 699 // Export700 window.wp = window.wp || {};701 window.wp.editor = window.wp.editor || {};702 window.wp.editor.fullscreen = api;703 704 })( jQuery, window ); -
src/wp-includes/class-wp-editor.php
52 52 * @type string $editor_class Extra classes to add to the editor textarea elemen. Default empty. 53 53 * @type bool $teeny Whether to output the minimal editor config. Examples include 54 54 * Press This and the Comment editor. Default false. 55 * @type bool $dfw Whether to replace the default fullscreen with "Distraction Free 56 * Writing". DFW requires specific DOM elements and css). Default false. 55 * @type bool $dfw Deprecated in 4.3. 57 56 * @type bool|array $tinymce Whether to load TinyMCE. Can be used to pass settings directly to 58 57 * TinyMCE using an array. Default true. 59 58 * @type bool|array $quicktags Whether to load Quicktags. Can be used to pass settings directly to … … 87 86 'editor_css' => '', 88 87 'editor_class' => '', 89 88 'teeny' => false, 90 'dfw' => false,91 89 '_content_editor_dfw' => false, 92 90 'tinymce' => true, 93 91 'quicktags' => true … … 274 272 if ( empty($qtInit['buttons']) ) 275 273 $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close'; 276 274 277 if ( $set['dfw'] )278 $qtInit['buttons'] .= ',fullscreen';279 280 275 if ( $set['_content_editor_dfw'] ) { 281 276 $qtInit['buttons'] .= ',dfw'; 282 277 } … … 460 455 } 461 456 } 462 457 463 if ( $set['dfw'] )464 $plugins[] = 'wpfullscreen';465 466 458 self::$plugins = $plugins; 467 459 self::$ext_plugins = $ext_plugins; 468 460 … … 628 620 unset($set['tinymce']['body_class']); 629 621 } 630 622 631 if ( $set['dfw'] ) {632 // replace the first 'fullscreen' with 'wp_fullscreen'633 if ( ($key = array_search('fullscreen', $mce_buttons)) !== false )634 $mce_buttons[$key] = 'wp_fullscreen';635 elseif ( ($key = array_search('fullscreen', $mce_buttons_2)) !== false )636 $mce_buttons_2[$key] = 'wp_fullscreen';637 elseif ( ($key = array_search('fullscreen', $mce_buttons_3)) !== false )638 $mce_buttons_3[$key] = 'wp_fullscreen';639 elseif ( ($key = array_search('fullscreen', $mce_buttons_4)) !== false )640 $mce_buttons_4[$key] = 'wp_fullscreen';641 }642 643 623 $mceInit = array ( 644 624 'selector' => "#$editor_id", 645 625 'resize' => 'vertical', … … 734 714 wp_enqueue_script('wplink'); 735 715 } 736 716 737 if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) )738 wp_enqueue_script('wp-fullscreen');739 740 717 if ( self::$has_medialib ) { 741 718 add_thickbox(); 742 719 wp_enqueue_script('media-upload'); … … 1224 1201 if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) ) 1225 1202 self::wp_link_dialog(); 1226 1203 1227 if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) )1228 self::wp_fullscreen_html();1229 1230 1204 /** 1231 1205 * Fires after any core TinyMCE editor instances are created. 1232 1206 * … … 1238 1212 } 1239 1213 1240 1214 public static function wp_fullscreen_html() { 1241 global $content_width; 1242 $post = get_post(); 1243 1244 $width = isset( $content_width ) && 800 > $content_width ? $content_width : 800; 1245 $width = $width + 22; // compensate for the padding and border 1246 $dfw_width = get_user_setting( 'dfw_width', $width ); 1247 $save = $post && $post->post_status == 'publish' ? __('Update') : __('Save'); 1248 1249 ?> 1250 <div id="wp-fullscreen-body" class="wp-core-ui<?php if ( is_rtl() ) echo ' rtl'; ?>" data-theme-width="<?php echo (int) $width; ?>" data-dfw-width="<?php echo (int) $dfw_width; ?>"> 1251 <div id="fullscreen-topbar"> 1252 <div id="wp-fullscreen-toolbar"> 1253 <div id="wp-fullscreen-close"><a href="#" onclick="wp.editor.fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div> 1254 <div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;"> 1255 1256 <div id="wp-fullscreen-mode-bar"> 1257 <div id="wp-fullscreen-modes" class="button-group"> 1258 <a class="button wp-fullscreen-mode-tinymce" href="#" onclick="wp.editor.fullscreen.switchmode( 'tinymce' ); return false;"><?php _e( 'Visual' ); ?></a> 1259 <a class="button wp-fullscreen-mode-html" href="#" onclick="wp.editor.fullscreen.switchmode( 'html' ); return false;"><?php _ex( 'Text', 'Name for the Text editor tab (formerly HTML)' ); ?></a> 1260 </div> 1261 </div> 1262 1263 <div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="mce-toolbar"> 1264 <?php 1265 1266 $buttons = array( 1267 // format: title, onclick, show in both editors 1268 'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'both' => false ), 1269 'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'both' => false ), 1270 'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'both' => false ), 1271 'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'both' => false ), 1272 'blockquote' => array( 'title' => __('Blockquote (Alt + Shift + Q)'), 'both' => false ), 1273 'wp-media-library' => array( 'title' => __('Media library (Alt + Shift + M)'), 'both' => true ), 1274 'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'both' => true ), 1275 'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'both' => false ), 1276 'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ), 1277 ); 1278 1279 /** 1280 * Filter the list of TinyMCE buttons for the fullscreen 1281 * 'Distraction-Free Writing' editor. 1282 * 1283 * @since 3.2.0 1284 * 1285 * @param array $buttons An array of TinyMCE buttons for the DFW editor. 1286 */ 1287 $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons ); 1288 1289 foreach ( $buttons as $button => $args ) { 1290 if ( 'separator' == $args ) { 1291 continue; 1292 } 1293 1294 $onclick = ! empty( $args['onclick'] ) ? ' onclick="' . $args['onclick'] . '"' : ''; 1295 $title = esc_attr( $args['title'] ); 1296 ?> 1297 1298 <div class="mce-widget mce-btn<?php if ( $args['both'] ) { ?> wp-fullscreen-both<?php } ?>"> 1299 <button type="button" aria-label="<?php echo $title; ?>" title="<?php echo $title; ?>"<?php echo $onclick; ?> id="wp_fs_<?php echo $button; ?>"> 1300 <i class="mce-ico mce-i-<?php echo $button; ?>"></i> 1301 </button> 1302 </div> 1303 <?php 1304 } 1305 1306 ?> 1307 1308 </div></div> 1309 1310 <div id="wp-fullscreen-save"> 1311 <input type="button" class="button button-primary right" value="<?php echo $save; ?>" onclick="wp.editor.fullscreen.save();" /> 1312 <span class="wp-fullscreen-saved-message"><?php if ( $post && $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span> 1313 <span class="wp-fullscreen-error-message"><?php _e('Save failed.'); ?></span> 1314 <span class="spinner"></span> 1315 </div> 1316 1317 </div> 1318 </div> 1319 </div> 1320 <div id="wp-fullscreen-statusbar"> 1321 <div id="wp-fullscreen-status"> 1322 <div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div> 1323 <div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div> 1324 </div> 1325 </div> 1326 </div> 1327 1328 <div class="fullscreen-overlay" id="fullscreen-overlay"></div> 1329 <div class="fullscreen-overlay fullscreen-fader fade-300" id="fullscreen-fader"></div> 1330 <?php 1215 _deprecated_function( __FUNCTION__, '4.3' ); 1331 1216 } 1332 1217 1333 1218 /** -
src/wp-includes/css/editor.css
299 299 cursor: pointer; 300 300 } 301 301 302 #wp-fullscreen-buttons .mce-btn,303 302 .mce-toolbar .mce-btn-group .mce-btn, 304 303 .qt-dfw { 305 304 border: 1px solid transparent; … … 311 310 filter: none; 312 311 } 313 312 314 #wp-fullscreen-buttons .mce-btn:hover,315 313 .mce-toolbar .mce-btn-group .mce-btn:hover, 316 #wp-fullscreen-buttons .mce-btn:focus,317 314 .mce-toolbar .mce-btn-group .mce-btn:focus, 318 315 .qt-dfw:hover, 319 316 .qt-dfw:focus { … … 326 323 } 327 324 328 325 .mce-toolbar .mce-btn-group .mce-btn.mce-active, 329 #wp-fullscreen-buttons .mce-btn.mce-active,330 326 .mce-toolbar .mce-btn-group .mce-btn:active, 331 #wp-fullscreen-buttons .mce-btn:active,332 327 .qt-dfw.active { 333 328 background: #ebebeb; 334 329 border-color: #999; … … 345 340 } 346 341 347 342 .mce-toolbar .mce-btn-group .mce-btn.mce-disabled:hover, 348 #wp-fullscreen-buttons .mce-btn.mce-disabled:hover, 349 .mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus, 350 #wp-fullscreen-buttons .mce-btn.mce-disabled:focus { 343 .mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus { 351 344 color: #a0a5aa; 352 345 background: none; 353 346 border-color: #ddd; … … 1111 1104 padding: 6px 7px; 1112 1105 } 1113 1106 1114 #wp-fullscreen-buttons .mce-btn,1115 1107 .mce-toolbar .mce-btn-group .mce-btn { 1116 1108 margin: 1px; 1117 1109 } … … 1607 1599 } 1608 1600 } 1609 1601 1610 /* Old TinyMCE 3.x modal */1611 /*1612 .clearlooks2 .mceTop {1613 border-bottom: 1px solid #ccc;1614 }1615 1616 .clearlooks2 .mceTop span {1617 font: 13px/24px "Open Sans", sans-serif;1618 color: #e5e5e5;1619 }1620 1621 .clearlooks2 .mceTop .mceLeft {1622 background: #444444;1623 border-color: transparent;1624 }1625 1626 .clearlooks2 .mceTop .mceRight {1627 background: #444444;1628 border-color: transparent;1629 }1630 1631 .clearlooks2 .mceMiddle {1632 clip: rect(24px auto auto auto);1633 }1634 1635 .clearlooks2 .mceMiddle .mceLeft {1636 background: #f1f1f1;1637 border-color: transparent;1638 }1639 1640 .clearlooks2 .mceMiddle .mceRight {1641 background: #f1f1f1;1642 border-color: transparent;1643 }1644 1645 .clearlooks2 .mceBottom {1646 background: #f1f1f1;1647 border-color: transparent;1648 }1649 1650 .clearlooks2 .mceBottom .mceLeft {1651 background: #f1f1f1;1652 border-color: transparent;1653 }1654 1655 .clearlooks2 .mceBottom .mceCenter {1656 background: #f1f1f1;1657 border-color: transparent;1658 }1659 1660 .clearlooks2 .mceBottom .mceRight {1661 background: #f1f1f1;1662 border-color: transparent;1663 }1664 1665 .clearlooks2 .mceClose,1666 .clearlooks2 .mceFocus .mceClose,1667 .clearlooks2 .mceFocus .mceClose:hover {1668 background-image: none;1669 }1670 .clearlooks2 .mceClose:before {1671 content: '\f158';1672 font: normal 20px/1 'dashicons';1673 speak: none;1674 -webkit-font-smoothing: antialiased;1675 -moz-osx-font-smoothing: grayscale;1676 color: #999;1677 padding-left: 12px;1678 }1679 1680 /* from colors.css1681 .clearlooks2 {1682 box-shadow: 0 5px 15px rgba(0,0,0,0.7);1683 }1684 1685 .clearlooks2 .mceMiddle span,1686 .clearlooks2 .mceMiddle .mceLeft,1687 .clearlooks2 .mceMiddle .mceRight,1688 .clearlooks2 .mceBottom,1689 .clearlooks2 .mceBottom .mceLeft,1690 .clearlooks2 .mceBottom .mceCenter,1691 .clearlooks2 .mceBottom .mceRight {1692 background-color: #fcfcfc;1693 }1694 1695 .clearlooks2 .mceTop span,1696 .clearlooks2 .mceFocus .mceTop span {1697 color: #23282d;1698 }1699 1700 .clearlooks2 .mceClose:before {1701 color: #999;1702 }1703 1704 .clearlooks2 .mceClose:hover:before {1705 color: #00a0d2;1706 }1707 */1708 /* Distraction-Free Writing mode1709 * =Overlay Styles1710 -------------------------------------------------------------- */1711 .fullscreen-overlay {1712 z-index: 100005;1713 display: none;1714 position: fixed;1715 top: 0;1716 bottom: 0;1717 left: 0;1718 right: 0;1719 -webkit-filter: inherit;1720 filter: inherit;1721 }1722 1723 .wp-fullscreen-active .fullscreen-overlay,1724 .wp-fullscreen-active #wp-fullscreen-body {1725 display: block;1726 }1727 1728 .fullscreen-fader {1729 z-index: 200000;1730 }1731 1732 .wp-fullscreen-active .fullscreen-fader,1733 .wp-core-ui.wp-fullscreen-active .postbox-container {1734 display: none;1735 }1736 1737 1602 /* =Overlay Body 1738 1603 -------------------------------------------------------------- */ 1739 1604 1740 #wp-fullscreen-body,1741 1605 .mce-fullscreen { 1742 1606 z-index: 100010; 1743 1607 } 1744 1608 1745 #wp-fullscreen-body {1746 display: none;1747 }1748 1749 .wp-fullscreen-wrap {1750 margin: 0;1751 padding: 0;1752 position: absolute;1753 left: 0;1754 right: 0;1755 bottom: 30px;1756 top: 60px;1757 z-index: 100015;1758 }1759 1760 .wp-fullscreen-wrap .wp-editor-container,1761 .wp-fullscreen-title,1762 #wp-fullscreen-central-toolbar {1763 -webkit-box-sizing: border-box;1764 -moz-box-sizing: border-box;1765 box-sizing: border-box;1766 max-width: 100%;1767 }1768 1769 .wp-fullscreen-active .wp-editor-tools,1770 .wp-fullscreen-active .quicktags-toolbar,1771 .wp-fullscreen-active .mce-toolbar-grp,1772 .wp-fullscreen-active .mce-statusbar {1773 display: none;1774 }1775 1776 #wp-fullscreen-statusbar {1777 position: fixed;1778 left: 0;1779 right: 0;1780 bottom: 0;1781 height: 30px;1782 z-index: 100020;1783 background: #fff;1784 -webkit-transition: height 0.2s;1785 transition: height 0.2s;1786 }1787 1788 #wp-fullscreen-status {1789 margin: 0 auto;1790 padding: 0;1791 }1792 1793 .wp-fullscreen-active .wp-fullscreen-title,1794 .wp-fullscreen-active .wp-fullscreen-title:focus,1795 .wp-fullscreen-active .wp-editor-container {1796 -webkit-border-radius: 0;1797 border-radius: 0;1798 border: 1px dashed transparent;1799 background: transparent;1800 -webkit-box-shadow: none;1801 box-shadow: none;1802 -webkit-transition: border-color 0.4s;1803 transition: border-color 0.4s;1804 }1805 1806 .wp-fullscreen-active .wp-editor-container {1807 margin: 0 auto 40px;1808 }1809 1810 .wp-fullscreen-active .wp-fullscreen-title {1811 font-size: 1.7em;1812 line-height: 100%;1813 outline: medium none;1814 padding: 3px 7px;1815 margin: 10px auto 30px;1816 display: block;1817 }1818 1819 #wp-fullscreen-tagline {1820 color: #82878c;1821 font-size: 18px;1822 float: right;1823 padding: 4px 0 0;1824 }1825 1826 /* =Top bar1827 -------------------------------------------------------------- */1828 #fullscreen-topbar {1829 background: #f5f5f5;1830 border-bottom: 1px solid #dedede;1831 height: 45px;1832 position: fixed;1833 left: 0;1834 right: 0;1835 top: 0;1836 width: 100%;1837 z-index: 100020;1838 -webkit-transition: opacity 0.4s;1839 transition: opacity 0.4s;1840 }1841 1842 #wp-fullscreen-toolbar {1843 padding: 6px 10px 0;1844 clear: both;1845 max-width: 1100px;1846 margin: 0 auto;1847 }1848 1849 #wp-fullscreen-mode-bar,1850 #wp-fullscreen-button-bar,1851 #wp-fullscreen-close {1852 float: left;1853 }1854 1855 #wp-fullscreen-count,1856 #wp-fullscreen-tagline {1857 display: inline-block;1858 }1859 1860 #wp-fullscreen-button-bar {1861 margin-top: 2px;1862 }1863 1864 #wp-fullscreen-save {1865 float: right;1866 padding: 2px 0 0;1867 min-width: 95px;1868 }1869 1870 #wp-fullscreen-count,1871 #wp-fullscreen-close {1872 padding: 5px 0 0;1873 }1874 1875 #wp-fullscreen-central-toolbar {1876 margin: auto;1877 padding: 0;1878 min-width: 620px;1879 }1880 1881 #wp-fullscreen-buttons > div {1882 float: left;1883 }1884 1885 #wp-fullscreen-mode-bar {1886 padding: 3px 14px 0 0;1887 }1888 1889 #wp-fullscreen-buttons .hidden {1890 display: none;1891 }1892 1893 #wp-fullscreen-buttons .disabled {1894 opacity: 0.5;1895 }1896 1897 #wp-fullscreen-buttons .mce-btn button {1898 margin: 0;1899 outline: 0 none;1900 border: 0 none;1901 white-space: nowrap;1902 width: auto;1903 background: none;1904 color: #32373c;1905 cursor: pointer;1906 font-size: 18px;1907 line-height: 20px;1908 overflow: visible;1909 text-align: center;1910 -webkit-box-sizing: border-box;1911 -moz-box-sizing: border-box;1912 box-sizing: border-box;1913 }1914 1915 .wp-html-mode #wp-fullscreen-buttons div {1916 display: none;1917 }1918 1919 .wp-html-mode #wp-fullscreen-buttons div.wp-fullscreen-both {1920 display: block;1921 }1922 1923 #wp-fullscreen-save img {1924 vertical-align: middle;1925 }1926 1927 #wp-fullscreen-save span {1928 display: none;1929 margin: 5px 6px 0;1930 float: left;1931 }1932 1933 /* =Thickbox Adjustments1934 -------------------------------------------------------------- */1935 .wp-fullscreen-active #TB_overlay {1936 z-index: 100050;1937 }1938 1939 .wp-fullscreen-active #TB_window {1940 z-index: 100051;1941 }1942 1943 /* Colors */1944 .fullscreen-overlay {1945 background: #fff;1946 }1947 1948 /* =CSS 3 transitions1949 -------------------------------------------------------------- */1950 1951 .wp-fullscreen-active #fullscreen-topbar {1952 -webkit-transition-duration: 0.8s;1953 transition-duration: 0.8s;1954 opacity: 0;1955 filter: alpha(opacity=0);1956 }1957 1958 .wp-fullscreen-active #wp-fullscreen-statusbar {1959 height: 0;1960 }1961 1962 .wp-fullscreen-active.wp-dfw-show-ui #fullscreen-topbar {1963 -webkit-transition-duration: 0.4s;1964 transition-duration: 0.4s;1965 opacity: 1;1966 filter: alpha(opacity=100);1967 }1968 1969 .wp-fullscreen-active.wp-dfw-show-ui #wp-fullscreen-statusbar {1970 height: 29px;1971 background: #f8f8f8;1972 border-top: 1px solid #eee;1973 }1974 1975 .wp-fullscreen-active .wp-fullscreen-title,1976 .wp-fullscreen-active .wp-editor-container {1977 -webkit-transition-duration: 0.8s;1978 transition-duration: 0.8s;1979 border-color: transparent;1980 }1981 1982 .wp-fullscreen-active.wp-dfw-show-ui .wp-fullscreen-title,1983 .wp-fullscreen-active.wp-dfw-show-ui .wp-editor-container {1984 -webkit-transition-duration: 0.4s;1985 transition-duration: 0.4s;1986 border-color: #ccc;1987 }1988 1989 .fade-1000,1990 .fade-600,1991 .fade-400,1992 .fade-300 {1993 opacity: 0;1994 -webkit-transition-property: opacity;1995 transition-property: opacity;1996 }1997 1998 .fade-1000 {1999 -webkit-transition-duration: 1s;2000 transition-duration: 1s;2001 }2002 2003 .fade-600 {2004 -webkit-transition-duration: 0.6s;2005 transition-duration: 0.6s;2006 }2007 2008 .fade-400 {2009 -webkit-transition-duration: 0.4s;2010 transition-duration: 0.4s;2011 }2012 2013 .fade-300 {2014 -webkit-transition-duration: 0.3s;2015 transition-duration: 0.3s;2016 }2017 2018 .fade-trigger {2019 opacity: 1;2020 }2021 2022 /* DFW on touch screen devices */2023 .wp-dfw-touch #fullscreen-topbar {2024 position: absolute;2025 opacity: 1;2026 }2027 2028 .wp-dfw-touch .wp-fullscreen-wrap .wp-editor-container,2029 .wp-dfw-touch .wp-fullscreen-title {2030 max-width: 700px;2031 }2032 2033 .wp-fullscreen-active.wp-dfw-touch .wp-fullscreen-title,2034 .wp-fullscreen-active.wp-dfw-touch .wp-editor-container {2035 border-color: #ccc;2036 }2037 2038 .wp-dfw-touch #wp-fullscreen-statusbar {2039 height: 30px;2040 }2041 2042 @media screen and ( max-width: 782px ) {2043 #wp-fullscreen-close,2044 #wp-fullscreen-central-toolbar,2045 #wp-fullscreen-mode-bar,2046 #wp-fullscreen-button-bar,2047 #wp-fullscreen-save {2048 display: inline-block;2049 }2050 2051 #fullscreen-topbar {2052 height: 85px;2053 }2054 2055 #wp-fullscreen-central-toolbar {2056 width: auto !important;2057 min-width: 0;2058 }2059 2060 #wp-fullscreen-close {2061 line-height: 30px;2062 vertical-align: top;2063 padding: 0 12px;2064 }2065 2066 #wp-fullscreen-button-bar {2067 position: absolute;2068 top: 45px;2069 left: 0;2070 }2071 2072 .wp-fullscreen-wrap {2073 top: 95px;2074 }2075 2076 #wp-fullscreen-save {2077 position: absolute;2078 right: 10px;2079 }2080 }2081 2082 @media screen and ( max-width: 480px ) {2083 #wp_fs_help {2084 display: none;2085 }2086 2087 .wp-fullscreen-wrap .wp-editor-container,2088 .wp-fullscreen-title {2089 width: 480px !important;2090 }2091 2092 body.wp-fullscreen-active {2093 width: 480px;2094 overflow: auto;2095 }2096 2097 #fullscreen-topbar,2098 .wp-fullscreen-wrap {2099 width: 480px;2100 }2101 2102 #fullscreen-topbar {2103 position: absolute;2104 }2105 2106 #wp-fullscreen-status {2107 width: auto !important;2108 max-width: 100%;2109 padding: 0 10px;2110 }2111 }2112 2113 1609 /* =Localization 2114 1610 -------------------------------------------------------------- */ 2115 1611 .rtl .wp-switch-editor, … … 2136 1632 @media print, 2137 1633 (-webkit-min-device-pixel-ratio: 1.25), 2138 1634 (min-resolution: 120dpi) { 2139 .wp-media-buttons .add_media span.wp-media-buttons-icon, 2140 #wp-fullscreen-buttons #wp_fs_image span.mce_image { 1635 .wp-media-buttons .add_media span.wp-media-buttons-icon { 2141 1636 background: none; 2142 1637 } 2143 1638 } -
src/wp-includes/css/media-views.css
2042 2042 } 2043 2043 2044 2044 /* Drag & drop on the editor upload */ 2045 #wp-fullscreen-body .uploader-editor,2046 2045 .wp-editor-wrap .uploader-editor { 2047 2046 background: rgba( 150, 150, 150, 0.9 ); 2048 2047 position: absolute; … … 2055 2054 text-align: center; 2056 2055 } 2057 2056 2058 #wp-fullscreen-body .uploader-editor {2059 background: rgba( 0, 86, 132, 0.9 );2060 position: fixed;2061 z-index: 100050; /* above the editor toolbar */2062 }2063 2064 .wp-editor-wrap.wp-fullscreen-wrap .uploader-editor {2065 opacity: 0;2066 }2067 2068 #wp-fullscreen-body .uploader-editor-content,2069 2057 .wp-editor-wrap .uploader-editor-content { 2070 2058 border: 1px dashed #fff; 2071 2059 position: absolute; … … 2075 2063 bottom: 10px; 2076 2064 } 2077 2065 2078 #wp-fullscreen-body .uploader-editor .uploader-editor-title,2079 2066 .wp-editor-wrap .uploader-editor .uploader-editor-title { 2080 2067 position: absolute; 2081 2068 top: 50%; … … 2097 2084 background: rgba( 0, 86, 132, 0.9 ); 2098 2085 } 2099 2086 2100 #wp-fullscreen-body .uploader-editor .uploader-editor-title,2101 2087 .wp-editor-wrap .uploader-editor.droppable .uploader-editor-title { 2102 2088 display: block; 2103 2089 } -
src/wp-includes/js/media/views/uploader/editor.js
1 1 /*globals wp, _, jQuery */ 2 2 3 3 /** 4 * Creates a dropzone on WP editor instances (elements with .wp-editor-wrap 5 * or #wp-fullscreen-body)and relays drag'n'dropped files to a media workflow.4 * Creates a dropzone on WP editor instances (elements with .wp-editor-wrap) 5 * and relays drag'n'dropped files to a media workflow. 6 6 * 7 7 * wp.media.view.EditorUploader 8 8 * … … 109 109 } 110 110 111 111 View.prototype.render.apply( this, arguments ); 112 $( '.wp-editor-wrap , #wp-fullscreen-body' ).each( _.bind( this.attach, this ) );112 $( '.wp-editor-wrap' ).each( _.bind( this.attach, this ) ); 113 113 return this; 114 114 }, 115 115 -
src/wp-includes/js/quicktags.js
283 283 } 284 284 } 285 285 286 if ( use && use.indexOf(',fullscreen,') !== -1 ) {287 theButtons.fullscreen = new qt.FullscreenButton();288 html += theButtons.fullscreen.html(name + '_');289 }290 291 286 if ( use && use.indexOf(',dfw,') !== -1 ) { 292 287 theButtons.dfw = new qt.DFWButton(); 293 288 html += theButtons.dfw.html( name + '_' ); … … 623 618 } 624 619 }; 625 620 626 qt.FullscreenButton = function() {627 qt.Button.call(this, 'fullscreen', quicktagsL10n.fullscreen, 'f', quicktagsL10n.toggleFullscreen);628 };629 qt.FullscreenButton.prototype = new qt.Button();630 qt.FullscreenButton.prototype.callback = function(e, c) {631 if ( ! c.id || typeof wp === 'undefined' || ! wp.editor || ! wp.editor.fullscreen ) {632 return;633 }634 635 wp.editor.fullscreen.on();636 };637 638 621 qt.DFWButton = function() { 639 622 qt.Button.call( this, 'dfw', '', 'f', quicktagsL10n.dfw ); 640 623 }; -
src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js
1 /* global tinymce */2 /**3 * WP Fullscreen (Distraction-Free Writing) TinyMCE plugin4 */5 tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {6 var settings = editor.settings;7 8 function fullscreenOn() {9 settings.wp_fullscreen = true;10 editor.dom.addClass( editor.getDoc().documentElement, 'wp-fullscreen' );11 // Start auto-resizing12 editor.execCommand( 'wpAutoResizeOn' );13 }14 15 function fullscreenOff() {16 settings.wp_fullscreen = false;17 editor.dom.removeClass( editor.getDoc().documentElement, 'wp-fullscreen' );18 // Stop auto-resizing19 editor.execCommand( 'wpAutoResizeOff' );20 }21 22 // For use from outside the editor.23 editor.addCommand( 'wpFullScreenOn', fullscreenOn );24 editor.addCommand( 'wpFullScreenOff', fullscreenOff );25 26 function getExtAPI() {27 return ( typeof wp !== 'undefined' && wp.editor && wp.editor.fullscreen );28 }29 30 // Toggle DFW mode. For use from inside the editor.31 function toggleFullscreen() {32 var fullscreen = getExtAPI();33 34 if ( fullscreen ) {35 if ( editor.getParam('wp_fullscreen') ) {36 fullscreen.off();37 } else {38 fullscreen.on();39 }40 }41 }42 43 editor.addCommand( 'wpFullScreen', toggleFullscreen );44 45 editor.on( 'keydown', function( event ) {46 var fullscreen;47 48 // Turn fullscreen off when Esc is pressed.49 if ( event.keyCode === 27 && ( fullscreen = getExtAPI() ) && fullscreen.settings.visible ) {50 fullscreen.off();51 }52 });53 54 editor.on( 'init', function() {55 // Set the editor when initializing from whitin DFW56 if ( editor.getParam('wp_fullscreen') ) {57 fullscreenOn();58 }59 });60 61 // Register buttons62 editor.addButton( 'wp_fullscreen', {63 tooltip: 'Distraction-free writing mode',64 shortcut: 'Alt+Shift+W',65 onclick: toggleFullscreen,66 classes: 'wp-fullscreen btn widget' // This overwrites all classes on the container!67 });68 69 editor.addMenuItem( 'wp_fullscreen', {70 text: 'Distraction-free writing mode',71 icon: 'wp_fullscreen',72 shortcut: 'Alt+Shift+W',73 context: 'view',74 onclick: toggleFullscreen75 });76 }); -
src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js
1 /* global tinymce */2 /**3 * WP Fullscreen (Distraction-Free Writing) TinyMCE plugin4 */5 tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {6 var settings = editor.settings;7 8 function fullscreenOn() {9 settings.wp_fullscreen = true;10 editor.dom.addClass( editor.getDoc().documentElement, 'wp-fullscreen' );11 // Start auto-resizing12 editor.execCommand( 'wpAutoResizeOn' );13 }14 15 function fullscreenOff() {16 settings.wp_fullscreen = false;17 editor.dom.removeClass( editor.getDoc().documentElement, 'wp-fullscreen' );18 // Stop auto-resizing19 editor.execCommand( 'wpAutoResizeOff' );20 }21 22 // For use from outside the editor.23 editor.addCommand( 'wpFullScreenOn', fullscreenOn );24 editor.addCommand( 'wpFullScreenOff', fullscreenOff );25 26 function getExtAPI() {27 return ( typeof wp !== 'undefined' && wp.editor && wp.editor.fullscreen );28 }29 30 // Toggle DFW mode. For use from inside the editor.31 function toggleFullscreen() {32 var fullscreen = getExtAPI();33 34 if ( fullscreen ) {35 if ( editor.getParam('wp_fullscreen') ) {36 fullscreen.off();37 } else {38 fullscreen.on();39 }40 }41 }42 43 editor.addCommand( 'wpFullScreen', toggleFullscreen );44 45 editor.on( 'keydown', function( event ) {46 var fullscreen;47 48 // Turn fullscreen off when Esc is pressed.49 if ( event.keyCode === 27 && ( fullscreen = getExtAPI() ) && fullscreen.settings.visible ) {50 fullscreen.off();51 }52 });53 54 editor.on( 'init', function() {55 // Set the editor when initializing from whitin DFW56 if ( editor.getParam('wp_fullscreen') ) {57 fullscreenOn();58 }59 });60 61 // Register buttons62 editor.addButton( 'wp_fullscreen', {63 tooltip: 'Distraction-free writing mode',64 shortcut: 'Alt+Shift+W',65 onclick: toggleFullscreen,66 classes: 'wp-fullscreen btn widget' // This overwrites all classes on the container!67 });68 69 editor.addMenuItem( 'wp_fullscreen', {70 text: 'Distraction-free writing mode',71 icon: 'wp_fullscreen',72 shortcut: 'Alt+Shift+W',73 context: 'view',74 onclick: toggleFullscreen75 });76 }); -
src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
71 71 box-shadow: none !important; 72 72 } 73 73 74 /* DFW mode */75 html.wp-fullscreen,76 html.wp-fullscreen body#tinymce {77 width: auto;78 max-width: none;79 min-height: 0;80 overflow: hidden;81 color: #333;82 background: transparent;83 }84 85 74 .aligncenter, 86 75 dl.aligncenter, 87 76 .html5-captions .wp-caption.aligncenter { -
src/wp-includes/script-loader.php
94 94 'enterURL' => __( 'Enter the URL' ), 95 95 'enterImageURL' => __( 'Enter the URL of the image' ), 96 96 'enterImageDescription' => __( 'Enter a description of the image' ), 97 'fullscreen' => __( 'fullscreen' ),98 'toggleFullscreen' => esc_attr__( 'Toggle fullscreen mode' ),99 97 'textdirection' => esc_attr__( 'text direction' ), 100 98 'toggleTextdirection' => esc_attr__( 'Toggle Editor Text Direction' ), 101 99 'dfw' => esc_attr__( 'Distraction-free writing mode' ) … … 105 103 106 104 $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), false, 1 ); 107 105 108 $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), false, 1 );109 110 106 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 ); 111 107 did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 112 108 'noPerm' => __('You do not have permission to do that.'),