Version Description
- Add the
gutenberg_can_edit_post_type
filter for plugins to add or remove support for custom post types. - Fix Classic Editor redirecting to Gutenberg when saving a post.
- Fix Classic Editor dropdown showing on post types that don't support Gutenberg.
- Fix Classic Editor dropdown hiding behind notices.
- Fix an issue with collapsing popover content.
Download this release
Release Info
Developer | pento |
Plugin | Gutenberg |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.5.2
- components/build/style.css +1 -1
- gutenberg.php +10 -16
- lib/register.php +92 -7
- readme.txt +8 -0
components/build/style.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-autocomplete__popover .components-popover__content{width:200px}.components-autocomplete__popover .components-autocomplete__results{list-style-type:none;padding:3px}.components-autocomplete__popover .components-autocomplete__results:empty{display:none}.components-autocomplete__result{margin-bottom:0;border:1px solid transparent;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px}.components-autocomplete__result.is-selected{box-shadow:none;color:#555d66;border-color:#555d66}.components-autocomplete__result:hover .components-button{color:#00a0d2}.components-autocomplete__result .components-button{color:#555d66;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;padding:6px;text-align:left}
|
2 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-button{background:none;border:none;outline:none;text-decoration:none;margin:0}.components-button:active{color:currentColor}.components-button:disabled{opacity:0.6}.components-button:not(:disabled){cursor:pointer}.components-button:focus{box-shadow:0 0 0 1px #33B3DB,0 0 2px 1px #33B3DB;outline:none}.components-button:active:focus{box-shadow:none}
|
3 |
-
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-popover{position:fixed;z-index:1000000;left:50%}.components-popover:before{border:8px solid #e2e4e7}.components-popover:after{border:8px solid #fff}.components-popover:before,.components-popover:after{content:"";position:absolute;margin-left:-10px;height:0;width:0;border-left-color:transparent;border-right-color:transparent;line-height:0}.components-popover.is-top{bottom:100%;margin-top:-8px}.components-popover.is-top:before{bottom:-8px}.components-popover.is-top:after{bottom:-6px}.components-popover.is-top:before,.components-popover.is-top:after{border-top-style:solid;border-bottom:none}.components-popover.is-bottom{top:100%;margin-top:8px}.components-popover.is-bottom:before{top:-8px}.components-popover.is-bottom:after{top:-6px}.components-popover.is-bottom:before,.components-popover.is-bottom:after{border-bottom-style:solid;border-top:none}.components-popover__content{position:absolute;box-shadow:0px 3px 20px rgba(25,30,35,0.1),0px 1px 3px rgba(25,30,35,0.1);border:1px solid #e2e4e7;background:#fff}.components-popover.is-top .components-popover__content{bottom:100%}.components-popover.is-center .components-popover__content{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.components-popover.is-right .components-popover__content{position:absolute;left:100%;margin-left:-24px}.components-popover.is-left .components-popover__content{position:absolute;right:100%;margin-right:-24px}
|
4 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-drop-zone{position:absolute;top:0;right:0;bottom:0;left:0;z-index:100;visibility:hidden;opacity:0;transition:0.3s opacity, 0.3s background-color, 0s visibility 0.3s;border:2px solid #0071a1;border-radius:2px}.components-drop-zone.is-active{opacity:1;visibility:visible;transition:0.3s opacity, 0.3s background-color}.components-drop-zone.is-dragging-over-element{background-color:rgba(0,113,161,0.8)}.components-drop-zone.is-dragging-over-element .components-drop-zone__content{display:block}.components-drop-zone__content{position:absolute;top:50%;left:0;right:0;z-index:110;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:100%;text-align:center;color:#fff;transition:-webkit-transform 0.2s ease-in-out;transition:transform 0.2s ease-in-out;transition:transform 0.2s ease-in-out, -webkit-transform 0.2s ease-in-out;display:none}.components-drop-zone.is-dragging-over-element .components-drop-zone__content{-webkit-transform:translateY(-50%) scale(1.05);transform:translateY(-50%) scale(1.05)}.components-drop-zone__content-icon,.components-drop-zone__content-text{display:block}.components-drop-zone__content-icon{margin:0 auto;line-height:0}
|
5 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-dropdown-menu{padding:3px;display:-webkit-box;display:-ms-flexbox;display:flex}.components-dropdown-menu .components-dropdown-menu__toggle{width:auto;margin:0px;padding:4px;border:1px solid transparent;border-radius:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.components-dropdown-menu .components-dropdown-menu__toggle.is-active,.components-dropdown-menu .components-dropdown-menu__toggle.is-active:hover{background-color:#555d66;color:#fff}.components-dropdown-menu .components-dropdown-menu__toggle:focus:before{top:-3px;right:-3px;bottom:-3px;left:-3px}.components-dropdown-menu .components-dropdown-menu__toggle:hover,.components-dropdown-menu .components-dropdown-menu__toggle:focus,.components-dropdown-menu .components-dropdown-menu__toggle:not(:disabled):hover{box-shadow:none;outline:none;color:#555d66;border-color:#555d66}.components-dropdown-menu .components-dropdown-menu__toggle.is-active>svg,.components-dropdown-menu .components-dropdown-menu__toggle.is-active:hover>svg{background-color:#555d66;color:#fff}.components-dropdown-menu__popover .components-popover__content{width:200px}.components-dropdown-menu__menu{width:100%;padding:3px 3px 0 3px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px;line-height:1.4}.components-dropdown-menu__menu .components-dropdown-menu__menu-item{width:100%;margin-bottom:3px;padding:6px;background:none;border:1px solid transparent;border-radius:0;outline:none;color:#555d66;cursor:pointer}.components-dropdown-menu__menu .components-dropdown-menu__menu-item:hover,.components-dropdown-menu__menu .components-dropdown-menu__menu-item:focus,.components-dropdown-menu__menu .components-dropdown-menu__menu-item:not(:disabled):hover{box-shadow:none;color:#555d66;border-color:#555d66}.components-dropdown-menu__menu .components-dropdown-menu__menu-item .dashicon{margin-right:5px}
|
6 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-icon-button{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:8px;margin:0;border:none;background:none;color:#555d66;position:relative;width:36px;overflow:hidden}.components-icon-button .dashicon{display:inline-block;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto}@media (min-width: 782px){.components-icon-button{width:auto}}.components-icon-button:not(:disabled):hover{color:#00a0d2}
|
1 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-autocomplete__popover .components-popover__content{width:200px}.components-autocomplete__popover .components-autocomplete__results{list-style-type:none;padding:3px}.components-autocomplete__popover .components-autocomplete__results:empty{display:none}.components-autocomplete__result{margin-bottom:0;border:1px solid transparent;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px}.components-autocomplete__result.is-selected{box-shadow:none;color:#555d66;border-color:#555d66}.components-autocomplete__result:hover .components-button{color:#00a0d2}.components-autocomplete__result .components-button{color:#555d66;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;padding:6px;text-align:left}
|
2 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-button{background:none;border:none;outline:none;text-decoration:none;margin:0}.components-button:active{color:currentColor}.components-button:disabled{opacity:0.6}.components-button:not(:disabled){cursor:pointer}.components-button:focus{box-shadow:0 0 0 1px #33B3DB,0 0 2px 1px #33B3DB;outline:none}.components-button:active:focus{box-shadow:none}
|
3 |
+
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-popover{position:fixed;z-index:1000000;left:50%}.components-popover:before{border:8px solid #e2e4e7}.components-popover:after{border:8px solid #fff}.components-popover:before,.components-popover:after{content:"";position:absolute;margin-left:-10px;height:0;width:0;border-left-color:transparent;border-right-color:transparent;line-height:0}.components-popover.is-top{bottom:100%;margin-top:-8px}.components-popover.is-top:before{bottom:-8px}.components-popover.is-top:after{bottom:-6px}.components-popover.is-top:before,.components-popover.is-top:after{border-top-style:solid;border-bottom:none}.components-popover.is-bottom{top:100%;margin-top:8px}.components-popover.is-bottom:before{top:-8px}.components-popover.is-bottom:after{top:-6px}.components-popover.is-bottom:before,.components-popover.is-bottom:after{border-bottom-style:solid;border-top:none}.components-popover__content{position:absolute;box-shadow:0px 3px 20px rgba(25,30,35,0.1),0px 1px 3px rgba(25,30,35,0.1);border:1px solid #e2e4e7;background:#fff;min-width:240px}.components-popover.is-top .components-popover__content{bottom:100%}.components-popover.is-center .components-popover__content{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.components-popover.is-right .components-popover__content{position:absolute;left:100%;margin-left:-24px}.components-popover.is-left .components-popover__content{position:absolute;right:100%;margin-right:-24px}
|
4 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-drop-zone{position:absolute;top:0;right:0;bottom:0;left:0;z-index:100;visibility:hidden;opacity:0;transition:0.3s opacity, 0.3s background-color, 0s visibility 0.3s;border:2px solid #0071a1;border-radius:2px}.components-drop-zone.is-active{opacity:1;visibility:visible;transition:0.3s opacity, 0.3s background-color}.components-drop-zone.is-dragging-over-element{background-color:rgba(0,113,161,0.8)}.components-drop-zone.is-dragging-over-element .components-drop-zone__content{display:block}.components-drop-zone__content{position:absolute;top:50%;left:0;right:0;z-index:110;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:100%;text-align:center;color:#fff;transition:-webkit-transform 0.2s ease-in-out;transition:transform 0.2s ease-in-out;transition:transform 0.2s ease-in-out, -webkit-transform 0.2s ease-in-out;display:none}.components-drop-zone.is-dragging-over-element .components-drop-zone__content{-webkit-transform:translateY(-50%) scale(1.05);transform:translateY(-50%) scale(1.05)}.components-drop-zone__content-icon,.components-drop-zone__content-text{display:block}.components-drop-zone__content-icon{margin:0 auto;line-height:0}
|
5 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-dropdown-menu{padding:3px;display:-webkit-box;display:-ms-flexbox;display:flex}.components-dropdown-menu .components-dropdown-menu__toggle{width:auto;margin:0px;padding:4px;border:1px solid transparent;border-radius:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.components-dropdown-menu .components-dropdown-menu__toggle.is-active,.components-dropdown-menu .components-dropdown-menu__toggle.is-active:hover{background-color:#555d66;color:#fff}.components-dropdown-menu .components-dropdown-menu__toggle:focus:before{top:-3px;right:-3px;bottom:-3px;left:-3px}.components-dropdown-menu .components-dropdown-menu__toggle:hover,.components-dropdown-menu .components-dropdown-menu__toggle:focus,.components-dropdown-menu .components-dropdown-menu__toggle:not(:disabled):hover{box-shadow:none;outline:none;color:#555d66;border-color:#555d66}.components-dropdown-menu .components-dropdown-menu__toggle.is-active>svg,.components-dropdown-menu .components-dropdown-menu__toggle.is-active:hover>svg{background-color:#555d66;color:#fff}.components-dropdown-menu__popover .components-popover__content{width:200px}.components-dropdown-menu__menu{width:100%;padding:3px 3px 0 3px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px;line-height:1.4}.components-dropdown-menu__menu .components-dropdown-menu__menu-item{width:100%;margin-bottom:3px;padding:6px;background:none;border:1px solid transparent;border-radius:0;outline:none;color:#555d66;cursor:pointer}.components-dropdown-menu__menu .components-dropdown-menu__menu-item:hover,.components-dropdown-menu__menu .components-dropdown-menu__menu-item:focus,.components-dropdown-menu__menu .components-dropdown-menu__menu-item:not(:disabled):hover{box-shadow:none;color:#555d66;border-color:#555d66}.components-dropdown-menu__menu .components-dropdown-menu__menu-item .dashicon{margin-right:5px}
|
6 |
@-webkit-keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@keyframes animate_fade{from{opacity:0;-webkit-transform:translateY(4px);transform:translateY(4px)}to{opacity:1;-webkit-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@keyframes move_background{from{background-position:0 0}to{background-position:28px 0}}@-webkit-keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}@keyframes loading_fade{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}.components-icon-button{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:8px;margin:0;border:none;background:none;color:#555d66;position:relative;width:36px;overflow:hidden}.components-icon-button .dashicon{display:inline-block;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto}@media (min-width: 782px){.components-icon-button{width:auto}}.components-icon-button:not(:disabled):hover{color:#00a0d2}
|
gutenberg.php
CHANGED
@@ -3,15 +3,15 @@
|
|
3 |
* Plugin Name: Gutenberg
|
4 |
* Plugin URI: https://github.com/WordPress/gutenberg
|
5 |
* Description: Printing since 1440. This is the development plugin for the new block editor in core. <strong>Meant for development, do not run on real sites.</strong>
|
6 |
-
* Version: 1.5.
|
7 |
* Author: Gutenberg Team
|
8 |
*
|
9 |
* @package gutenberg
|
10 |
*/
|
11 |
|
12 |
### BEGIN AUTO-GENERATED DEFINES
|
13 |
-
define( 'GUTENBERG_VERSION', '1.5.
|
14 |
-
define( 'GUTENBERG_GIT_COMMIT', '
|
15 |
### END AUTO-GENERATED DEFINES
|
16 |
|
17 |
gutenberg_pre_init();
|
@@ -137,18 +137,7 @@ function gutenberg_init( $return, $post ) {
|
|
137 |
return false;
|
138 |
}
|
139 |
|
140 |
-
|
141 |
-
$post_type_object = get_post_type_object( $post_type );
|
142 |
-
|
143 |
-
if ( 'attachment' === $post_type ) {
|
144 |
-
return false;
|
145 |
-
}
|
146 |
-
|
147 |
-
if ( ! $post_type_object->show_in_rest ) {
|
148 |
-
return false;
|
149 |
-
}
|
150 |
-
|
151 |
-
if ( ! post_type_supports( $post_type, 'editor' ) ) {
|
152 |
return false;
|
153 |
}
|
154 |
|
@@ -350,7 +339,7 @@ add_action( 'admin_init', 'gutenberg_add_edit_link_filters' );
|
|
350 |
* @return array Updated post actions.
|
351 |
*/
|
352 |
function gutenberg_add_edit_link( $actions, $post ) {
|
353 |
-
if (
|
354 |
return $actions;
|
355 |
}
|
356 |
|
@@ -421,6 +410,10 @@ add_filter( 'admin_url', 'gutenberg_modify_add_new_button_url', 10, 2 );
|
|
421 |
* @since 1.5.0
|
422 |
*/
|
423 |
function gutenberg_replace_default_add_new_button() {
|
|
|
|
|
|
|
|
|
424 |
?>
|
425 |
<style type="text/css">
|
426 |
.split-page-title-action {
|
@@ -482,6 +475,7 @@ function gutenberg_replace_default_add_new_button() {
|
|
482 |
display: block;
|
483 |
position: absolute;
|
484 |
margin-top: 3px;
|
|
|
485 |
}
|
486 |
|
487 |
.split-page-title-action .dropdown.visible a {
|
3 |
* Plugin Name: Gutenberg
|
4 |
* Plugin URI: https://github.com/WordPress/gutenberg
|
5 |
* Description: Printing since 1440. This is the development plugin for the new block editor in core. <strong>Meant for development, do not run on real sites.</strong>
|
6 |
+
* Version: 1.5.2
|
7 |
* Author: Gutenberg Team
|
8 |
*
|
9 |
* @package gutenberg
|
10 |
*/
|
11 |
|
12 |
### BEGIN AUTO-GENERATED DEFINES
|
13 |
+
define( 'GUTENBERG_VERSION', '1.5.2' );
|
14 |
+
define( 'GUTENBERG_GIT_COMMIT', 'dcc3341c78c29d9379428273a07ff575134ec637' );
|
15 |
### END AUTO-GENERATED DEFINES
|
16 |
|
17 |
gutenberg_pre_init();
|
137 |
return false;
|
138 |
}
|
139 |
|
140 |
+
if ( ! gutenberg_can_edit_post( $post ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
return false;
|
142 |
}
|
143 |
|
339 |
* @return array Updated post actions.
|
340 |
*/
|
341 |
function gutenberg_add_edit_link( $actions, $post ) {
|
342 |
+
if ( ! gutenberg_can_edit_post( $post ) ) {
|
343 |
return $actions;
|
344 |
}
|
345 |
|
410 |
* @since 1.5.0
|
411 |
*/
|
412 |
function gutenberg_replace_default_add_new_button() {
|
413 |
+
global $typenow;
|
414 |
+
if ( ! gutenberg_can_edit_post_type( $typenow ) ) {
|
415 |
+
return;
|
416 |
+
}
|
417 |
?>
|
418 |
<style type="text/css">
|
419 |
.split-page-title-action {
|
475 |
display: block;
|
476 |
position: absolute;
|
477 |
margin-top: 3px;
|
478 |
+
z-index: 1;
|
479 |
}
|
480 |
|
481 |
.split-page-title-action .dropdown.visible a {
|
lib/register.php
CHANGED
@@ -248,26 +248,65 @@ function gutenberg_collect_meta_box_data() {
|
|
248 |
/**
|
249 |
* Return whether the post can be edited in Gutenberg and by the current user.
|
250 |
*
|
251 |
-
* Gutenberg depends on the REST API, and if the post type is not shown in the
|
252 |
-
* REST API, then the post cannot be edited in Gutenberg.
|
253 |
-
*
|
254 |
* @since 0.5.0
|
255 |
*
|
256 |
-
* @param int $post_id Post.
|
257 |
* @return bool Whether the post can be edited with Gutenberg.
|
258 |
*/
|
259 |
function gutenberg_can_edit_post( $post_id ) {
|
260 |
$post = get_post( $post_id );
|
261 |
-
if ( ! $post
|
262 |
return false;
|
263 |
}
|
264 |
-
|
265 |
-
if (
|
|
|
|
|
|
|
|
|
266 |
return false;
|
267 |
}
|
|
|
268 |
return current_user_can( 'edit_post', $post_id );
|
269 |
}
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
/**
|
272 |
* Determine whether a post has blocks.
|
273 |
*
|
@@ -319,3 +358,49 @@ function gutenberg_register_rest_routes() {
|
|
319 |
$controller->register_routes();
|
320 |
}
|
321 |
add_action( 'rest_api_init', 'gutenberg_register_rest_routes' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
/**
|
249 |
* Return whether the post can be edited in Gutenberg and by the current user.
|
250 |
*
|
|
|
|
|
|
|
251 |
* @since 0.5.0
|
252 |
*
|
253 |
+
* @param int|WP_Post $post_id Post.
|
254 |
* @return bool Whether the post can be edited with Gutenberg.
|
255 |
*/
|
256 |
function gutenberg_can_edit_post( $post_id ) {
|
257 |
$post = get_post( $post_id );
|
258 |
+
if ( ! $post ) {
|
259 |
return false;
|
260 |
}
|
261 |
+
|
262 |
+
if ( 'trash' === $post->post_status ) {
|
263 |
+
return false;
|
264 |
+
}
|
265 |
+
|
266 |
+
if ( ! gutenberg_can_edit_post_type( $post->post_type ) ) {
|
267 |
return false;
|
268 |
}
|
269 |
+
|
270 |
return current_user_can( 'edit_post', $post_id );
|
271 |
}
|
272 |
|
273 |
+
/**
|
274 |
+
* Return whether the post type can be edited in Gutenberg.
|
275 |
+
*
|
276 |
+
* Gutenberg depends on the REST API, and if the post type is not shown in the
|
277 |
+
* REST API, then the post cannot be edited in Gutenberg.
|
278 |
+
*
|
279 |
+
* @since 1.5.2
|
280 |
+
*
|
281 |
+
* @param string $post_type The post type.
|
282 |
+
* @return bool Wehther the post type can be edited with Gutenberg.
|
283 |
+
*/
|
284 |
+
function gutenberg_can_edit_post_type( $post_type ) {
|
285 |
+
$can_edit = true;
|
286 |
+
if ( ! post_type_exists( $post_type ) ) {
|
287 |
+
$can_edit = false;
|
288 |
+
}
|
289 |
+
|
290 |
+
if ( ! post_type_supports( $post_type, 'editor' ) ) {
|
291 |
+
$can_edit = false;
|
292 |
+
}
|
293 |
+
|
294 |
+
$post_type_object = get_post_type_object( $post_type );
|
295 |
+
if ( $post_type_object && ! $post_type_object->show_in_rest ) {
|
296 |
+
$can_edit = false;
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Filter to allow plugins to enable/disable Gutenberg for particular post types.
|
301 |
+
*
|
302 |
+
* @since 1.5.2
|
303 |
+
*
|
304 |
+
* @param bool $can_edit Whether the post type can be edited or not.
|
305 |
+
* @param string $post_type The post type being checked.
|
306 |
+
*/
|
307 |
+
return apply_filters( 'gutenberg_can_edit_post_type', $can_edit, $post_type );
|
308 |
+
}
|
309 |
+
|
310 |
/**
|
311 |
* Determine whether a post has blocks.
|
312 |
*
|
358 |
$controller->register_routes();
|
359 |
}
|
360 |
add_action( 'rest_api_init', 'gutenberg_register_rest_routes' );
|
361 |
+
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Injects a hidden input in the edit form to propagate the information that classic editor is selected.
|
365 |
+
*
|
366 |
+
* @since 1.5.2
|
367 |
+
*/
|
368 |
+
function gutenberg_remember_classic_editor_when_saving_posts() {
|
369 |
+
?>
|
370 |
+
<input type="hidden" name="classic-editor" />
|
371 |
+
<?php
|
372 |
+
}
|
373 |
+
add_action( 'edit_form_top', 'gutenberg_remember_classic_editor_when_saving_posts' );
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Appends a query argument to the redirect url to make sure it gets redirected to the classic editor.
|
377 |
+
*
|
378 |
+
* @since 1.5.2
|
379 |
+
*
|
380 |
+
* @param string $url Redirect url.
|
381 |
+
* @return string Redirect url.
|
382 |
+
*/
|
383 |
+
function gutenberg_redirect_to_classic_editor_when_saving_posts( $url ) {
|
384 |
+
if ( isset( $_REQUEST['classic-editor'] ) ) {
|
385 |
+
$url = add_query_arg( 'classic-editor', '', $url );
|
386 |
+
}
|
387 |
+
return $url;
|
388 |
+
}
|
389 |
+
add_filter( 'redirect_post_location', 'gutenberg_redirect_to_classic_editor_when_saving_posts', 10, 1 );
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Appends a query argument to the edit url to make sure it gets redirected to the classic editor.
|
393 |
+
*
|
394 |
+
* @since 1.5.2
|
395 |
+
*
|
396 |
+
* @param string $url Edit url.
|
397 |
+
* @return string Edit url.
|
398 |
+
*/
|
399 |
+
function gutenberg_link_revisions_to_classic_editor( $url ) {
|
400 |
+
global $pagenow;
|
401 |
+
if ( 'revision.php' === $pagenow ) {
|
402 |
+
$url = add_query_arg( 'classic-editor', '', $url );
|
403 |
+
}
|
404 |
+
return $url;
|
405 |
+
}
|
406 |
+
add_filter( 'get_edit_post_link', 'gutenberg_link_revisions_to_classic_editor' );
|
readme.txt
CHANGED
@@ -32,6 +32,14 @@ The more the merrier! To get started, check out our <a href="https://github.com/
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
= 1.5.1 =
|
36 |
|
37 |
* New design for the inserter with tabs at the top and more space for text.
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 1.5.2 =
|
36 |
+
|
37 |
+
* Add the `gutenberg_can_edit_post_type` filter for plugins to add or remove support for custom post types.
|
38 |
+
* Fix Classic Editor redirecting to Gutenberg when saving a post.
|
39 |
+
* Fix Classic Editor dropdown showing on post types that don't support Gutenberg.
|
40 |
+
* Fix Classic Editor dropdown hiding behind notices.
|
41 |
+
* Fix an issue with collapsing popover content.
|
42 |
+
|
43 |
= 1.5.1 =
|
44 |
|
45 |
* New design for the inserter with tabs at the top and more space for text.
|