-
Notifications
You must be signed in to change notification settings - Fork 813
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gutenberg: Use Fullscreen mode in Calypsoify (#10368)
#### Changes proposed in this Pull Request: Calypsoify uses now the Gutenberg Fullscreen Mode instead of injecting the close button and including custom CSS. We realized that the Gutenberg Fullscreen Mode is providing a UI very similar to Calypso, so by using it we can simplify the code and make it more maintainable. ~This PR also includes a small fix for an 500 error raised when Jetpack is checking if Gutenberg is enabled.~ Fixed on #10389. Fixes Automattic/wp-calypso#27937 #### Testing instructions: * Edit a post in Gutenberg * Append `&calypsoify=1` to the URL and reload the post editor. * Make sure that the editor is displayed in Fullscreen Mode. * Check that there are no options for disabling the Fullscreen Mode when clicking on the "More" button. * Confirm that the back button uses now an icon and it redirects to the posts list in Calypso when clicking on it. #### Screenshots: Before <img width="1275" alt="screen shot 2018-10-22 at 14 12 45" src="https://user-images.githubusercontent.com/1233880/47292141-68ba7c80-d606-11e8-9372-b9de36037b21.png"> After <img width="1278" alt="screen shot 2018-10-22 at 15 17 53" src="https://user-images.githubusercontent.com/1233880/47294639-f9e12180-d60d-11e8-8031-b715aab319d2.png"> #### Proposed changelog entry for your changes: I don't think this is needed given Calypsoify is mainly used internally. Anyway, if needed, this is my proposed changelog: > Calypsoify uses now the Gutenberg Fullscreen Mode instead of injecting the close button and including custom CSS.
- Loading branch information
Showing
3 changed files
with
34 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
/* global calypsoifyGutenberg */ | ||
/* eslint-disable no-var */ | ||
/* global wp, calypsoifyGutenberg */ | ||
|
||
jQuery( function( $ ) { | ||
if ( wp && wp.data && wp.data.select && ! wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ) ) { | ||
wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); | ||
} | ||
|
||
var editPostHeaderInception = setInterval( function() { | ||
var $editPostHeader = $( '.edit-post-header' ); | ||
if ( $editPostHeader.length < 1 ) { | ||
var $closeButton = $( '.edit-post-fullscreen-mode-close__toolbar a' ); | ||
if ( $closeButton.length < 1 ) { | ||
return; | ||
} | ||
clearInterval( editPostHeaderInception ); | ||
|
||
$( '<button/>', { | ||
'class': 'editor-ground-control__back', | ||
html: calypsoifyGutenberg.closeLabel | ||
} ) | ||
.bind( 'click', function() { | ||
window.location.href = calypsoifyGutenberg.closeUrl; | ||
} ) | ||
.prependTo( $editPostHeader ); | ||
$closeButton.attr( 'href', calypsoifyGutenberg.closeUrl ); | ||
} ); | ||
|
||
$( 'body.revision-php a' ).each( function() { | ||
var href = $( this ).attr( 'href' ); | ||
$( this ).attr( 'href', href.replace( '&classic-editor', '' ) ); | ||
}, 300 ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters