Full Site Editing - Version 0.3

Version Description

  • Update modal UI.
Download this release

Release Info

Developer obenland
Plugin Icon wp plugin Full Site Editing
Version 0.3
Comparing to
See all releases

Code changes from version 0.2.2 to 0.3

Files changed (42) hide show
  1. full-site-editing-plugin.php +2 -3
  2. full-site-editing/blocks/navigation-menu/edit.js +1 -5
  3. full-site-editing/blocks/navigation-menu/index.js +1 -2
  4. full-site-editing/blocks/navigation-menu/index.php +4 -3
  5. full-site-editing/blocks/navigation-menu/style.scss +26 -22
  6. full-site-editing/blocks/post-content/edit.js +89 -74
  7. full-site-editing/blocks/post-content/index.js +4 -7
  8. full-site-editing/blocks/post-content/save.js +9 -0
  9. full-site-editing/blocks/post-content/style.scss +14 -0
  10. full-site-editing/blocks/site-description/edit.js +41 -112
  11. full-site-editing/blocks/site-description/index.js +6 -1
  12. full-site-editing/blocks/site-description/index.php +1 -0
  13. full-site-editing/blocks/site-description/style.scss +6 -0
  14. full-site-editing/blocks/site-logo/index.php +15 -5
  15. full-site-editing/blocks/site-title/edit.js +37 -64
  16. full-site-editing/blocks/site-title/index.php +4 -4
  17. full-site-editing/blocks/site-title/style.scss +25 -10
  18. full-site-editing/blocks/template/edit.js +86 -78
  19. full-site-editing/blocks/template/style.scss +5 -0
  20. full-site-editing/blocks/usePrevious.js +22 -0
  21. full-site-editing/blocks/useSiteOptions.js +116 -0
  22. full-site-editing/class-full-site-editing.php +163 -48
  23. full-site-editing/dist/full-site-editing.css +1 -1
  24. full-site-editing/dist/full-site-editing.js +2 -2
  25. full-site-editing/dist/full-site-editing.rtl.css +1 -1
  26. full-site-editing/editor/block-inserter/index.js +39 -0
  27. full-site-editing/editor/block-inserter/post-content-block-appender.js +26 -0
  28. full-site-editing/editor/index.js +5 -0
  29. full-site-editing/editor/template-validity-override/index.js +25 -0
  30. full-site-editing/index.js +1 -0
  31. full-site-editing/page-fse.php +58 -0
  32. full-site-editing/plugins/close-button-override/index.js +11 -4
  33. full-site-editing/utils/class-a8c-wp-template-data-inserter.php +9 -7
  34. full-site-editing/utils/class-a8c-wp-template.php +18 -0
  35. full-site-editing/utils/replace-template-parts.php +0 -68
  36. readme.txt +3 -2
  37. starter-page-templates/class-starter-page-templates.php +1 -1
  38. starter-page-templates/dist/starter-page-templates.css +1 -1
  39. starter-page-templates/dist/starter-page-templates.js +1 -1
  40. starter-page-templates/dist/starter-page-templates.rtl.css +1 -1
  41. starter-page-templates/page-template-modal/index.js +9 -15
  42. starter-page-templates/page-template-modal/styles/starter-page-templates-editor.scss +30 -33
full-site-editing-plugin.php CHANGED
@@ -2,7 +2,7 @@
2
/**
3
* Plugin Name: Full Site Editing
4
* Description: Enhances your page creation workflow within the Block Editor.
5
- * Version: 0.2.2
6
* Author: Automattic
7
* Author URI: https://automattic.com/wordpress-plugins/
8
* License: GPLv2 or later
@@ -18,7 +18,7 @@
18
*
19
* @var string
20
*/
21
- define( 'A8C_FSE_VERSION', '0.2.2' );
22
23
/**
24
* Load Full Site Editing.
@@ -45,7 +45,6 @@ function a8c_load_full_site_editing() {
45
require_once __DIR__ . '/full-site-editing/class-a8c-rest-templates-controller.php';
46
require_once __DIR__ . '/full-site-editing/class-full-site-editing.php';
47
require_once __DIR__ . '/full-site-editing/utils/class-a8c-wp-template.php';
48
- require_once __DIR__ . '/full-site-editing/utils/replace-template-parts.php';
49
50
Full_Site_Editing::get_instance();
51
}
2
/**
3
* Plugin Name: Full Site Editing
4
* Description: Enhances your page creation workflow within the Block Editor.
5
+ * Version: 0.3
6
* Author: Automattic
7
* Author URI: https://automattic.com/wordpress-plugins/
8
* License: GPLv2 or later
18
*
19
* @var string
20
*/
21
+ define( 'A8C_FSE_VERSION', '0.3' );
22
23
/**
24
* Load Full Site Editing.
45
require_once __DIR__ . '/full-site-editing/class-a8c-rest-templates-controller.php';
46
require_once __DIR__ . '/full-site-editing/class-full-site-editing.php';
47
require_once __DIR__ . '/full-site-editing/utils/class-a8c-wp-template.php';
48
49
Full_Site_Editing::get_instance();
50
}
full-site-editing/blocks/navigation-menu/edit.js CHANGED
@@ -34,11 +34,7 @@ const NavigationMenuEdit = ( { attributes } ) => {
34
/>
35
</Toolbar>
36
</BlockControls>
37
- <ServerSideRender
38
- attributes={ attributes }
39
- block="a8c/navigation-menu"
40
- className="wp-block-a8c-navigation-menu"
41
- />
42
</Fragment>
43
);
44
};
34
/>
35
</Toolbar>
36
</BlockControls>
37
+ <ServerSideRender attributes={ attributes } block="a8c/navigation-menu" />
38
</Fragment>
39
);
40
};
full-site-editing/blocks/navigation-menu/index.js CHANGED
@@ -24,13 +24,12 @@ registerBlockType( 'a8c/navigation-menu', {
24
category: 'layout',
25
supports: {
26
html: false,
27
- multiple: false,
28
reusable: false,
29
},
30
attributes: {
31
themeLocation: {
32
type: 'string',
33
- default: 'main-1',
34
},
35
},
36
edit,
24
category: 'layout',
25
supports: {
26
html: false,
27
reusable: false,
28
},
29
attributes: {
30
themeLocation: {
31
type: 'string',
32
+ default: 'menu-1',
33
},
34
},
35
edit,
full-site-editing/blocks/navigation-menu/index.php CHANGED
@@ -85,11 +85,12 @@ function render_navigation_menu_block( $attributes ) {
85
ob_start();
86
// phpcs:disable WordPress.WP.I18n.NonSingularStringLiteralText
87
?>
88
- <nav class="<?php echo esc_attr( $wrapper_attr['class'] ); ?>" aria-label="<?php esc_attr_e( $wrapper_attr['label'], 'twentynineteen' ); ?>">
89
<?php
90
- wp_nav_menu( get_menu_params_by_theme_location( $location ) );
91
?>
92
- </nav><!-- #site-navigation -->
93
<?php
94
return ob_get_clean();
95
}
85
ob_start();
86
// phpcs:disable WordPress.WP.I18n.NonSingularStringLiteralText
87
?>
88
+ <nav class="<?php echo esc_attr( $wrapper_attr['class'] . ' wp-block-a8c-navigation-menu' ); ?>" aria-label="<?php esc_attr_e( $wrapper_attr['label'], 'twentynineteen' ); ?>">
89
<?php
90
+ wp_nav_menu( get_menu_params_by_theme_location( $location ) );
91
?>
92
+ </nav>
93
+ <!-- #site-navigation -->
94
<?php
95
return ob_get_clean();
96
}
full-site-editing/blocks/navigation-menu/style.scss CHANGED
@@ -1,4 +1,4 @@
1
- .wp-block-a8c-navigation-menu .main-navigation {
2
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
3
font-size: 1.125em;
4
font-weight: 700;
@@ -8,61 +8,65 @@
8
-webkit-font-smoothing: antialiased;
9
}
10
11
- .wp-block-a8c-navigation-menu .main-navigation .main-menu {
12
display: inline-block;
13
margin: 0;
14
padding: 0;
15
}
16
17
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li {
18
color: #0073aa;
19
display: inline;
20
position: relative;
21
}
22
23
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li > a {
24
font-weight: 700;
25
color: #0073aa;
26
margin-right: 0.5rem;
27
}
28
29
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li:last-child > a, .main-navigation .main-menu > li:last-child.menu-item-has-children .submenu-expand {
30
margin-right: 0;
31
}
32
33
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li.menu-item-has-children > a {
34
margin-right: 0.125rem;
35
}
36
37
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li.menu-item-has-children {
38
display: inline-block;
39
position: inherit;
40
}
41
42
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li.menu-item-has-children .submenu-expand {
43
display: inline-block;
44
margin-right: 0.25rem;
45
}
46
47
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li.menu-item-has-children .submenu-expand svg {
48
position: relative;
49
top: 0.3rem;
50
}
51
52
- .wp-block-a8c-navigation-menu .main-navigation .main-menu > li > a:hover, .main-navigation .main-menu > li > a:hover + svg {
53
color: #005177;
54
}
55
56
- .wp-block-a8c-navigation-menu .main-navigation svg {
57
transition: fill 120ms ease-in-out;
58
fill: currentColor;
59
}
60
61
- .wp-block-a8c-navigation-menu .main-navigation a {
62
text-decoration: none;
63
}
64
65
- .wp-block-a8c-navigation-menu .main-navigation button {
66
display: inline-block;
67
border: none;
68
padding: 0;
@@ -81,55 +85,55 @@
81
-moz-appearance: none;
82
}
83
84
- .wp-block-a8c-navigation-menu .main-menu-more {
85
display: none;
86
}
87
88
- .wp-block-a8c-navigation-menu .social-navigation {
89
line-height: 1.25;
90
margin-top: calc( 1rem / 2 );
91
text-align: left;
92
}
93
94
- .wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu {
95
content: '';
96
display: inline-block;
97
margin: 0;
98
padding: 0;
99
}
100
101
- .wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu li {
102
display: inline-block;
103
vertical-align: bottom;
104
vertical-align: -webkit-baseline-middle;
105
list-style: none;
106
}
107
108
- .wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu li a svg {
109
display: block;
110
width: 32px;
111
height: 32px;
112
transform: translateZ( 0 );
113
}
114
115
- .wp-block-a8c-navigation-menu .footer-navigation .footer-menu {
116
display: inline;
117
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
118
font-size: 0.71111em;
119
padding-left: 0;
120
}
121
122
- .wp-block-a8c-navigation-menu .footer-navigation .footer-menu li {
123
display: inline;
124
margin-right: 1rem;
125
}
126
127
- .wp-block-a8c-navigation-menu .footer-navigation .footer-menu a {
128
text-decoration: none;
129
color: #767676;
130
}
131
132
- .wp-block-a8c-navigation-menu .footer-navigation .footer-menu a:hover {
133
text-decoration: none;
134
color: #0073aa;
135
}
1
+ .wp-block-a8c-navigation-menu.main-navigation {
2
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
3
font-size: 1.125em;
4
font-weight: 700;
8
-webkit-font-smoothing: antialiased;
9
}
10
11
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu {
12
display: inline-block;
13
margin: 0;
14
padding: 0;
15
}
16
17
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li {
18
color: #0073aa;
19
display: inline;
20
position: relative;
21
}
22
23
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li > a {
24
font-weight: 700;
25
color: #0073aa;
26
margin-right: 0.5rem;
27
}
28
29
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li:last-child > a, .main-navigation .main-menu > li:last-child.menu-item-has-children .submenu-expand {
30
margin-right: 0;
31
}
32
33
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li.menu-item-has-children > a {
34
margin-right: 0.125rem;
35
}
36
37
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li.menu-item-has-children {
38
display: inline-block;
39
position: inherit;
40
}
41
42
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li.menu-item-has-children .submenu-expand {
43
display: inline-block;
44
margin-right: 0.25rem;
45
}
46
47
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li.menu-item-has-children .submenu-expand svg {
48
position: relative;
49
top: 0.3rem;
50
}
51
52
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu > li > a:hover, .main-navigation .main-menu > li > a:hover + svg {
53
color: #005177;
54
}
55
56
+ .wp-block-a8c-navigation-menu.main-navigation .main-menu-more {
57
+ display: none;
58
+ }
59
+
60
+ .wp-block-a8c-navigation-menu.main-navigation svg {
61
transition: fill 120ms ease-in-out;
62
fill: currentColor;
63
}
64
65
+ .wp-block-a8c-navigation-menu.main-navigation a {
66
text-decoration: none;
67
}
68
69
+ .wp-block-a8c-navigation-menu.main-navigation button {
70
display: inline-block;
71
border: none;
72
padding: 0;
85
-moz-appearance: none;
86
}
87
88
+ .wp-block-a8c-navigation-menu.main-menu-more {
89
display: none;
90
}
91
92
+ .wp-block-a8c-navigation-menu.social-navigation {
93
line-height: 1.25;
94
margin-top: calc( 1rem / 2 );
95
text-align: left;
96
}
97
98
+ .wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu {
99
content: '';
100
display: inline-block;
101
margin: 0;
102
padding: 0;
103
}
104
105
+ .wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu li {
106
display: inline-block;
107
vertical-align: bottom;
108
vertical-align: -webkit-baseline-middle;
109
list-style: none;
110
}
111
112
+ .wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu li a svg {
113
display: block;
114
width: 32px;
115
height: 32px;
116
transform: translateZ( 0 );
117
}
118
119
+ .wp-block-a8c-navigation-menu.footer-navigation .footer-menu {
120
display: inline;
121
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
122
font-size: 0.71111em;
123
padding-left: 0;
124
}
125
126
+ .wp-block-a8c-navigation-menu.footer-navigation .footer-menu li {
127
display: inline;
128
margin-right: 1rem;
129
}
130
131
+ .wp-block-a8c-navigation-menu.footer-navigation .footer-menu a {
132
text-decoration: none;
133
color: #767676;
134
}
135
136
+ .wp-block-a8c-navigation-menu.footer-navigation .footer-menu a:hover {
137
text-decoration: none;
138
color: #0073aa;
139
}
full-site-editing/blocks/post-content/edit.js CHANGED
@@ -1,4 +1,6 @@
1
/* eslint-disable wpcalypso/jsx-classname-namespace */
2
/**
3
* External dependencies
4
*/
@@ -11,8 +13,8 @@ import { get } from 'lodash';
11
import { IconButton, Placeholder, Toolbar } from '@wordpress/components';
12
import { compose, withState } from '@wordpress/compose';
13
import { withSelect } from '@wordpress/data';
14
- import { BlockControls } from '@wordpress/editor';
15
- import { Fragment, RawHTML } from '@wordpress/element';
16
import { __, sprintf } from '@wordpress/i18n';
17
18
/**
@@ -20,85 +22,98 @@ import { __, sprintf } from '@wordpress/i18n';
20
*/
21
import PostAutocomplete from '../../components/post-autocomplete';
22
23
- const PostContentEdit = compose(
24
- withState( {
25
- isEditing: false,
26
- selectedPostId: undefined,
27
- selectedPostType: undefined,
28
- } ),
29
- withSelect( ( select, { selectedPostId, selectedPostType } ) => {
30
- const { getEntityRecord } = select( 'core' );
31
- return {
32
- selectedPost: getEntityRecord( 'postType', selectedPostType, selectedPostId ),
33
- };
34
- } )
35
- )( ( { attributes, isEditing, selectedPost, setState } ) => {
36
- const { align } = attributes;
37
-
38
- const toggleEditing = () => setState( { isEditing: ! isEditing } );
39
40
- const onSelectPost = ( { id, type } ) => {
41
- setState( {
42
isEditing: false,
43
selectedPostId: id,
44
selectedPostType: type,
45
} );
46
- };
47
48
- const showToggleButton = ! isEditing || !! selectedPost;
49
- const showPlaceholder = isEditing || ! selectedPost;
50
- const showPreview = ! isEditing && !! selectedPost;
51
52
- return (
53
- <Fragment>
54
- { showToggleButton && (
55
- <BlockControls>
56
- <Toolbar>
57
- <IconButton
58
- className={ classNames( 'components-icon-button components-toolbar__control', {
59
- 'is-active': isEditing,
60
- } ) }
61
- label={ __( 'Change Preview' ) }
62
- onClick={ toggleEditing }
63
- icon="edit"
64
- />
65
- </Toolbar>
66
- </BlockControls>
67
- ) }
68
- <div
69
- className={ classNames( 'post-content-block', {
70
- [ `align${ align }` ]: align,
71
- } ) }
72
- >
73
- { showPlaceholder && (
74
- <Placeholder
75
- icon="layout"
76
- label={ __( 'Content Slot' ) }
77
- instructions={ __( 'Placeholder for a post or a page.' ) }
78
- >
79
- <div className="post-content-block__selector">
80
- <div>{ __( 'Select something to preview:' ) }</div>
81
- <PostAutocomplete
82
- initialValue={ get( selectedPost, [ 'title', 'rendered' ] ) }
83
- onSelectPost={ onSelectPost }
84
- postType={ [ 'page', 'post' ] }
85
/>
86
- { !! selectedPost && (
87
- <a href={ `?post=${ selectedPost.id }&action=edit` }>
88
- { sprintf( __( 'Edit "%s"' ), get( selectedPost, [ 'title', 'rendered' ], '' ) ) }
89
- </a>
90
- ) }
91
- </div>
92
- </Placeholder>
93
) }
94
- { showPreview && (
95
- <RawHTML className="post-content-block__preview">
96
- { get( selectedPost, [ 'content', 'rendered' ] ) }
97
- </RawHTML>
98
- ) }
99
- </div>
100
- </Fragment>
101
- );
102
- } );
103
104
- export default PostContentEdit;
1
/* eslint-disable wpcalypso/jsx-classname-namespace */
2
+ /* global fullSiteEditing */
3
+
4
/**
5
* External dependencies
6
*/
13
import { IconButton, Placeholder, Toolbar } from '@wordpress/components';
14
import { compose, withState } from '@wordpress/compose';
15
import { withSelect } from '@wordpress/data';
16
+ import { BlockControls, InnerBlocks, PostTitle } from '@wordpress/editor';
17
+ import { Component, Fragment, RawHTML } from '@wordpress/element';
18
import { __, sprintf } from '@wordpress/i18n';
19
20
/**
22
*/
23
import PostAutocomplete from '../../components/post-autocomplete';
24
25
+ class PostContentEdit extends Component {
26
+ toggleEditing() {
27
+ const { isEditing, setState } = this.props;
28
+ setState( { isEditing: ! isEditing } );
29
+ }
30
31
+ onSelectPost( { id, type } ) {
32
+ this.props.setState( {
33
isEditing: false,
34
selectedPostId: id,
35
selectedPostType: type,
36
} );
37
+ }
38
+
39
+ render() {
40
+ const { attributes, isEditing, selectedPost } = this.props;
41
+ const { align } = attributes;
42
43
+ const isTemplatePostType = 'wp_template' === fullSiteEditing.editorPostType;
44
+ const showToggleButton = isTemplatePostType && ( ! isEditing || !! selectedPost );
45
+ const showPlaceholder = isTemplatePostType && ( isEditing || ! selectedPost );
46
+ const showPreview = isTemplatePostType && ! isEditing && !! selectedPost;
47
+ const showInnerBlocks = ! isTemplatePostType;
48
49
+ return (
50
+ <Fragment>
51
+ { showToggleButton && (
52
+ <BlockControls>
53
+ <Toolbar>
54
+ <IconButton
55
+ className={ classNames( 'components-icon-button components-toolbar__control', {
56
+ 'is-active': isEditing,
57
+ } ) }
58
+ label={ __( 'Change Preview' ) }
59
+ onClick={ this.toggleEditing }
60
+ icon="edit"
61
/>
62
+ </Toolbar>
63
+ </BlockControls>
64
) }
65
+ <div
66
+ className={ classNames( 'post-content-block', {
67
+ [ `align${ align }` ]: align,
68
+ } ) }
69
+ >
70
+ <PostTitle />
71
+ { showInnerBlocks && <InnerBlocks templateLock={ false } /> }
72
+ { showPlaceholder && (
73
+ <Placeholder
74
+ icon="layout"
75
+ label={ __( 'Content Slot' ) }
76
+ instructions={ __( 'Placeholder for a post or a page.' ) }
77
+ >
78
+ <div className="post-content-block__selector">
79
+ <div>{ __( 'Select something to preview:' ) }</div>
80
+ <PostAutocomplete
81
+ initialValue={ get( selectedPost, [ 'title', 'rendered' ] ) }
82
+ onSelectPost={ this.onSelectPost }
83
+ postType={ [ 'page', 'post' ] }
84
+ />
85
+ { !! selectedPost && (
86
+ <a href={ `?post=${ selectedPost.id }&action=edit` }>
87
+ { sprintf(
88
+ __( 'Edit "%s"' ),
89
+ get( selectedPost, [ 'title', 'rendered' ], '' )
90
+ ) }
91
+ </a>
92
+ ) }
93
+ </div>
94
+ </Placeholder>
95
+ ) }
96
+ { showPreview && (
97
+ <RawHTML className="post-content-block__preview">
98
+ { get( selectedPost, [ 'content', 'rendered' ] ) }
99
+ </RawHTML>
100
+ ) }
101
+ </div>
102
+ </Fragment>
103
+ );
104
+ }
105
+ }
106
107
+ export default compose( [
108
+ withState( {
109
+ isEditing: false,
110
+ selectedPostId: undefined,
111
+ selectedPostType: undefined,
112
+ } ),
113
+ withSelect( ( select, { selectedPostId, selectedPostType } ) => {
114
+ const { getEntityRecord } = select( 'core' );
115
+ return {
116
+ selectedPost: getEntityRecord( 'postType', selectedPostType, selectedPostId ),
117
+ };
118
+ } ),
119
+ ] )( PostContentEdit );
full-site-editing/blocks/post-content/index.js CHANGED
@@ -1,19 +1,16 @@
1
- /* global fullSiteEditing */
2
/**
3
- * WordPress dependencies
4
*/
5
import { registerBlockType } from '@wordpress/blocks';
6
- import { InnerBlocks } from '@wordpress/editor';
7
import { __ } from '@wordpress/i18n';
8
9
/**
10
* Internal dependencies
11
*/
12
import edit from './edit';
13
import './style.scss';
14
15
- const isTemplatePostType = 'wp_template' === fullSiteEditing.editorPostType;
16
-
17
registerBlockType( 'a8c/post-content', {
18
title: __( 'Content Slot' ),
19
description: __( 'Placeholder for a post or a page.' ),
@@ -26,6 +23,6 @@ registerBlockType( 'a8c/post-content', {
26
multiple: false,
27
reusable: false,
28
},
29
- edit: isTemplatePostType ? edit : () => <InnerBlocks />,
30
- save: isTemplatePostType ? () => null : () => <InnerBlocks.Content />,
31
} );
1
/**
2
+ * External dependencies
3
*/
4
import { registerBlockType } from '@wordpress/blocks';
5
import { __ } from '@wordpress/i18n';
6
7
/**
8
* Internal dependencies
9
*/
10
import edit from './edit';
11
+ import save from './save';
12
import './style.scss';
13
14
registerBlockType( 'a8c/post-content', {
15
title: __( 'Content Slot' ),
16
description: __( 'Placeholder for a post or a page.' ),
23
multiple: false,
24
reusable: false,
25
},
26
+ edit,
27
+ save,
28
} );
full-site-editing/blocks/post-content/save.js ADDED
@@ -0,0 +1,9 @@
1
+ /* global fullSiteEditing */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { InnerBlocks } from '@wordpress/editor';
7
+
8
+ const isTemplatePostType = 'wp_template' === fullSiteEditing.editorPostType;
9
+ export default ( isTemplatePostType ? () => null : () => <InnerBlocks.Content /> );
full-site-editing/blocks/post-content/style.scss CHANGED
@@ -19,3 +19,17 @@
19
display: table;
20
}
21
}
19
display: table;
20
}
21
}
22
+
23
+ .post-content-block .editor-post-title {
24
+ display: none;
25
+ }
26
+
27
+ .show-post-title-before-content {
28
+ .editor-post-title {
29
+ display: none;
30
+ }
31
+
32
+ .post-content-block .editor-post-title {
33
+ display: block;
34
+ }
35
+ }
full-site-editing/blocks/site-description/edit.js CHANGED
@@ -1,124 +1,54 @@
1
/**
2
* External dependencies
3
*/
4
- import apiFetch from '@wordpress/api-fetch';
5
import { PlainText } from '@wordpress/editor';
6
- import { withNotices, Button } from '@wordpress/components';
7
import { compose } from '@wordpress/compose';
8
- import { withSelect } from '@wordpress/data';
9
- import { Component, Fragment } from '@wordpress/element';
10
import { __ } from '@wordpress/i18n';
11
12
- class SiteDescriptionEdit extends Component {
13
- state = {
14
- description: __( 'Site description loading…' ),
15
- initialDescription: '',
16
- isDirty: false,
17
- isSaving: false,
18
- };
19
-
20
- componentDidMount() {
21
- const { noticeOperations } = this.props;
22
-
23
- return apiFetch( { path: '/wp/v2/settings' } )
24
- .then( ( { description } ) =>
25
- this.setState( { initialDescription: description, description } )
26
- )
27
- .catch( ( { message } ) => {
28
- noticeOperations.createErrorNotice( message );
29
- } );
30
- }
31
-
32
- componentDidUpdate( prevProps ) {
33
- const { description, initialDescription } = this.state;
34
- const { shouldUpdateSiteOption, isSelected } = this.props;
35
-
36
- const descriptionUnchanged = description && description.trim() === initialDescription.trim();
37
- const descriptionIsEmpty = ! description || description.trim().length === 0;
38
-
39
- // Reset to initial value if user de-selects the block with an empty value.
40
- if ( ! isSelected && prevProps.isSelected && descriptionIsEmpty ) {
41
- this.revertDescription();
42
- }
43
-
44
- // Don't do anything further if we shouldn't update the site option or the value is unchanged.
45
- if ( ! shouldUpdateSiteOption || descriptionUnchanged ) {
46
- return;
47
- }
48
-
49
- if ( ! prevProps.shouldUpdateSiteOption && shouldUpdateSiteOption ) {
50
- this.saveSiteDescription( description );
51
- }
52
- }
53
-
54
- onSave = () => {
55
- const { description, initialDescription } = this.state;
56
- const descriptionUnchanged = description && description.trim() === initialDescription.trim();
57
-
58
- if ( descriptionUnchanged ) {
59
- this.setState( { isDirty: false } );
60
- return;
61
- }
62
- this.saveSiteDescription( description );
63
- };
64
-
65
- saveSiteDescription( description ) {
66
- const { noticeOperations } = this.props;
67
- this.setState( { isSaving: true } );
68
- apiFetch( { path: '/wp/v2/settings', method: 'POST', data: { description } } )
69
- .then( () => this.updateInitialDescription() )
70
- .catch( ( { message } ) => {
71
- noticeOperations.createErrorNotice( message );
72
- this.revertDescription();
73
- } );
74
- }
75
-
76
- revertDescription = () =>
77
- this.setState( {
78
- description: this.state.initialDescription,
79
- isSaving: false,
80
- } );
81
-
82
- updateInitialDescription = () => {
83
- this.setState( {
84
- initialDescription: this.state.description,
85
- isDirty: false,
86
- isSaving: false,
87
- } );
88
- };
89
-
90
- render() {
91
- const { className, noticeUI } = this.props;
92
- const { description, isDirty, isSaving } = this.state;
93
-
94
- return (
95
- <Fragment>
96
- { noticeUI }
97
- <PlainText
98
- className={ className }
99
- value={ description }
100
- onChange={ value => this.setState( { description: value, isDirty: true } ) }
101
- placeholder={ __( 'Site Description' ) }
102
- aria-label={ __( 'Site Description' ) }
103
- />
104
- { isDirty && (
105
- <Button
106
- ref={ this.editButton }
107
- isLarge
108
- className="site-description__save-button"
109
- disabled={ isSaving }
110
- isBusy={ isSaving }
111
- onClick={ this.onSave }
112
- >
113
- { __( 'Save' ) }
114
- </Button>
115
- ) }
116
- </Fragment>
117
- );
118
- }
119
}
120
121
export default compose( [
122
withSelect( select => {
123
const { isSavingPost, isPublishingPost, isAutosavingPost, isCurrentPostPublished } = select(
124
'core/editor'
@@ -129,5 +59,4 @@ export default compose( [
129
! isAutosavingPost(),
130
};
131
} ),
132
- withNotices,
133
] )( SiteDescriptionEdit );
1
/**
2
* External dependencies
3
*/
4
import { PlainText } from '@wordpress/editor';
5
import { compose } from '@wordpress/compose';
6
+ import { withSelect, withDispatch } from '@wordpress/data';
7
+ import { Fragment } from '@wordpress/element';
8
import { __ } from '@wordpress/i18n';
9
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import useSiteOptions from '../useSiteOptions';
14
+
15
+ function SiteDescriptionEdit( {
16
+ className,
17
+ createErrorNotice,
18
+ shouldUpdateSiteOption,
19
+ isSelected,
20
+ setAttributes,
21
+ } ) {
22
+ const inititalDescription = __( 'Site description loading…' );
23
+
24
+ const { siteOptions, handleChange } = useSiteOptions(
25
+ 'description',
26
+ inititalDescription,
27
+ createErrorNotice,
28
+ isSelected,
29
+ shouldUpdateSiteOption,
30
+ setAttributes
31
+ );
32
+
33
+ const { option } = siteOptions;
34
+
35
+ return (
36
+ <Fragment>
37
+ <PlainText
38
+ className={ className }
39
+ value={ option }
40
+ onChange={ value => handleChange( value ) }
41
+ placeholder={ __( 'Site Description' ) }
42
+ aria-label={ __( 'Site Description' ) }
43
+ />
44
+ </Fragment>
45
+ );
46
}
47
48
export default compose( [
49
+ withDispatch( dispatch => ( {
50
+ createErrorNotice: dispatch( 'core/notices' ).createErrorNotice,
51
+ } ) ),
52
withSelect( select => {
53
const { isSavingPost, isPublishingPost, isAutosavingPost, isCurrentPostPublished } = select(
54
'core/editor'
59
! isAutosavingPost(),
60
};
61
} ),
62
] )( SiteDescriptionEdit );
full-site-editing/blocks/site-description/index.js CHANGED
@@ -13,7 +13,12 @@ import './style.scss';
13
registerBlockType( 'a8c/site-description', {
14
title: __( 'Site Description' ),
15
description: __( 'Site description, also known as the tagline.' ),
16
- icon: 'layout',
17
category: 'layout',
18
supports: {
19
html: false,
13
registerBlockType( 'a8c/site-description', {
14
title: __( 'Site Description' ),
15
description: __( 'Site description, also known as the tagline.' ),
16
+ icon: (
17
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
18
+ <path fill="none" d="M0 0h24v24H0z" />
19
+ <path d="M4 9h16v2H4V9zm0 4h10v2H4v-2z" />
20
+ </svg>
21
+ ),
22
category: 'layout',
23
supports: {
24
html: false,
full-site-editing/blocks/site-description/index.php CHANGED
@@ -8,6 +8,7 @@
8
/**
9
* Renders the site description (tagline) block.
10
*
11
* @return string
12
*/
13
function render_site_description_block( $attributes ) {
8
/**
9
* Renders the site description (tagline) block.
10
*
11
+ * @param array $attributes Block attributes.
12
* @return string
13
*/
14
function render_site_description_block( $attributes ) {
full-site-editing/blocks/site-description/style.scss CHANGED
@@ -7,10 +7,16 @@
7
font-weight: normal;
8
letter-spacing: -0.01em;
9
margin: 0;
10
}
11
}
12
.site-description__save-button {
13
margin-left: auto;
14
display: block;
15
}
16
}
7
font-weight: normal;
8
letter-spacing: -0.01em;
9
margin: 0;
10
+ box-shadow: none;
11
+ background-color: transparent;
12
}
13
}
14
.site-description__save-button {
15
margin-left: auto;
16
display: block;
17
}
18
+ .site-title:not( :empty ) + .site-description:not( :empty )::before {
19
+ content: '\2014';
20
+ margin: 0 0.2em;
21
+ }
22
}
full-site-editing/blocks/site-logo/index.php CHANGED
@@ -6,20 +6,25 @@
6
*/
7
8
/**
9
- * Renders a site-logo.
10
*
11
* @param array $attributes Block attributes.
12
* @param string $content Block content.
13
* @return string
14
*/
15
function render_site_logo( $attributes, $content ) {
16
- if ( $attributes[ 'editorPreview' ] === true ) {
17
return render_site_logo_editor_preview( $attributes, $content );
18
}
19
return render_site_logo_publish( $attributes, $content );
20
}
21
22
- function render_site_logo_publish( $attributes, $content ) {
23
if ( ! function_exists( 'get_custom_logo' ) || ! function_exists( 'has_custom_logo' ) ) {
24
return '';
25
}
@@ -31,7 +36,12 @@ function render_site_logo_publish( $attributes, $content ) {
31
return get_custom_logo();
32
}
33
34
- function render_site_logo_editor_preview( $attributes, $content ) {
35
if ( ! function_exists( 'get_custom_logo' ) || ! function_exists( 'has_custom_logo' ) ) {
36
return sprintf( '<div class="components-placeholder"><div class="components-placeholder__label">%1$s</div></components-placeholder__label><div class="components-placeholder__instructions">%2$s</div></div>', __( 'Site Logo', 'full-site-editing' ), __( 'No Logo Support!', 'full-site-editing' ) );
37
}
@@ -41,4 +51,4 @@ function render_site_logo_editor_preview( $attributes, $content ) {
41
}
42
43
return get_custom_logo();
44
- }
6
*/
7
8
/**
9
+ * Renders a site logo.
10
*
11
* @param array $attributes Block attributes.
12
* @param string $content Block content.
13
* @return string
14
*/
15
function render_site_logo( $attributes, $content ) {
16
+ if ( true === $attributes['editorPreview'] ) {
17
return render_site_logo_editor_preview( $attributes, $content );
18
}
19
return render_site_logo_publish( $attributes, $content );
20
}
21
22
+ /**
23
+ * Renders the site logo on the front-end.
24
+ *
25
+ * @return string
26
+ */
27
+ function render_site_logo_publish() {
28
if ( ! function_exists( 'get_custom_logo' ) || ! function_exists( 'has_custom_logo' ) ) {
29
return '';
30
}
36
return get_custom_logo();
37
}
38
39
+ /**
40
+ * Renders the site logo in the block editor.
41
+ *
42
+ * @return string
43
+ */
44
+ function render_site_logo_editor_preview() {
45
if ( ! function_exists( 'get_custom_logo' ) || ! function_exists( 'has_custom_logo' ) ) {
46
return sprintf( '<div class="components-placeholder"><div class="components-placeholder__label">%1$s</div></components-placeholder__label><div class="components-placeholder__instructions">%2$s</div></div>', __( 'Site Logo', 'full-site-editing' ), __( 'No Logo Support!', 'full-site-editing' ) );
47
}
51
}
52
53
return get_custom_logo();
54
+ }
full-site-editing/blocks/site-title/edit.js CHANGED
@@ -7,78 +7,52 @@ import classNames from 'classnames';
7
* WordPress dependencies
8
*/
9
import { __ } from '@wordpress/i18n';
10
- import { withNotices } from '@wordpress/components';
11
import { PlainText } from '@wordpress/editor';
12
- import apiFetch from '@wordpress/api-fetch';
13
- import { withSelect } from '@wordpress/data';
14
import { compose } from '@wordpress/compose';
15
- import { Component, Fragment } from '@wordpress/element';
16
17
- class SiteTitleEdit extends Component {
18
- state = {
19
- title: __( 'Site title loading…' ),
20
- initialTitle: '',
21
- };
22
-
23
- componentDidMount() {
24
- const { noticeOperations } = this.props;
25
-
26
- return apiFetch( { path: '/wp/v2/settings' } )
27
- .then( ( { title } ) => this.setState( { initialTitle: title, title } ) )
28
- .catch( ( { message } ) => noticeOperations.createErrorNotice( message ) );
29
- }
30
-
31
- componentDidUpdate( prevProps ) {
32
- const { title, initialTitle } = this.state;
33
- const { shouldUpdateSiteOption, noticeOperations, isSelected } = this.props;
34
-
35
- const titleUnchanged = title && title.trim() === initialTitle.trim();
36
- const titleIsEmpty = ! title || title.trim().length === 0;
37
-
38
- // Reset to initial value if user de-selects the block with an empty value.
39
- if ( ! isSelected && prevProps.isSelected && titleIsEmpty ) {
40
- this.revertTitle();
41
- }
42
-
43
- // Don't do anything further if we shouldn't update the site option or the value is unchanged.
44
- if ( ! shouldUpdateSiteOption || titleUnchanged ) {
45
- return;
46
- }
47
-
48
- if ( ! prevProps.shouldUpdateSiteOption && shouldUpdateSiteOption ) {
49
- apiFetch( { path: '/wp/v2/settings', method: 'POST', data: { title } } )
50
- .then( () => this.updateInitialTitle() )
51
- .catch( ( { message } ) => {
52
- noticeOperations.createErrorNotice( message );
53
- this.revertTitle();
54
- } );
55
- }
56
- }
57
-
58
- revertTitle = () => this.setState( { title: this.state.initialTitle } );
59
60
- updateInitialTitle = () => this.setState( { initialTitle: this.state.title } );
61
62
- render() {
63
- const { title } = this.state;
64
- const { className, noticeUI } = this.props;
65
66
- return (
67
- <Fragment>
68
- { noticeUI }
69
- <PlainText
70
- className={ classNames( 'site-title', className ) }
71
- value={ title }
72
- onChange={ value => this.setState( { title: value } ) }
73
- placeholder={ __( 'Site Title' ) }
74
- aria-label={ __( 'Site Title' ) }
75
- />
76
- </Fragment>
77
- );
78
- }
79
}
80
81
export default compose( [
82
withSelect( select => {
83
const { isSavingPost, isPublishingPost, isAutosavingPost, isCurrentPostPublished } = select(
84
'core/editor'
@@ -89,5 +63,4 @@ export default compose( [
89
! isAutosavingPost(),
90
};
91
} ),
92
- withNotices,
93
] )( SiteTitleEdit );
7
* WordPress dependencies
8
*/
9
import { __ } from '@wordpress/i18n';
10
import { PlainText } from '@wordpress/editor';
11
+ import { withSelect, withDispatch } from '@wordpress/data';
12
import { compose } from '@wordpress/compose';
13
+ import { Fragment } from '@wordpress/element';
14
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import useSiteOptions from '../useSiteOptions';
19
20
+ function SiteTitleEdit( {
21
+ className,
22
+ createErrorNotice,
23
+ shouldUpdateSiteOption,
24
+ isSelected,
25
+ setAttributes,
26
+ } ) {
27
+ const inititalTitle = __( 'Site title loading…' );
28
+ const { siteOptions, handleChange } = useSiteOptions(
29
+ 'title',
30
+ inititalTitle,
31
+ createErrorNotice,
32
+ isSelected,
33
+ shouldUpdateSiteOption,
34
+ setAttributes
35
+ );
36
37
+ const { option } = siteOptions;
38
39
+ return (
40
+ <Fragment>
41
+ <PlainText
42
+ className={ classNames( 'site-title', className ) }
43
+ value={ option }
44
+ onChange={ value => handleChange( value ) }
45
+ placeholder={ __( 'Site Title' ) }
46
+ aria-label={ __( 'Site Title' ) }
47
+ />
48
+ </Fragment>
49
+ );
50
}
51
52
export default compose( [
53
+ withDispatch( dispatch => ( {
54
+ createErrorNotice: dispatch( 'core/notices' ).createErrorNotice,
55
+ } ) ),
56
withSelect( select => {
57
const { isSavingPost, isPublishingPost, isAutosavingPost, isCurrentPostPublished } = select(
58
'core/editor'
63
! isAutosavingPost(),
64
};
65
} ),
66
] )( SiteTitleEdit );
full-site-editing/blocks/site-title/index.php CHANGED
@@ -4,14 +4,14 @@
4
*
5
* @package full-site-editing
6
*/
7
/**
8
* Renders the site title and allows for editing in the full site editor.
9
*
10
- * @param array $attributes Block attributes.
11
- * @param string $content Block content.
12
* @return string
13
*/
14
- function render_site_title_block( $attributes, $content ) {
15
ob_start();
16
17
$class = 'site-title wp-block-a8c-site-title';
@@ -21,7 +21,7 @@ function render_site_title_block( $attributes, $content ) {
21
22
?>
23
<h1 class="<?php echo esc_attr( $class ); ?>">
24
- <a href=<?php echo get_home_url(); ?>><?php echo get_bloginfo( 'name' ); ?></a>
25
</h1>
26
<!-- a8c:site-title -->
27
<?php
4
*
5
* @package full-site-editing
6
*/
7
+
8
/**
9
* Renders the site title and allows for editing in the full site editor.
10
*
11
+ * @param array $attributes Block attributes.
12
* @return string
13
*/
14
+ function render_site_title_block( $attributes ) {
15
ob_start();
16
17
$class = 'site-title wp-block-a8c-site-title';
21
22
?>
23
<h1 class="<?php echo esc_attr( $class ); ?>">
24
+ <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a>
25
</h1>
26
<!-- a8c:site-title -->
27
<?php
full-site-editing/blocks/site-title/style.scss CHANGED
@@ -1,12 +1,27 @@
1
- .block-editor .wp-block-a8c-site-title {
2
- &, &:focus {
3
- display: inline;
4
- color: #111111;
5
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
6
- font-size: 1.125em;
7
- font-weight: normal;
8
- letter-spacing: -0.02em;
9
- line-height: 1.2;
10
- margin: 0;
11
}
12
}
1
+ .block-editor {
2
+ .wp-block-a8c-site-title {
3
+ &, &:focus {
4
+ display: inline;
5
+ color: #111111;
6
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
7
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
8
+ font-size: 1.125em;
9
+ font-weight: normal;
10
+ letter-spacing: -0.02em;
11
+ line-height: 1.2;
12
+ margin: 0;
13
+ box-shadow: none;
14
+ background-color: transparent;
15
+ }
16
+ }
17
+ .site-title__save-button {
18
+ margin-left: auto;
19
+ display: block;
20
+ }
21
+ .site-title a:link,
22
+ .site-title a:visited {
23
+ color: #111;
24
+ text-decoration: none;
25
+ font-weight: 400;
26
}
27
}
full-site-editing/blocks/template/edit.js CHANGED
@@ -4,117 +4,125 @@
4
* External dependencies
5
*/
6
import classNames from 'classnames';
7
- import { get } from 'lodash';
8
9
/**
10
* WordPress dependencies
11
*/
12
- import { Button, IconButton, Placeholder, Toolbar } from '@wordpress/components';
13
import { compose, withState } from '@wordpress/compose';
14
- import { withSelect } from '@wordpress/data';
15
- import { BlockControls } from '@wordpress/editor';
16
- import { Fragment, RawHTML } from '@wordpress/element';
17
import { __, sprintf } from '@wordpress/i18n';
18
19
/**
20
* Internal dependencies
21
*/
22
- import PostAutocomplete from '../../components/post-autocomplete';
23
import './style.scss';
24
25
const TemplateEdit = compose(
26
- withSelect( ( select, { attributes } ) => {
27
const { getEntityRecord } = select( 'core' );
28
const { getCurrentPostId } = select( 'core/editor' );
29
30
const { templateId } = attributes;
31
return {
32
- currentPostId: getCurrentPostId(),
33
- template: templateId && getEntityRecord( 'postType', 'wp_template_part', templateId ),
34
};
35
} ),
36
- withState( { isEditing: false } )
37
- )( ( { attributes, currentPostId, isEditing, template, setAttributes, setState } ) => {
38
- const { align, templateId } = attributes;
39
40
- const toggleEditing = () => setState( { isEditing: ! isEditing } );
41
42
- const onSelectTemplate = ( { id } ) => {
43
- setState( { isEditing: false } );
44
- setAttributes( { templateId: id } );
45
- };
46
47
- const showToggleButton = ! isEditing || !! templateId;
48
- const showPlaceholder = isEditing || ! templateId;
49
- const showContent = ! isEditing && !! templateId;
50
- const isTemplate = 'wp_template' === fullSiteEditing.editorPostType;
51
52
- return (
53
- <Fragment>
54
- { showToggleButton && isTemplate && (
55
- <BlockControls>
56
- <Toolbar>
57
- <IconButton
58
- className={ classNames( 'components-icon-button components-toolbar__control', {
59
- 'is-active': isEditing,
60
- } ) }
61
- label={ __( 'Change Template Part' ) }
62
- onClick={ toggleEditing }
63
- icon="edit"
64
- />
65
- </Toolbar>
66
- </BlockControls>
67
- ) }
68
<div
69
className={ classNames( 'template-block', {
70
[ `align${ align }` ]: align,
71
} ) }
72
>
73
- { showPlaceholder && (
74
- <Placeholder
75
- icon="layout"
76
- label={ __( 'Template Part' ) }
77
- instructions={ __( 'Select a template part to display' ) }
78
- >
79
- <div className="template-block__selector">
80
- <PostAutocomplete
81
- initialValue={ get( template, [ 'title', 'rendered' ] ) }
82
- onSelectPost={ onSelectTemplate }
83
- postType="wp_template_part"
84
/>
85
- { !! template && (
86
- <a href={ `?post=${ templateId }&action=edit&fse_parent_post=${ currentPostId }` }>
87
- { sprintf( __( 'Edit "%s"' ), get( template, [ 'title', 'rendered' ], '' ) ) }
88
- </a>
89
) }
90
- </div>
91
- </Placeholder>
92
- ) }
93
- { showContent && (
94
- <Fragment>
95
- <RawHTML className="template-block__content">
96
- { get( template, [ 'content', 'rendered' ] ) }
97
- </RawHTML>
98
- { ! isTemplate && (
99
- <Placeholder
100
- className="template-block__overlay"
101
- instructions={ __(
102
- 'This block is part of your site template and may appear on multiple pages.'
103
- ) }
104
- >
105
- <Button
106
- href={ `?post=${ templateId }&action=edit&fse_parent_post=${ currentPostId }` }
107
- isDefault
108
- >
109
- { sprintf( __( 'Edit %s' ), get( template, [ 'title', 'rendered' ], '' ) ) }
110
- </Button>
111
- </Placeholder>
112
- ) }
113
</Fragment>
114
) }
115
</div>
116
- </Fragment>
117
- );
118
- } );
119
120
export default TemplateEdit;
4
* External dependencies
5
*/
6
import classNames from 'classnames';
7
+ import { get, noop } from 'lodash';
8
9
/**
10
* WordPress dependencies
11
*/
12
+ import { parse, createBlock } from '@wordpress/blocks';
13
+ import { BlockEdit } from '@wordpress/editor';
14
+ import { Button, Placeholder, Spinner, Disabled } from '@wordpress/components';
15
import { compose, withState } from '@wordpress/compose';
16
+ import { withDispatch, withSelect } from '@wordpress/data';
17
+ import { Fragment, useEffect } from '@wordpress/element';
18
import { __, sprintf } from '@wordpress/i18n';
19
+ import { addQueryArgs } from '@wordpress/url';
20
21
/**
22
* Internal dependencies
23
*/
24
import './style.scss';
25
26
const TemplateEdit = compose(
27
+ withState( { templateClientId: null } ),
28
+ withSelect( ( select, { attributes, templateClientId } ) => {
29
const { getEntityRecord } = select( 'core' );
30
const { getCurrentPostId } = select( 'core/editor' );
31
+ const { getBlock } = select( 'core/block-editor' );
32
33
const { templateId } = attributes;
34
+ const currentPostId = getCurrentPostId();
35
+ const template = templateId && getEntityRecord( 'postType', 'wp_template_part', templateId );
36
+ const editTemplatePartUrl = addQueryArgs( fullSiteEditing.editTemplatePartBaseUrl, {
37
+ post: templateId,
38
+ fse_parent_post: currentPostId,
39
+ } );
40
+
41
return {
42
+ currentPostId,
43
+ editTemplatePartUrl,
44
+ template,
45
+ templateBlock: getBlock( templateClientId ),
46
+ templateTitle: get( template, [ 'title', 'rendered' ], '' ),
47
};
48
} ),
49
+ withDispatch( ( dispatch, ownProps ) => {
50
+ const { receiveBlocks } = dispatch( 'core/block-editor' );
51
+ const { template, templateClientId, setState } = ownProps;
52
+
53
+ return {
54
+ receiveTemplateBlocks: () => {
55
+ if ( ! template || templateClientId ) {
56
+ return;
57
+ }
58
+
59
+ const templateBlocks = parse( get( template, [ 'content', 'raw' ], '' ) );
60
+ const templateBlock =
61
+ templateBlocks.length === 1
62
+ ? templateBlocks[ 0 ]
63
+ : createBlock( 'core/template', {}, templateBlocks );
64
65
+ receiveBlocks( [ templateBlock ] );
66
+ setState( { templateClientId: templateBlock.clientId } );
67
+ },
68
+ };
69
+ } )
70
+ )(
71
+ ( {
72
+ attributes,
73
+ editTemplatePartUrl,
74
+ receiveTemplateBlocks,
75
+ template,
76
+ templateBlock,
77
+ templateTitle,
78
+ } ) => {
79
+ if ( ! template ) {
80
+ return (
81
+ <Placeholder>
82
+ <Spinner />
83
+ </Placeholder>
84
+ );
85
+ }
86
87
+ useEffect( () => {
88
+ receiveTemplateBlocks();
89
+ } );
90
91
+ const { align } = attributes;
92
93
+ return (
94
<div
95
className={ classNames( 'template-block', {
96
[ `align${ align }` ]: align,
97
} ) }
98
>
99
+ { templateBlock && (
100
+ <Fragment>
101
+ <Disabled>
102
+ <BlockEdit
103
+ attributes={ templateBlock.attributes }
104
+ block={ templateBlock }
105
+ clientId={ templateBlock.clientId }
106
+ isSelected={ false }
107
+ name={ templateBlock.name }
108
+ setAttributes={ noop }
109
/>
110
+ </Disabled>
111
+ <Placeholder
112
+ className="template-block__overlay"
113
+ instructions={ __(
114
+ 'This block is part of your site template and may appear on multiple pages.'
115
) }
116
+ >
117
+ <Button href={ editTemplatePartUrl } isDefault>
118
+ { sprintf( __( 'Edit %s' ), templateTitle ) }
119
+ </Button>
120
+ </Placeholder>
121
</Fragment>
122
) }
123
</div>
124
+ );
125
+ }
126
+ );
127
128
export default TemplateEdit;
full-site-editing/blocks/template/style.scss CHANGED
@@ -35,4 +35,9 @@
35
left: 0;
36
width: 100%;
37
height: 100%;
38
}
35
left: 0;
36
width: 100%;
37
height: 100%;
38
+ background: rgba( #000000, 0.75 );
39
+
40
+ .components-placeholder__instructions {
41
+ color: white;
42
+ }
43
}
full-site-editing/blocks/usePrevious.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { useEffect, useRef } from '@wordpress/element';
5
+
6
+ /**
7
+ * Custom hook to provide the previous value of state or props in a functional component
8
+ *
9
+ * see https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
10
+ *
11
+ * @param {any} value state or prop value for which previous value is required
12
+ * @return {any} previous value of requested state or prop value
13
+ */
14
+ export default function usePrevious( value ) {
15
+ const ref = useRef();
16
+
17
+ useEffect( () => {
18
+ ref.current = value;
19
+ }, [ value ] );
20
+
21
+ return ref.current;
22
+ }
full-site-editing/blocks/useSiteOptions.js ADDED
@@ -0,0 +1,116 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { __, sprintf } from '@wordpress/i18n';
5
+ import { useState, useEffect } from '@wordpress/element';
6
+ import apiFetch from '@wordpress/api-fetch';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import usePrevious from './usePrevious';
12
+
13
+ export default function useSiteOptions(
14
+ siteOption,
15
+ inititalOption,
16
+ createErrorNotice,
17
+ isSelected,
18
+ shouldUpdateSiteOption,
19
+ setAttributes
20
+ ) {
21
+ const [ siteOptions, setSiteOptions ] = useState( {
22
+ option: inititalOption,
23
+ previousOption: '',
24
+ loaded: false,
25
+ error: false,
26
+ } );
27
+
28
+ const previousIsSelected = usePrevious( isSelected );
29
+ const previousShouldUpdateSiteOption = usePrevious( shouldUpdateSiteOption );
30
+
31
+ useEffect( () => {
32
+ if ( ! siteOptions.loaded && ! siteOptions.error ) {
33
+ loadSiteOption();
34
+ } else {
35
+ updateSiteOption();
36
+ }
37
+ } );
38
+
39
+ function loadSiteOption() {
40
+ apiFetch( { path: '/wp/v2/settings' } )
41
+ .then( result =>
42
+ setSiteOptions( {
43
+ ...siteOptions,
44
+ option: result[ siteOption ],
45
+ previousOption: result[ siteOption ],
46
+ loaded: true,
47
+ error: false,
48
+ } )
49
+ )
50
+ .catch( () => {
51
+ createErrorNotice( sprintf( __( 'Unable to load site %s' ), siteOption ) );
52
+ setSiteOptions( {
53
+ ...siteOptions,
54
+ option: sprintf( __( 'Error loading site %s' ), siteOption ),
55
+ error: true,
56
+ } );
57
+ } );
58
+ }
59
+
60
+ function updateSiteOption() {
61
+ const { option, previousOption } = siteOptions;
62
+ const optionUnchanged = option && option.trim() === previousOption.trim();
63
+ const optionIsEmpty = ! option || option.trim().length === 0;
64
+
65
+ // Reset to initial value if user de-selects the block with an empty value.
66
+ if ( ! isSelected && previousIsSelected && optionIsEmpty ) {
67
+ revertOption();
68
+ }
69
+
70
+ // Don't do anything further if we shouldn't update the site option or the value is unchanged.
71
+ if ( ! shouldUpdateSiteOption || optionUnchanged ) {
72
+ return;
73
+ }
74
+
75
+ if ( ! previousShouldUpdateSiteOption && shouldUpdateSiteOption ) {
76
+ saveSiteOption( option );
77
+ }
78
+ }
79
+
80
+ function saveSiteOption( option ) {
81
+ setSiteOptions( { ...siteOptions, isSaving: true } );
82
+ apiFetch( { path: '/wp/v2/settings', method: 'POST', data: { [ siteOption ]: option } } )
83
+ .then( () => updatePreviousOption( option ) )
84
+ .catch( () => {
85
+ createErrorNotice( sprintf( __( 'Unable to save site %s' ), siteOption ) );
86
+ revertOption();
87
+ } );
88
+ }
89
+
90
+ function revertOption() {
91
+ setSiteOptions( {
92
+ ...siteOptions,
93
+ option: siteOptions.previousOption,
94
+ isSaving: false,
95
+ } );
96
+ }
97
+
98
+ function updatePreviousOption( option ) {
99
+ setSiteOptions( {
100
+ ...siteOptions,
101
+ previousOption: option,
102
+ isDirty: false,
103
+ isSaving: false,
104
+ } );
105
+ }
106
+
107
+ function handleChange( value ) {
108
+ // The following is a temporary fix. Setting this fake attribute is used to flag
109
+ // the content as dirty to editor and enable Update/Publish button. This should be
110
+ // removed once updating of site options handled in core editor
111
+ setAttributes( { updated: Date.now() } );
112
+ setSiteOptions( { ...siteOptions, option: value } );
113
+ }
114
+
115
+ return { siteOptions, handleChange };
116
+ }
full-site-editing/class-full-site-editing.php CHANGED
@@ -16,6 +16,11 @@ class Full_Site_Editing {
16
*/
17
private static $instance = null;
18
19
private $template_post_types = array( 'wp_template', 'wp_template_part' );
20
21
/**
@@ -27,23 +32,11 @@ class Full_Site_Editing {
27
add_action( 'init', array( $this, 'register_meta_template_id' ) );
28
add_action( 'rest_api_init', array( $this, 'allow_searching_for_templates' ) );
29
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_script_and_style' ), 100 );
30
-
31
- add_action(
32
- 'wp_head',
33
- function() {
34
- ob_start( 'a8c_fse_replace_template_parts' );
35
- }
36
- );
37
-
38
- add_action(
39
- 'wp_footer',
40
- function() {
41
- ob_end_flush();
42
- }
43
- );
44
-
45
add_action( 'the_post', array( $this, 'merge_template_and_post' ) );
46
add_filter( 'wp_insert_post_data', array( $this, 'remove_template_components' ), 10, 2 );
47
}
48
49
/**
@@ -305,9 +298,10 @@ class Full_Site_Editing {
305
'a8c-full-site-editing-script',
306
'fullSiteEditing',
307
array(
308
- 'editorPostType' => get_current_screen()->post_type,
309
- 'featureFlags' => $feature_flags->get_flags(),
310
- 'closeButtonUrl' => $this->get_close_button_url(),
311
)
312
);
313
@@ -364,9 +358,9 @@ class Full_Site_Editing {
364
'a8c/site-logo',
365
array(
366
'attributes' => array(
367
- 'editorPreview' => array(
368
- 'type' => 'boolean',
369
- 'default' => false,
370
),
371
),
372
'render_callback' => 'render_site_logo',
@@ -434,69 +428,190 @@ class Full_Site_Editing {
434
*
435
* @param string Current close button URL.
436
*/
437
- $close_button_url = apply_filters( 'a8c_fse_close_button_link', $close_button_url );
438
439
- return $close_button_url;
440
}
441
442
- /** This will merge the post content with the post template, modifiying the
443
- * $post parameter.
444
*
445
- * @param WP_Post $post
446
*/
447
public function merge_template_and_post( $post ) {
448
- //bail if not a REST API Request
449
if ( defined( 'REST_REQUEST' ) && ! REST_REQUEST ) {
450
return;
451
}
452
453
- // bail if the post type is one of the template post types
454
- if ( in_array( get_post_type( $post->ID ), $this->template_post_types ) ) {
455
return;
456
}
457
458
- $template = new A8C_WP_Template( $post->ID );
459
460
- //bail if the post has no tempalte id assigned
461
- if ( ! $template->get_template_id() ) {
462
return;
463
}
464
465
- $wrapped_post_content = sprintf( '<!-- wp:a8c/post-content -->%s<!-- /wp:a8c/post-content -->', $post->post_content );
466
- $post->post_content = str_replace( '<!-- wp:a8c/post-content /-->', $wrapped_post_content, $template->get_template_content() );
467
}
468
469
/**
470
* This will extract the inner blocks of the post content and
471
* serialize them back to HTML for saving.
472
*
473
- * @param array $data An array of slashed post data.
474
* @param array $postarr An array of sanitized, but otherwise unmodified post data.
475
*/
476
public function remove_template_components( $data, $postarr ) {
477
- // bail if the post type is one of the template post types
478
- if ( in_array( $postarr['post_type'], $this->template_post_types ) ) {
479
return $data;
480
}
481
482
$post_content = wp_unslash( $data['post_content'] );
483
484
- //bail if post content has no blocks
485
- if( ! has_blocks( $post_content ) ) {
486
return $data;
487
}
488
489
$post_content_blocks = parse_blocks( $post_content );
490
- $post_content_key = array_search( 'a8c/post-content', array_column( $post_content_blocks, 'blockName' ) );
491
492
- // bail if no post content block found
493
- if( ! $post_content_key ) {
494
return $data;
495
}
496
497
$data['post_content'] = wp_slash( serialize_blocks( $post_content_blocks[ $post_content_key ]['innerBlocks'] ) );
498
return $data;
499
}
500
}
501
502
if ( ! function_exists( 'serialize_block' ) ) {
@@ -504,7 +619,7 @@ if ( ! function_exists( 'serialize_block' ) ) {
504
* Renders an HTML-serialized form of a block object
505
* from https://core.trac.wordpress.org/ticket/47375
506
*
507
- * should be available since WordPress 5.3.0
508
*
509
* @param array $block The block being rendered.
510
* @return string The HTML-serialized form of the block
@@ -515,8 +630,8 @@ if ( ! function_exists( 'serialize_block' ) ) {
515
return $block['innerHTML'];
516
}
517
518
- $unwanted = array( '--', '<', '>', '&', '\"' );
519
- $wanted = array( '\u002d\u002d', '\u003c', '\u003e', '\u0026', '\u0022' );
520
521
$name = 0 === strpos( $block['blockName'], 'core/' ) ? substr( $block['blockName'], 5 ) : $block['blockName'];
522
$has_attrs = ! empty( $block['attrs'] );
@@ -553,10 +668,10 @@ if ( ! function_exists( 'serialize_blocks' ) ) {
553
* Renders an HTML-serialized form of a list of block objects
554
* from https://core.trac.wordpress.org/ticket/47375
555
*
556
- * should be available since WordPress 5.3.0
557
*
558
- * @param array $blocks The list of parsed block objects
559
- * @return string The HTML-serialized form of the list of blocks
560
*/
561
function serialize_blocks( $blocks ) {
562
return implode( "\n\n", array_map( 'serialize_block', $blocks ) );
16
*/
17
private static $instance = null;
18
19
+ /**
20
+ * Custom post types.
21
+ *
22
+ * @var Full_Site_Editing
23
+ */
24
private $template_post_types = array( 'wp_template', 'wp_template_part' );
25
26
/**
32
add_action( 'init', array( $this, 'register_meta_template_id' ) );
33
add_action( 'rest_api_init', array( $this, 'allow_searching_for_templates' ) );
34
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_script_and_style' ), 100 );
35
+ add_filter( 'template_include', array( $this, 'load_page_template' ) );
36
add_action( 'the_post', array( $this, 'merge_template_and_post' ) );
37
add_filter( 'wp_insert_post_data', array( $this, 'remove_template_components' ), 10, 2 );
38
+ add_filter( 'admin_body_class', array( $this, 'toggle_editor_post_title_visibility' ) );
39
+ add_filter( 'block_editor_settings', array( $this, 'set_block_template' ) );
40
}
41
42
/**
298
'a8c-full-site-editing-script',
299
'fullSiteEditing',
300
array(
301
+ 'editorPostType' => get_current_screen()->post_type,
302
+ 'featureFlags' => $feature_flags->get_flags(),
303
+ 'closeButtonUrl' => esc_url( $this->get_close_button_url() ),
304
+ 'editTemplatePartBaseUrl' => esc_url( $this->get_edit_template_part_base_url() ),
305
)
306
);
307
358
'a8c/site-logo',
359
array(
360
'attributes' => array(
361
+ 'editorPreview' => array(
362
+ 'type' => 'boolean',
363
+ 'default' => false,
364
),
365
),
366
'render_callback' => 'render_site_logo',
428
*
429
* @param string Current close button URL.
430
*/
431
+ return apply_filters( 'a8c_fse_close_button_link', $close_button_url );
432
+ }
433
+
434
+ /**
435
+ * Returns the base URL for the Edit Template Part button. The URL does not contain neither
436
+ * the post ID nor the template part ID. Those query arguments should be provided by
437
+ * the Template Part on the Block.
438
+ *
439
+ * @return string edit link without post ID
440
+ */
441
+ public function get_edit_template_part_base_url() {
442
+ $edit_post_link = remove_query_arg( 'post', get_edit_post_link( 0, 'edit' ) );
443
444
+ /**
445
+ * Filter the Gutenberg's edit template part button base URL
446
+ * when editing pages or posts.
447
+ *
448
+ * @since 0.2
449
+ *
450
+ * @param string Current edit button URL.
451
+ */
452
+ return apply_filters( 'a8c_fse_edit_template_part_base_url', $edit_post_link );
453
}
454
455
+ /** This will merge the post content with the post template, modifiying the $post parameter.
456
*
457
+ * @param WP_Post $post Post instance.
458
*/
459
public function merge_template_and_post( $post ) {
460
+ // Bail if not a REST API Request.
461
if ( defined( 'REST_REQUEST' ) && ! REST_REQUEST ) {
462
return;
463
}
464
465
+ // Bail if the post is not a full site page.
466
+ if ( ! $this->is_full_site_page() ) {
467
return;
468
}
469
470
+ $template = new A8C_WP_Template( $post->ID );
471
+ $template_content = $template->get_template_content();
472
473
+ // Bail if the template has no post content block.
474
+ if ( ! has_block( 'a8c/post-content', $template_content ) ) {
475
return;
476
}
477
478
+ $template_blocks = parse_blocks( $template_content );
479
+ $content_attrs = $this->get_post_content_block_attrs( $template_blocks );
480
+
481
+ $wrapped_post_content = sprintf( '<!-- wp:a8c/post-content %s -->%s<!-- /wp:a8c/post-content -->', $content_attrs, $post->post_content );
482
+ $post->post_content = str_replace( "<!-- wp:a8c/post-content $content_attrs /-->", $wrapped_post_content, $template_content );
483
+ }
484
+
485
+ /**
486
+ * This will extract the attributes from the post content block
487
+ * json encode them.
488
+ *
489
+ * @param array $blocks An array of template blocks.
490
+ */
491
+ private function get_post_content_block_attrs( $blocks ) {
492
+ foreach ( $blocks as $key => $value ) {
493
+ if ( 'a8c/post-content' === $value['blockName'] ) {
494
+ return count( $value['attrs'] ) > 0 ? wp_json_encode( $value['attrs'] ) : '';
495
+ }
496
+ }
497
}
498
499
/**
500
* This will extract the inner blocks of the post content and
501
* serialize them back to HTML for saving.
502
*
503
+ * @param array $data An array of slashed post data.
504
* @param array $postarr An array of sanitized, but otherwise unmodified post data.
505
+ * @return array
506
*/
507
public function remove_template_components( $data, $postarr ) {
508
+ // Bail if the post type is one of the template post types.
509
+ if ( in_array( $postarr['post_type'], $this->template_post_types, true ) ) {
510
return $data;
511
}
512
513
$post_content = wp_unslash( $data['post_content'] );
514
515
+ // Bail if post content has no blocks.
516
+ if ( ! has_blocks( $post_content ) ) {
517
return $data;
518
}
519
520
$post_content_blocks = parse_blocks( $post_content );
521
+ $post_content_key = array_search( 'a8c/post-content', array_column( $post_content_blocks, 'blockName' ), true );
522
523
+ // Bail if no post content block found.
524
+ if ( ! $post_content_key ) {
525
return $data;
526
}
527
528
$data['post_content'] = wp_slash( serialize_blocks( $post_content_blocks[ $post_content_key ]['innerBlocks'] ) );
529
return $data;
530
}
531
+
532
+ /**
533
+ * Determine if the current edited post is a full site page.
534
+ * If it's a page being loaded that has a `wp_template`, it's a page that our FSE plugin should handle.
535
+ *
536
+ * @return boolean
537
+ */
538
+ public function is_full_site_page() {
539
+ $fse_template = new A8C_WP_Template();
540
+
541
+ return 'page' === get_post_type() && $fse_template->get_template_id();
542
+ }
543
+
544
+ /**
545
+ * Determine the page template to use.
546
+ * If it's a full site page being loaded, use our FSE template.
547
+ *
548
+ * @param string $template template URL passed to filter.
549
+ * @return string Filtered template path.
550
+ */
551
+ public function load_page_template( $template ) {
552
+ if ( $this->is_full_site_page() ) {
553
+ return plugin_dir_path( __FILE__ ) . 'page-fse.php';
554
+ }
555
+
556
+ return $template;
557
+ }
558
+
559
+ /**
560
+ * Return an extra class that will be assigned to the body element if a full site page is being edited.
561
+ *
562
+ * That class hides the default post title of the editor and displays a new post title rendered by the post content
563
+ * block in order to have it just before the content of the post.
564
+ *
565
+ * @param string $classes Space-separated list of CSS classes.
566
+ * @return string
567
+ */
568
+ public function toggle_editor_post_title_visibility( $classes ) {
569
+ if ( get_current_screen()->is_block_editor() && $this->is_full_site_page() ) {
570
+ $classes .= ' show-post-title-before-content ';
571
+ }
572
+ return $classes;
573
+ }
574
+
575
+ /**
576
+ * Sets the block template to be loaded by the editor when creating a new full site page.
577
+ *
578
+ * @param array $editor_settings Default editor settings.
579
+ * @return array Editor settings with the updated template setting.
580
+ */
581
+ public function set_block_template( $editor_settings ) {
582
+ if ( $this->is_full_site_page() ) {
583
+ $fse_template = new A8C_WP_Template();
584
+ $template_blocks = $fse_template->get_template_blocks();
585
+
586
+ $template = array();
587
+ foreach ( $template_blocks as $block ) {
588
+ $template[] = fse_map_block_to_editor_template_setting( $block );
589
+ }
590
+ $editor_settings['template'] = $template;
591
+ $editor_settings['templateLock'] = 'all';
592
+ }
593
+ return $editor_settings;
594
+ }
595
+ }
596
+
597
+ /**
598
+ * Returns an array with the expected format of the block template setting syntax.
599
+ *
600
+ * @see https://github.com/WordPress/gutenberg/blob/1414cf0ad1ec3d0f3e86a40815513c15938bb522/docs/designers-developers/developers/block-api/block-templates.md
601
+ *
602
+ * @param array $block Block to convert.
603
+ * @return array
604
+ */
605
+ function fse_map_block_to_editor_template_setting( $block ) {
606
+ $block_name = $block['blockName'];
607
+ $attrs = $block['attrs'];
608
+ $inner_blocks = $block['innerBlocks'];
609
+
610
+ $inner_blocks_template = array();
611
+ foreach ( $inner_blocks as $inner_block ) {
612
+ $inner_blocks[] = fse_map_block_to_editor_template_setting( $inner_block );
613
+ }
614
+ return array( $block_name, $attrs, $inner_blocks_template );
615
}
616
617
if ( ! function_exists( 'serialize_block' ) ) {
619
* Renders an HTML-serialized form of a block object
620
* from https://core.trac.wordpress.org/ticket/47375
621
*
622
+ * Should be available since WordPress 5.3.0.
623
*
624
* @param array $block The block being rendered.
625
* @return string The HTML-serialized form of the block
630
return $block['innerHTML'];
631
}
632
633
+ $unwanted = array( '--', '<', '>', '&', '\"' );
634
+ $wanted = array( '\u002d\u002d', '\u003c', '\u003e', '\u0026', '\u0022' );
635
636
$name = 0 === strpos( $block['blockName'], 'core/' ) ? substr( $block['blockName'], 5 ) : $block['blockName'];
637
$has_attrs = ! empty( $block['attrs'] );
668
* Renders an HTML-serialized form of a list of block objects
669
* from https://core.trac.wordpress.org/ticket/47375
670
*
671
+ * Should be available since WordPress 5.3.0.
672
*
673
+ * @param array $blocks The list of parsed block objects.
674
+ * @return string The HTML-serialized form of the list of blocks.
675
*/
676
function serialize_blocks( $blocks ) {
677
return implode( "\n\n", array_map( 'serialize_block', $blocks ) );
full-site-editing/dist/full-site-editing.css CHANGED
@@ -1 +1 @@
1
- .wp-block-a8c-navigation-menu .main-navigation{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:700;letter-spacing:-.02em;line-height:1.2;pointer-events:none;-webkit-font-smoothing:antialiased}.wp-block-a8c-navigation-menu .main-navigation .main-menu{display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li{color:#0073aa;display:inline;position:relative}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li>a{font-weight:700;color:#0073aa;margin-right:.5rem}.main-navigation .main-menu>li:last-child.menu-item-has-children .submenu-expand,.wp-block-a8c-navigation-menu .main-navigation .main-menu>li:last-child>a{margin-right:0}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children>a{margin-right:.125rem}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children{display:inline-block;position:inherit}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children .submenu-expand{display:inline-block;margin-right:.25rem}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children .submenu-expand svg{position:relative;top:.3rem}.main-navigation .main-menu>li>a:hover+svg,.wp-block-a8c-navigation-menu .main-navigation .main-menu>li>a:hover{color:#005177}.wp-block-a8c-navigation-menu .main-navigation svg{transition:fill .12s ease-in-out;fill:currentColor}.wp-block-a8c-navigation-menu .main-navigation a{text-decoration:none}.wp-block-a8c-navigation-menu .main-navigation button{display:inline-block;border:none;padding:0;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.88889em;font-weight:700;line-height:1.2;text-decoration:none;vertical-align:bottom;background:transparent;color:inherit;cursor:pointer;transition:background .25s ease-in-out,transform .15s ease;-webkit-appearance:none;-moz-appearance:none}.wp-block-a8c-navigation-menu .main-menu-more{display:none}.wp-block-a8c-navigation-menu .social-navigation{line-height:1.25;margin-top:.5rem;text-align:left}.wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu{content:"";display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu li{display:inline-block;vertical-align:bottom;vertical-align:-webkit-baseline-middle;list-style:none}.wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu li a svg{display:block;width:32px;height:32px;transform:translateZ(0)}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu{display:inline;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.71111em;padding-left:0}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu li{display:inline;margin-right:1rem}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu a{text-decoration:none;color:#767676}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu a:hover{text-decoration:none;color:#0073aa}.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a,.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a:hover{color:#555d66}.a8c-post-autocomplete{position:relative}.a8c-post-autocomplete .components-spinner{bottom:7px;position:absolute;right:-5px}.a8c-post-autocomplete__suggestions{max-height:200px;overflow-y:auto;width:302px}.a8c-post-autocomplete__suggestions .components-button{display:block;height:auto;min-height:30px;white-space:normal;width:100%;word-wrap:break-word}.post-content-block.alignfull{padding:0 12px}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.block-editor .wp-block-a8c-site-description,.block-editor .wp-block-a8c-site-description:focus{display:inline;color:#767676;font-size:1.125em;font-weight:400;letter-spacing:-.01em;margin:0}.block-editor .site-description__save-button{margin-left:auto;display:block}.block-editor .wp-block-a8c-site-title,.block-editor .wp-block-a8c-site-title:focus{display:inline;color:#111;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:400;letter-spacing:-.02em;line-height:1.2;margin:0}.template-block{min-height:200px}.template-block:hover .template-block__overlay{display:flex}.template-block.alignfull{padding:0 12px}.template-block__selector{width:300px}.template-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.template-block__content{pointer-events:none}.template-block__content:after{content:"";clear:both;display:table}.template-block__overlay{display:none;position:absolute;top:0;left:0;width:100%;height:100%}.wp-block-a8c-site-logo{pointer-events:none}
1
+ .wp-block-a8c-navigation-menu.main-navigation{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:700;letter-spacing:-.02em;line-height:1.2;pointer-events:none;-webkit-font-smoothing:antialiased}.wp-block-a8c-navigation-menu.main-navigation .main-menu{display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li{color:#0073aa;display:inline;position:relative}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li>a{font-weight:700;color:#0073aa;margin-right:.5rem}.main-navigation .main-menu>li:last-child.menu-item-has-children .submenu-expand,.wp-block-a8c-navigation-menu.main-navigation .main-menu>li:last-child>a{margin-right:0}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children>a{margin-right:.125rem}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children{display:inline-block;position:inherit}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children .submenu-expand{display:inline-block;margin-right:.25rem}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children .submenu-expand svg{position:relative;top:.3rem}.main-navigation .main-menu>li>a:hover+svg,.wp-block-a8c-navigation-menu.main-navigation .main-menu>li>a:hover{color:#005177}.wp-block-a8c-navigation-menu.main-navigation .main-menu-more{display:none}.wp-block-a8c-navigation-menu.main-navigation svg{transition:fill .12s ease-in-out;fill:currentColor}.wp-block-a8c-navigation-menu.main-navigation a{text-decoration:none}.wp-block-a8c-navigation-menu.main-navigation button{display:inline-block;border:none;padding:0;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.88889em;font-weight:700;line-height:1.2;text-decoration:none;vertical-align:bottom;background:transparent;color:inherit;cursor:pointer;transition:background .25s ease-in-out,transform .15s ease;-webkit-appearance:none;-moz-appearance:none}.wp-block-a8c-navigation-menu.main-menu-more{display:none}.wp-block-a8c-navigation-menu.social-navigation{line-height:1.25;margin-top:.5rem;text-align:left}.wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu{content:"";display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu li{display:inline-block;vertical-align:bottom;vertical-align:-webkit-baseline-middle;list-style:none}.wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu li a svg{display:block;width:32px;height:32px;transform:translateZ(0)}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu{display:inline;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.71111em;padding-left:0}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu li{display:inline;margin-right:1rem}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu a{text-decoration:none;color:#767676}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu a:hover{text-decoration:none;color:#0073aa}.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a,.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a:hover{color:#555d66}.a8c-post-autocomplete{position:relative}.a8c-post-autocomplete .components-spinner{bottom:7px;position:absolute;right:-5px}.a8c-post-autocomplete__suggestions{max-height:200px;overflow-y:auto;width:302px}.a8c-post-autocomplete__suggestions .components-button{display:block;height:auto;min-height:30px;white-space:normal;width:100%;word-wrap:break-word}.post-content-block.alignfull{padding:0 12px}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor .wp-block-a8c-site-description,.block-editor .wp-block-a8c-site-description:focus{display:inline;color:#767676;font-size:1.125em;font-weight:400;letter-spacing:-.01em;margin:0;box-shadow:none;background-color:transparent}.block-editor .site-description__save-button{margin-left:auto;display:block}.block-editor .site-title:not(:empty)+.site-description:not(:empty):before{content:"\2014";margin:0 .2em}.block-editor .wp-block-a8c-site-title,.block-editor .wp-block-a8c-site-title:focus{display:inline;color:#111;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:400;letter-spacing:-.02em;line-height:1.2;margin:0;box-shadow:none;background-color:transparent}.block-editor .site-title__save-button{margin-left:auto;display:block}.block-editor .site-title a:link,.block-editor .site-title a:visited{color:#111;text-decoration:none;font-weight:400}.template-block{min-height:200px}.template-block:hover .template-block__overlay{display:flex}.template-block.alignfull{padding:0 12px}.template-block__selector{width:300px}.template-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.template-block__content{pointer-events:none}.template-block__content:after{content:"";clear:both;display:table}.template-block__overlay{display:none;position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.75)}.template-block__overlay .components-placeholder__instructions{color:#fff}.wp-block-a8c-site-logo{pointer-events:none}
full-site-editing/dist/full-site-editing.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}([function(e,t){e.exports=wp.element},function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.components},function(e,t){e.exports=lodash},function(e,t){e.exports=wp.compose},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=wp.editor},function(e,t){e.exports=wp.data},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}},function(e,t,n){var i=n(34),o=n(8);e.exports=function(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?o(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var i=n(35);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}},function(e,t,n){var i;
2
/*!
3
Copyright (c) 2017 Jed Watson.
4
Licensed under the MIT License (MIT), see
@@ -9,4 +9,4 @@
9
Licensed under the MIT License (MIT), see
10
http://jedwatson.github.io/classnames
11
*/
12
- !function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var r=typeof i;if("string"===r||"number"===r)e.push(i);else if(Array.isArray(i)&&i.length){var c=o.apply(null,i);c&&e.push(c)}else if("object"===r)for(var a in i)n.call(i,a)&&i[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(i=function(){return o}.apply(t,[]))||(e.exports=i)}()},function(e,t){e.exports=wp.apiFetch},function(e,t){e.exports=wp.url},function(e,t){e.exports=wp.domReady},function(e,t){e.exports=wp.editPost},function(e,t,n){},function(e,t,n){var i=n(27),o=n(28),r=n(29);e.exports=function(e,t){return i(e)||o(e,t)||r()}},function(e,t,n){var i=n(5);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){i(e,t,n[t])})}return e}},function(e,t){function n(e,t,n,i,o,r,c){try{var a=e[r](c),l=a.value}catch(s){return void n(s)}a.done?t(l):Promise.resolve(l).then(i,o)}e.exports=function(e){return function(){var t=this,i=arguments;return new Promise(function(o,r){var c=e.apply(t,i);function a(e){n(c,o,r,a,l,"next",e)}function l(e){n(c,o,r,a,l,"throw",e)}a(void 0)})}}},function(e,t){e.exports=wp.plugins},function(e,t,n){},,function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var c,a=e[Symbol.iterator]();!(i=(c=a.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(l){o=!0,r=l}finally{try{i||null==a.return||a.return()}finally{if(o)throw r}}return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,n){},,function(e,t,n){},,function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=i=function(e){return n(e)}:e.exports=i=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},i(t)}e.exports=i},function(e,t){function n(t,i){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,i)}e.exports=n},function(e,t,n){},,function(e,t,n){},,,function(e,t,n){},,function(e,t,n){"use strict";n.r(t);var i=n(0),o=n(9),r=n(1),c=n(2),a=n(6),l=n(17),s=function(e){var t=e.attributes,n=Object(l.addQueryArgs)("customize.php",{"autofocus[panel]":"nav_menus",return:window.location.href});return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(a.BlockControls,null,Object(i.createElement)(c.Toolbar,{className:"wp-block-a8c-navigation-menu-toolbar"},Object(i.createElement)(c.IconButton,{icon:"edit",label:Object(r.__)("Edit Menu"),href:n,className:"components-toolbar__control"}))),Object(i.createElement)(c.ServerSideRender,{attributes:t,block:"a8c/navigation-menu",className:"wp-block-a8c-navigation-menu"}))},u=(n(25),Object(i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.createElement)("path",{d:"M12 7.27l4.28 10.43-3.47-1.53-.81-.36-.81.36-3.47 1.53L12 7.27M12 2L4.5 20.29l.71.71L12 18l6.79 3 .71-.71L12 2z"})));Object(o.registerBlockType)("a8c/navigation-menu",{title:Object(r.__)("Navigation Menu"),description:Object(r.__)("Visual placeholder for site-wide navigation and menus."),icon:u,category:"layout",supports:{html:!1,multiple:!1,reusable:!1},attributes:{themeLocation:{type:"string",default:"main-1"}},edit:s,save:function(){return null}});var p=n(5),d=n.n(p),b=n(15),f=n.n(b),m=n(3),g=n(4),h=n(7),O=n(21),v=n.n(O),y=n(22),j=n.n(y),_=n(23),S=n.n(_),E=n(16),w=n.n(E),P=(n(30),Object(m.debounce)(function(){var e=S()(regeneratorRuntime.mark(function e(t,n,i){var o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i({loading:!0,showSuggestions:!0,suggestions:[]}),e.next=3,w()({path:Object(l.addQueryArgs)("/wp/v2/search",j()({context:"embed",per_page:20,search:t},!!n&&{subtype:n}))});case 3:o=e.sent,i({loading:!1,showSuggestions:!0,suggestions:o});case 5:case"end":return e.stop()}},e)}));return function(t,n,i){return e.apply(this,arguments)}}(),200)),T=Object(g.withState)({loading:!1,showSuggestions:!1,suggestions:[]})(function(e){var t=e.initialValue,n=e.loading,o=e.onSelectPost,a=e.postType,l=e.setState,s=e.showSuggestions,u=e.suggestions,p=Object(i.useState)(t),d=v()(p,2),b=d[0],f=d[1],g=function(e){return function(){var t=function(e,t,n){var i=e.id,o=e.title,r=e.subtype;return t({loading:!1,showSuggestions:!1,suggestions:[]}),n(o),{id:i,type:r}}(e,l,f);o(t)}};return Object(i.createElement)("div",{className:"a8c-post-autocomplete"},Object(i.createElement)(c.TextControl,{autoComplete:"off",onChange:function(e){f(e),e.length<2?l({loading:!1,showSuggestions:!1}):P(e,a,l)},placeholder:Object(r.__)("Type to search"),type:"search",value:b}),n&&Object(i.createElement)(c.Spinner,null),s&&!!u.length&&Object(i.createElement)(c.Popover,{focusOnMount:!1,noArrow:!0,position:"bottom"},Object(i.createElement)("div",{className:"a8c-post-autocomplete__suggestions"},Object(m.map)(u,function(e){return Object(i.createElement)(c.Button,{isLarge:!0,isLink:!0,key:e.id,onClick:g(e)},e.title)}))))}),k=Object(g.compose)(Object(g.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(h.withSelect)(function(e,t){var n=t.selectedPostId,i=t.selectedPostType;return{selectedPost:(0,e("core").getEntityRecord)("postType",i,n)}}))(function(e){var t=e.attributes,n=e.isEditing,o=e.selectedPost,l=e.setState,s=t.align,u=!n||!!o,p=n||!o,b=!n&&!!o;return Object(i.createElement)(i.Fragment,null,u&&Object(i.createElement)(a.BlockControls,null,Object(i.createElement)(c.Toolbar,null,Object(i.createElement)(c.IconButton,{className:f()("components-icon-button components-toolbar__control",{"is-active":n}),label:Object(r.__)("Change Preview"),onClick:function(){return l({isEditing:!n})},icon:"edit"}))),Object(i.createElement)("div",{className:f()("post-content-block",d()({},"align".concat(s),s))},p&&Object(i.createElement)(c.Placeholder,{icon:"layout",label:Object(r.__)("Content Slot"),instructions:Object(r.__)("Placeholder for a post or a page.")},Object(i.createElement)("div",{className:"post-content-block__selector"},Object(i.createElement)("div",null,Object(r.__)("Select something to preview:")),Object(i.createElement)(T,{initialValue:Object(m.get)(o,["title","rendered"]),onSelectPost:function(e){var t=e.id,n=e.type;l({isEditing:!1,selectedPostId:t,selectedPostType:n})},postType:["page","post"]}),!!o&&Object(i.createElement)("a",{href:"?post=".concat(o.id,"&action=edit")},Object(r.sprintf)(Object(r.__)('Edit "%s"'),Object(m.get)(o,["title","rendered"],""))))),b&&Object(i.createElement)(i.RawHTML,{className:"post-content-block__preview"},Object(m.get)(o,["content","rendered"]))))}),x=(n(32),"wp_template"===fullSiteEditing.editorPostType);Object(o.registerBlockType)("a8c/post-content",{title:Object(r.__)("Content Slot"),description:Object(r.__)("Placeholder for a post or a page."),icon:"layout",category:"layout",supports:{align:["wide","full"],anchor:!0,html:!1,multiple:!1,reusable:!1},edit:x?k:function(){return Object(i.createElement)(a.InnerBlocks,null)},save:x?function(){return null}:function(){return Object(i.createElement)(a.InnerBlocks.Content,null)}});var C=n(10),B=n.n(C),N=n(11),D=n.n(N),I=n(12),R=n.n(I),L=n(13),U=n.n(L),M=n(8),A=n.n(M),F=n(14),z=n.n(F),V=function(e){function t(){var e,n;B()(this,t);for(var i=arguments.length,o=new Array(i),c=0;c<i;c++)o[c]=arguments[c];return n=R()(this,(e=U()(t)).call.apply(e,[this].concat(o))),d()(A()(n),"state",{description:Object(r.__)("Site description loading…"),initialDescription:"",isDirty:!1,isSaving:!1}),d()(A()(n),"onSave",function(){var e=n.state,t=e.description,i=e.initialDescription;t&&t.trim()===i.trim()?n.setState({isDirty:!1}):n.saveSiteDescription(t)}),d()(A()(n),"revertDescription",function(){return n.setState({description:n.state.initialDescription,isSaving:!1})}),d()(A()(n),"updateInitialDescription",function(){n.setState({initialDescription:n.state.description,isDirty:!1,isSaving:!1})}),n}return z()(t,e),D()(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.noticeOperations;return w()({path:"/wp/v2/settings"}).then(function(t){var n=t.description;return e.setState({initialDescription:n,description:n})}).catch(function(e){var n=e.message;t.createErrorNotice(n)})}},{key:"componentDidUpdate",value:function(e){var t=this.state,n=t.description,i=t.initialDescription,o=this.props,r=o.shouldUpdateSiteOption,c=o.isSelected,a=n&&n.trim()===i.trim(),l=!n||0===n.trim().length;!c&&e.isSelected&&l&&this.revertDescription(),r&&!a&&!e.shouldUpdateSiteOption&&r&&this.saveSiteDescription(n)}},{key:"saveSiteDescription",value:function(e){var t=this,n=this.props.noticeOperations;this.setState({isSaving:!0}),w()({path:"/wp/v2/settings",method:"POST",data:{description:e}}).then(function(){return t.updateInitialDescription()}).catch(function(e){var i=e.message;n.createErrorNotice(i),t.revertDescription()})}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,o=t.noticeUI,l=this.state,s=l.description,u=l.isDirty,p=l.isSaving;return Object(i.createElement)(i.Fragment,null,o,Object(i.createElement)(a.PlainText,{className:n,value:s,onChange:function(t){return e.setState({description:t,isDirty:!0})},placeholder:Object(r.__)("Site Description"),"aria-label":Object(r.__)("Site Description")}),u&&Object(i.createElement)(c.Button,{ref:this.editButton,isLarge:!0,className:"site-description__save-button",disabled:p,isBusy:p,onClick:this.onSave},Object(r.__)("Save")))}}]),t}(i.Component),H=Object(g.compose)([Object(h.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,i=t.isPublishingPost,o=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||i())&&!o()}}),c.withNotices])(V);n(36);Object(o.registerBlockType)("a8c/site-description",{title:Object(r.__)("Site Description"),description:Object(r.__)("Site description, also known as the tagline."),icon:"layout",category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:H,save:function(){return null}});var Q=function(e){function t(){var e,n;B()(this,t);for(var i=arguments.length,o=new Array(i),c=0;c<i;c++)o[c]=arguments[c];return n=R()(this,(e=U()(t)).call.apply(e,[this].concat(o))),d()(A()(n),"state",{title:Object(r.__)("Site title loading…"),initialTitle:""}),d()(A()(n),"revertTitle",function(){return n.setState({title:n.state.initialTitle})}),d()(A()(n),"updateInitialTitle",function(){return n.setState({initialTitle:n.state.title})}),n}return z()(t,e),D()(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.noticeOperations;return w()({path:"/wp/v2/settings"}).then(function(t){var n=t.title;return e.setState({initialTitle:n,title:n})}).catch(function(e){var n=e.message;return t.createErrorNotice(n)})}},{key:"componentDidUpdate",value:function(e){var t=this,n=this.state,i=n.title,o=n.initialTitle,r=this.props,c=r.shouldUpdateSiteOption,a=r.noticeOperations,l=r.isSelected,s=i&&i.trim()===o.trim(),u=!i||0===i.trim().length;!l&&e.isSelected&&u&&this.revertTitle(),c&&!s&&!e.shouldUpdateSiteOption&&c&&w()({path:"/wp/v2/settings",method:"POST",data:{title:i}}).then(function(){return t.updateInitialTitle()}).catch(function(e){var n=e.message;a.createErrorNotice(n),t.revertTitle()})}},{key:"render",value:function(){var e=this,t=this.state.title,n=this.props,o=n.className,c=n.noticeUI;return Object(i.createElement)(i.Fragment,null,c,Object(i.createElement)(a.PlainText,{className:f()("site-title",o),value:t,onChange:function(t){return e.setState({title:t})},placeholder:Object(r.__)("Site Title"),"aria-label":Object(r.__)("Site Title")}))}}]),t}(i.Component),q=Object(g.compose)([Object(h.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,i=t.isPublishingPost,o=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||i())&&!o()}}),c.withNotices])(Q);n(38);Object(o.registerBlockType)("a8c/site-title",{title:Object(r.__)("Site Title"),description:Object(r.__)("Your site title."),icon:"layout",category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:q,save:function(){return null}});n(20);var G=Object(g.compose)(Object(h.withSelect)(function(e,t){var n=t.attributes,i=e("core").getEntityRecord,o=e("core/editor").getCurrentPostId,r=n.templateId;return{currentPostId:o(),template:r&&i("postType","wp_template_part",r)}}),Object(g.withState)({isEditing:!1}))(function(e){var t=e.attributes,n=e.currentPostId,o=e.isEditing,l=e.template,s=e.setAttributes,u=e.setState,p=t.align,b=t.templateId,g=!o||!!b,h=o||!b,O=!o&&!!b,v="wp_template"===fullSiteEditing.editorPostType;return Object(i.createElement)(i.Fragment,null,g&&v&&Object(i.createElement)(a.BlockControls,null,Object(i.createElement)(c.Toolbar,null,Object(i.createElement)(c.IconButton,{className:f()("components-icon-button components-toolbar__control",{"is-active":o}),label:Object(r.__)("Change Template Part"),onClick:function(){return u({isEditing:!o})},icon:"edit"}))),Object(i.createElement)("div",{className:f()("template-block",d()({},"align".concat(p),p))},h&&Object(i.createElement)(c.Placeholder,{icon:"layout",label:Object(r.__)("Template Part"),instructions:Object(r.__)("Select a template part to display")},Object(i.createElement)("div",{className:"template-block__selector"},Object(i.createElement)(T,{initialValue:Object(m.get)(l,["title","rendered"]),onSelectPost:function(e){var t=e.id;u({isEditing:!1}),s({templateId:t})},postType:"wp_template_part"}),!!l&&Object(i.createElement)("a",{href:"?post=".concat(b,"&action=edit&fse_parent_post=").concat(n)},Object(r.sprintf)(Object(r.__)('Edit "%s"'),Object(m.get)(l,["title","rendered"],""))))),O&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(i.RawHTML,{className:"template-block__content"},Object(m.get)(l,["content","rendered"])),!v&&Object(i.createElement)(c.Placeholder,{className:"template-block__overlay",instructions:Object(r.__)("This block is part of your site template and may appear on multiple pages.")},Object(i.createElement)(c.Button,{href:"?post=".concat(b,"&action=edit&fse_parent_post=").concat(n),isDefault:!0},Object(r.sprintf)(Object(r.__)("Edit %s"),Object(m.get)(l,["title","rendered"],"")))))))});"wp_template_part"!==fullSiteEditing.editorPostType&&Object(o.registerBlockType)("a8c/template",{title:Object(r.__)("Template Part"),description:Object(r.__)("Display a template part."),icon:"layout",category:"layout",attributes:{templateId:{type:"number"}},supports:{align:["wide","full"],anchor:!0,html:!1,reusable:!1},edit:G,save:function(){return null}});var Y=function(e){var t=e.className;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(a.BlockControls,null,Object(i.createElement)(c.Toolbar,null,Object(i.createElement)(c.IconButton,{className:"components-toolbar__control",icon:"edit",label:Object(r.__)("Edit Site Logo"),onClick:function(){var e=Object(l.addQueryArgs)("customize.php",{"autofocus[section]":"title_tagline",return:window.location.href});window.location.href=e}}))),Object(i.createElement)(c.ServerSideRender,{className:t,block:"a8c/site-logo",attributes:{editorPreview:!0}}))};n(41);Object(o.registerBlockType)("a8c/site-logo",{title:Object(r.__)("Site Logo"),description:Object(r.__)("Site Logo"),icon:"format-image",category:"layout",keywords:[Object(r.__)("logo"),Object(r.__)("icon"),Object(r.__)("site")],edit:Y,save:function(){return null}});var J=n(19),K=n(24),W=Object(g.compose)(Object(h.withDispatch)(function(e){return{setTemplateId:function(t){return e("core/editor").editPost({meta:{_wp_template_id:t}})}}}),Object(h.withSelect)(function(e){var t=e("core"),n=t.canUser,i=t.getEntityRecord,o=Object(m.get)(e("core/editor").getEditedPostAttribute("meta"),"_wp_template_id");return{canUserUpdateSettings:n("update","settings"),selectedTemplate:o&&i("postType","wp_template",o)}}))(function(e){var t=e.canUserUpdateSettings,n=e.setTemplateId,o=e.selectedTemplate;if(!t)return null;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(J.PluginSidebarMoreMenuItem,{target:"fse-template-sidebar",icon:"layout"},Object(r.__)("Template")),Object(i.createElement)(J.PluginSidebar,{icon:"layout",name:"fse-template-sidebar",title:Object(r.__)("Template")},Object(i.createElement)(c.PanelBody,null,Object(r.__)("Select a template"),Object(i.createElement)(T,{initialValue:Object(m.get)(o,["title","rendered"]),onSelectPost:function(e){var t=e.id;n(parseInt(t,10))},postType:"wp_template"}))))});"page"===fullSiteEditing.editorPostType&&Object(K.registerPlugin)("fse-template-selector-sidebar",{render:W});var X=n(18),Z=n.n(X);Z()(function(){if("wp_template_part"===fullSiteEditing.editorPostType&&fullSiteEditing.closeButtonUrl){var e=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");e&&(e.href=fullSiteEditing.closeButtonUrl)}});var $=function(e){function t(){return B()(this,t),R()(this,U()(t).apply(this,arguments))}return z()(t,e),D()(t,[{key:"render",value:function(){var e=this.props,t=e.onSave,n=e.onClose,o=e.isBusy,a=e.disabled;return Object(i.createElement)("div",{className:"edit-post-layout"},Object(i.createElement)("div",{className:"editor-post-publish-panel"},Object(i.createElement)("div",{className:"editor-post-publish-panel__header"},Object(i.createElement)("div",{className:"editor-post-publish-panel__header-publish-button"},Object(i.createElement)(c.Button,{isPrimary:!0,isLarge:!0,isBusy:o,onClick:t,disabled:a},Object(r.__)("Publish")),Object(i.createElement)("span",{className:"editor-post-publish-panel__spacer"})),Object(i.createElement)(c.IconButton,{"aria-expanded":!0,onClick:n,icon:"no-alt",label:Object(r.__)("Close panel")})),Object(i.createElement)("div",{className:"editor-post-publish-panel__prepublish"},Object(i.createElement)("p",null,Object(i.createElement)("strong",null,Object(r.__)("Are you ready to publish?"))),Object(i.createElement)("p",null,Object(r.__)("Changes you publish will update all pages with this template part.")))))}}]),t}(i.Component),ee={buttonStyle:{visibility:"hidden"},isPanelOpen:!1},te=function(e){function t(e){var n;return B()(this,t),n=R()(this,U()(t).call(this,e)),d()(A()(n),"onPublish",function(){n.togglePanel(),n.getOriginalButton().click()}),d()(A()(n),"togglePanel",function(){n.setState({isPanelOpen:!n.state.isPanelOpen})}),n.onResize=Object(m.debounce)(n.onResize,100),n.state=ee,n.onResize(),n}return z()(t,e),D()(t,[{key:"componentDidUpdate",value:function(e,t){var n=this;e.isFullScreen!==t.isFullScreen&&setTimeout(function(){return n.onResize()},1)}},{key:"getOriginalButton",value:function(){return document.querySelector(".edit-post-header .editor-post-publish-button")}},{key:"onResize",value:function(){var e=this.getOriginalButton(),t=ee.buttonStyle;if(Object(m.isNil)(e)||!("getBoundingClientRect"in e))return this.setState({buttonStyle:t});var n=e.getBoundingClientRect();t={height:"33px",position:"fixed",zIndex:"10001",top:n.top,left:n.x},window.matchMedia("(min-width: 600px)").matches||(t.paddingLeft="5px",t.paddingRight="5px"),this.setState({buttonStyle:t})}},{key:"getHidingCss",value:function(){return".edit-post-header .editor-post-publish-button {\n\t\t\tvisibility: hidden !important;\n\t\t}"}},{key:"render",value:function(){if(!this.shouldRender())return null;var e=this.props,t=e.isSaving,n=e.isSaveable,o=e.isPostSavingLocked,a=e.isPublishable,l=t||!n||o||!a;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(c.Button,{onClick:this.togglePanel,isPrimary:!0,isLarge:!0,style:this.state.buttonStyle,disabled:l,isBusy:this.isSaving},Object(r.__)("Update")),this.state.isPanelOpen&&Object(i.createElement)($,{isBusy:this.isSaving,onClose:this.togglePanel,onSave:this.onPublish,disabled:l}),Object(i.createElement)("style",null,this.getHidingCss()))}},{key:"shouldRender",value:function(){var e=this.props,t=e.isPublished,n=e.isPublishable,i=e.isSaveable;return!!(t&&n&&i)}}]),t}(i.Component),ne=Object(g.compose)([Object(h.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,i=t.isCurrentPostPublished,o=t.isEditedPostSaveable,r=t.isEditedPostPublishable,c=t.isPostSavingLocked,a=t.getCurrentPost;return{isSaving:n(),isSaveable:o(),isPostSavingLocked:c(),isPublishable:r(),isPublished:i(),hasPublishAction:Object(m.get)(a(),["_links","wp:action-publish"],!1),isFullScreen:e("core/edit-post").isFeatureActive("fullscreenMode")}}),Object(g.withGlobalEvents)({resize:"onResize"})])(te);Z()(function(){if("wp_template_part"===fullSiteEditing.editorPostType){var e=document.createElement("div");e.id="template-update-confirmation",document.getElementById("wpcontent").appendChild(e),Object(i.render)(Object(i.createElement)(ne,null),e)}})}]));
1
+ !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}([function(e,t){e.exports=wp.element},function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.components},function(e,t){e.exports=wp.data},function(e,t){e.exports=wp.compose},function(e,t){e.exports=wp.editor},function(e,t){e.exports=lodash},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var o=n(8);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){o(e,t,n[t])})}return e}},function(e,t){e.exports=wp.url},function(e,t){e.exports=wp.domReady},function(e,t,n){var o;
2
/*!
3
Copyright (c) 2017 Jed Watson.
4
Licensed under the MIT License (MIT), see
9
Licensed under the MIT License (MIT), see
10
http://jedwatson.github.io/classnames
11
*/
12
+ !function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o)&&o.length){var c=i.apply(null,o);c&&e.push(c)}else if("object"===r)for(var l in o)n.call(o,l)&&o[l]&&e.push(l)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(o=function(){return i}.apply(t,[]))||(e.exports=o)}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(e,t,n){var o=n(27),i=n(19);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var o=n(28);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}},function(e,t){e.exports=wp.apiFetch},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){var o=n(29),i=n(30),r=n(31);e.exports=function(e,t){return o(e)||i(e,t)||r()}},function(e,t){e.exports=wp.editPost},function(e,t,n){},function(e,t){function n(e,t,n,o,i,r,c){try{var l=e[r](c),a=l.value}catch(s){return void n(s)}l.done?t(a):Promise.resolve(a).then(o,i)}e.exports=function(e){return function(){var t=this,o=arguments;return new Promise(function(i,r){var c=e.apply(t,o);function l(e){n(c,i,r,l,a,"next",e)}function a(e){n(c,i,r,l,a,"throw",e)}l(void 0)})}}},function(e,t){e.exports=wp.plugins},function(e,t,n){},,function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=o=function(e){return n(e)}:e.exports=o=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},o(t)}e.exports=o},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var c,l=e[Symbol.iterator]();!(o=(c=l.next()).done)&&(n.push(c.value),!t||n.length!==t);o=!0);}catch(a){i=!0,r=a}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,n){},,function(e,t,n){},,function(e,t,n){},,function(e,t,n){},,,function(e,t,n){},,function(e,t,n){"use strict";n.r(t);var o=n(0),i=n(7),r=n(1),c=n(2),l=n(5),a=n(10),s=function(e){var t=e.attributes,n=Object(a.addQueryArgs)("customize.php",{"autofocus[panel]":"nav_menus",return:window.location.href});return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.BlockControls,null,Object(o.createElement)(c.Toolbar,{className:"wp-block-a8c-navigation-menu-toolbar"},Object(o.createElement)(c.IconButton,{icon:"edit",label:Object(r.__)("Edit Menu"),href:n,className:"components-toolbar__control"}))),Object(o.createElement)(c.ServerSideRender,{attributes:t,block:"a8c/navigation-menu"}))},u=(n(25),Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M12 7.27l4.28 10.43-3.47-1.53-.81-.36-.81.36-3.47 1.53L12 7.27M12 2L4.5 20.29l.71.71L12 18l6.79 3 .71-.71L12 2z"})));Object(i.registerBlockType)("a8c/navigation-menu",{title:Object(r.__)("Navigation Menu"),description:Object(r.__)("Visual placeholder for site-wide navigation and menus."),icon:u,category:"layout",supports:{html:!1,reusable:!1},attributes:{themeLocation:{type:"string",default:"menu-1"}},edit:s,save:function(){return null}});var p=n(8),d=n.n(p),b=n(13),f=n.n(b),m=n(14),g=n.n(m),O=n(15),h=n.n(O),v=n(16),j=n.n(v),y=n(17),_=n.n(y),S=n(12),E=n.n(S),w=n(6),P=n(4),k=n(3),x=n(20),T=n.n(x),C=n(9),B=n.n(C),I=n(23),N=n.n(I),R=n(18),L=n.n(R),U=(n(32),Object(w.debounce)(function(){var e=N()(regeneratorRuntime.mark(function e(t,n,o){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o({loading:!0,showSuggestions:!0,suggestions:[]}),e.next=3,L()({path:Object(a.addQueryArgs)("/wp/v2/search",B()({context:"embed",per_page:20,search:t},!!n&&{subtype:n}))});case 3:i=e.sent,o({loading:!1,showSuggestions:!0,suggestions:i});case 5:case"end":return e.stop()}},e)}));return function(t,n,o){return e.apply(this,arguments)}}(),200)),A=Object(P.withState)({loading:!1,showSuggestions:!1,suggestions:[]})(function(e){var t=e.initialValue,n=e.loading,i=e.onSelectPost,l=e.postType,a=e.setState,s=e.showSuggestions,u=e.suggestions,p=Object(o.useState)(t),d=T()(p,2),b=d[0],f=d[1],m=function(e){return function(){var t=function(e,t,n){var o=e.id,i=e.title,r=e.subtype;return t({loading:!1,showSuggestions:!1,suggestions:[]}),n(i),{id:o,type:r}}(e,a,f);i(t)}};return Object(o.createElement)("div",{className:"a8c-post-autocomplete"},Object(o.createElement)(c.TextControl,{autoComplete:"off",onChange:function(e){f(e),e.length<2?a({loading:!1,showSuggestions:!1}):U(e,l,a)},placeholder:Object(r.__)("Type to search"),type:"search",value:b}),n&&Object(o.createElement)(c.Spinner,null),s&&!!u.length&&Object(o.createElement)(c.Popover,{focusOnMount:!1,noArrow:!0,position:"bottom"},Object(o.createElement)("div",{className:"a8c-post-autocomplete__suggestions"},Object(w.map)(u,function(e){return Object(o.createElement)(c.Button,{isLarge:!0,isLink:!0,key:e.id,onClick:m(e)},e.title)}))))}),M=function(e){function t(){return f()(this,t),h()(this,j()(t).apply(this,arguments))}return _()(t,e),g()(t,[{key:"toggleEditing",value:function(){var e=this.props,t=e.isEditing;(0,e.setState)({isEditing:!t})}},{key:"onSelectPost",value:function(e){var t=e.id,n=e.type;this.props.setState({isEditing:!1,selectedPostId:t,selectedPostType:n})}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.isEditing,i=e.selectedPost,a=t.align,s="wp_template"===fullSiteEditing.editorPostType,u=s&&(!n||!!i),p=s&&(n||!i),b=s&&!n&&!!i,f=!s;return Object(o.createElement)(o.Fragment,null,u&&Object(o.createElement)(l.BlockControls,null,Object(o.createElement)(c.Toolbar,null,Object(o.createElement)(c.IconButton,{className:E()("components-icon-button components-toolbar__control",{"is-active":n}),label:Object(r.__)("Change Preview"),onClick:this.toggleEditing,icon:"edit"}))),Object(o.createElement)("div",{className:E()("post-content-block",d()({},"align".concat(a),a))},Object(o.createElement)(l.PostTitle,null),f&&Object(o.createElement)(l.InnerBlocks,{templateLock:!1}),p&&Object(o.createElement)(c.Placeholder,{icon:"layout",label:Object(r.__)("Content Slot"),instructions:Object(r.__)("Placeholder for a post or a page.")},Object(o.createElement)("div",{className:"post-content-block__selector"},Object(o.createElement)("div",null,Object(r.__)("Select something to preview:")),Object(o.createElement)(A,{initialValue:Object(w.get)(i,["title","rendered"]),onSelectPost:this.onSelectPost,postType:["page","post"]}),!!i&&Object(o.createElement)("a",{href:"?post=".concat(i.id,"&action=edit")},Object(r.sprintf)(Object(r.__)('Edit "%s"'),Object(w.get)(i,["title","rendered"],""))))),b&&Object(o.createElement)(o.RawHTML,{className:"post-content-block__preview"},Object(w.get)(i,["content","rendered"]))))}}]),t}(o.Component),z=Object(P.compose)([Object(P.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(k.withSelect)(function(e,t){var n=t.selectedPostId,o=t.selectedPostType;return{selectedPost:(0,e("core").getEntityRecord)("postType",o,n)}})])(M),D="wp_template"===fullSiteEditing.editorPostType?function(){return null}:function(){return Object(o.createElement)(l.InnerBlocks.Content,null)};n(34);function F(e){var t=Object(o.useRef)();return Object(o.useEffect)(function(){t.current=e},[e]),t.current}function H(e,t,n,i,c,l){var a=Object(o.useState)({option:t,previousOption:"",loaded:!1,error:!1}),s=T()(a,2),u=s[0],p=s[1],b=F(i),f=F(c);function m(){p(B()({},u,{option:u.previousOption,isSaving:!1}))}return Object(o.useEffect)(function(){u.loaded||u.error?function(){var t=u.option,o=u.previousOption,l=t&&t.trim()===o.trim(),a=!t||0===t.trim().length;!i&&b&&a&&m();if(!c||l)return;!f&&c&&function(t){p(B()({},u,{isSaving:!0})),L()({path:"/wp/v2/settings",method:"POST",data:d()({},e,t)}).then(function(){return function(e){p(B()({},u,{previousOption:e,isDirty:!1,isSaving:!1}))}(t)}).catch(function(){n(Object(r.sprintf)(Object(r.__)("Unable to save site %s"),e)),m()})}(t)}():L()({path:"/wp/v2/settings"}).then(function(t){return p(B()({},u,{option:t[e],previousOption:t[e],loaded:!0,error:!1}))}).catch(function(){n(Object(r.sprintf)(Object(r.__)("Unable to load site %s"),e)),p(B()({},u,{option:Object(r.sprintf)(Object(r.__)("Error loading site %s"),e),error:!0}))})}),{siteOptions:u,handleChange:function(e){l({updated:Date.now()}),p(B()({},u,{option:e}))}}}Object(i.registerBlockType)("a8c/post-content",{title:Object(r.__)("Content Slot"),description:Object(r.__)("Placeholder for a post or a page."),icon:"layout",category:"layout",supports:{align:["wide","full"],anchor:!0,html:!1,multiple:!1,reusable:!1},edit:z,save:D});var V=Object(P.compose)([Object(k.withDispatch)(function(e){return{createErrorNotice:e("core/notices").createErrorNotice}}),Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,i=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||o())&&!i()}})])(function(e){var t=e.className,n=e.createErrorNotice,i=e.shouldUpdateSiteOption,c=e.isSelected,a=e.setAttributes,s=H("description",Object(r.__)("Site description loading…"),n,c,i,a),u=s.siteOptions,p=s.handleChange,d=u.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.PlainText,{className:t,value:d,onChange:function(e){return p(e)},placeholder:Object(r.__)("Site Description"),"aria-label":Object(r.__)("Site Description")}))});n(36);Object(i.registerBlockType)("a8c/site-description",{title:Object(r.__)("Site Description"),description:Object(r.__)("Site description, also known as the tagline."),icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M4 9h16v2H4V9zm0 4h10v2H4v-2z"})),category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:V,save:function(){return null}});var Q=Object(P.compose)([Object(k.withDispatch)(function(e){return{createErrorNotice:e("core/notices").createErrorNotice}}),Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,i=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||o())&&!i()}})])(function(e){var t=e.className,n=e.createErrorNotice,i=e.shouldUpdateSiteOption,c=e.isSelected,a=e.setAttributes,s=H("title",Object(r.__)("Site title loading…"),n,c,i,a),u=s.siteOptions,p=s.handleChange,d=u.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.PlainText,{className:E()("site-title",t),value:d,onChange:function(e){return p(e)},placeholder:Object(r.__)("Site Title"),"aria-label":Object(r.__)("Site Title")}))});n(38);Object(i.registerBlockType)("a8c/site-title",{title:Object(r.__)("Site Title"),description:Object(r.__)("Your site title."),icon:"layout",category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:Q,save:function(){return null}});n(22);var q=Object(P.compose)(Object(P.withState)({templateClientId:null}),Object(k.withSelect)(function(e,t){var n=t.attributes,o=t.templateClientId,i=e("core").getEntityRecord,r=e("core/editor").getCurrentPostId,c=e("core/block-editor").getBlock,l=n.templateId,s=r(),u=l&&i("postType","wp_template_part",l);return{currentPostId:s,editTemplatePartUrl:Object(a.addQueryArgs)(fullSiteEditing.editTemplatePartBaseUrl,{post:l,fse_parent_post:s}),template:u,templateBlock:c(o),templateTitle:Object(w.get)(u,["title","rendered"],"")}}),Object(k.withDispatch)(function(e,t){var n=e("core/block-editor").receiveBlocks,o=t.template,r=t.templateClientId,c=t.setState;return{receiveTemplateBlocks:function(){if(o&&!r){var e=Object(i.parse)(Object(w.get)(o,["content","raw"],"")),t=1===e.length?e[0]:Object(i.createBlock)("core/template",{},e);n([t]),c({templateClientId:t.clientId})}}}}))(function(e){var t=e.attributes,n=e.editTemplatePartUrl,i=e.receiveTemplateBlocks,a=e.template,s=e.templateBlock,u=e.templateTitle;if(!a)return Object(o.createElement)(c.Placeholder,null,Object(o.createElement)(c.Spinner,null));Object(o.useEffect)(function(){i()});var p=t.align;return Object(o.createElement)("div",{className:E()("template-block",d()({},"align".concat(p),p))},s&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.Disabled,null,Object(o.createElement)(l.BlockEdit,{attributes:s.attributes,block:s,clientId:s.clientId,isSelected:!1,name:s.name,setAttributes:w.noop})),Object(o.createElement)(c.Placeholder,{className:"template-block__overlay",instructions:Object(r.__)("This block is part of your site template and may appear on multiple pages.")},Object(o.createElement)(c.Button,{href:n,isDefault:!0},Object(r.sprintf)(Object(r.__)("Edit %s"),u)))))});"wp_template_part"!==fullSiteEditing.editorPostType&&Object(i.registerBlockType)("a8c/template",{title:Object(r.__)("Template Part"),description:Object(r.__)("Display a template part."),icon:"layout",category:"layout",attributes:{templateId:{type:"number"}},supports:{align:["wide","full"],anchor:!0,html:!1,reusable:!1},edit:q,save:function(){return null}});var G=function(e){var t=e.className;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.BlockControls,null,Object(o.createElement)(c.Toolbar,null,Object(o.createElement)(c.IconButton,{className:"components-toolbar__control",icon:"edit",label:Object(r.__)("Edit Site Logo"),onClick:function(){var e=Object(a.addQueryArgs)("customize.php",{"autofocus[section]":"title_tagline",return:window.location.href});window.location.href=e}}))),Object(o.createElement)(c.ServerSideRender,{className:t,block:"a8c/site-logo",attributes:{editorPreview:!0}}))};n(41);Object(i.registerBlockType)("a8c/site-logo",{title:Object(r.__)("Site Logo"),description:Object(r.__)("Site Logo"),icon:"format-image",category:"layout",keywords:[Object(r.__)("logo"),Object(r.__)("icon"),Object(r.__)("site")],edit:G,save:function(){return null}});var Y=n(21),J=n(24),K=Object(P.compose)(Object(k.withDispatch)(function(e){return{setTemplateId:function(t){return e("core/editor").editPost({meta:{_wp_template_id:t}})}}}),Object(k.withSelect)(function(e){var t=e("core"),n=t.canUser,o=t.getEntityRecord,i=Object(w.get)(e("core/editor").getEditedPostAttribute("meta"),"_wp_template_id");return{canUserUpdateSettings:n("update","settings"),selectedTemplate:i&&o("postType","wp_template",i)}}))(function(e){var t=e.canUserUpdateSettings,n=e.setTemplateId,i=e.selectedTemplate;if(!t)return null;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(Y.PluginSidebarMoreMenuItem,{target:"fse-template-sidebar",icon:"layout"},Object(r.__)("Template")),Object(o.createElement)(Y.PluginSidebar,{icon:"layout",name:"fse-template-sidebar",title:Object(r.__)("Template")},Object(o.createElement)(c.PanelBody,null,Object(r.__)("Select a template"),Object(o.createElement)(A,{initialValue:Object(w.get)(i,["title","rendered"]),onSelectPost:function(e){var t=e.id;n(parseInt(t,10))},postType:"wp_template"}))))});"page"===fullSiteEditing.editorPostType&&Object(J.registerPlugin)("fse-template-selector-sidebar",{render:K});var W=n(11),X=n.n(W);X()(function(){if("wp_template_part"===fullSiteEditing.editorPostType&&fullSiteEditing.closeButtonUrl)var e=setInterval(function(){var t=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");t&&(clearInterval(e),fullSiteEditing.closeButtonUrl&&(t.href=fullSiteEditing.closeButtonUrl))})});var Z=n(19),$=n.n(Z),ee=function(e){function t(){return f()(this,t),h()(this,j()(t).apply(this,arguments))}return _()(t,e),g()(t,[{key:"render",value:function(){var e=this.props,t=e.onSave,n=e.onClose,i=e.isBusy,l=e.disabled;return Object(o.createElement)("div",{className:"edit-post-layout"},Object(o.createElement)("div",{className:"editor-post-publish-panel"},Object(o.createElement)("div",{className:"editor-post-publish-panel__header"},Object(o.createElement)("div",{className:"editor-post-publish-panel__header-publish-button"},Object(o.createElement)(c.Button,{isPrimary:!0,isLarge:!0,isBusy:i,onClick:t,disabled:l},Object(r.__)("Publish")),Object(o.createElement)("span",{className:"editor-post-publish-panel__spacer"})),Object(o.createElement)(c.IconButton,{"aria-expanded":!0,onClick:n,icon:"no-alt",label:Object(r.__)("Close panel")})),Object(o.createElement)("div",{className:"editor-post-publish-panel__prepublish"},Object(o.createElement)("p",null,Object(o.createElement)("strong",null,Object(r.__)("Are you ready to publish?"))),Object(o.createElement)("p",null,Object(r.__)("Changes you publish will update all pages with this template part.")))))}}]),t}(o.Component),te={buttonStyle:{visibility:"hidden"},isPanelOpen:!1},ne=function(e){function t(e){var n;return f()(this,t),n=h()(this,j()(t).call(this,e)),d()($()(n),"onPublish",function(){n.togglePanel(),n.getOriginalButton().click()}),d()($()(n),"togglePanel",function(){n.setState({isPanelOpen:!n.state.isPanelOpen})}),n.onResize=Object(w.debounce)(n.onResize,100),n.state=te,n.onResize(),n}return _()(t,e),g()(t,[{key:"componentDidUpdate",value:function(e,t){var n=this;e.isFullScreen!==t.isFullScreen&&setTimeout(function(){return n.onResize()},1)}},{key:"getOriginalButton",value:function(){return document.querySelector(".edit-post-header .editor-post-publish-button")}},{key:"onResize",value:function(){var e=this.getOriginalButton(),t=te.buttonStyle;if(Object(w.isNil)(e)||!("getBoundingClientRect"in e))return this.setState({buttonStyle:t});var n=e.getBoundingClientRect();t={height:"33px",position:"fixed",zIndex:"10001",top:n.top,left:n.x},window.matchMedia("(min-width: 600px)").matches||(t.paddingLeft="5px",t.paddingRight="5px"),this.setState({buttonStyle:t})}},{key:"getHidingCss",value:function(){return".edit-post-header .editor-post-publish-button {\n\t\t\tvisibility: hidden !important;\n\t\t}"}},{key:"render",value:function(){if(!this.shouldRender())return null;var e=this.props,t=e.isSaving,n=e.isSaveable,i=e.isPostSavingLocked,l=e.isPublishable,a=t||!n||i||!l;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.Button,{onClick:this.togglePanel,isPrimary:!0,isLarge:!0,style:this.state.buttonStyle,disabled:a,isBusy:this.isSaving},Object(r.__)("Update")),this.state.isPanelOpen&&Object(o.createElement)(ee,{isBusy:this.isSaving,onClose:this.togglePanel,onSave:this.onPublish,disabled:a}),Object(o.createElement)("style",null,this.getHidingCss()))}},{key:"shouldRender",value:function(){var e=this.props,t=e.isPublished,n=e.isPublishable,o=e.isSaveable;return!!(t&&n&&o)}}]),t}(o.Component),oe=Object(P.compose)([Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isCurrentPostPublished,i=t.isEditedPostSaveable,r=t.isEditedPostPublishable,c=t.isPostSavingLocked,l=t.getCurrentPost;return{isSaving:n(),isSaveable:i(),isPostSavingLocked:c(),isPublishable:r(),isPublished:o(),hasPublishAction:Object(w.get)(l(),["_links","wp:action-publish"],!1),isFullScreen:e("core/edit-post").isFeatureActive("fullscreenMode")}}),Object(P.withGlobalEvents)({resize:"onResize"})])(ne);X()(function(){if("wp_template_part"===fullSiteEditing.editorPostType){var e=document.createElement("div");e.id="template-update-confirmation",document.getElementById("wpcontent").appendChild(e),Object(o.render)(Object(o.createElement)(oe,null),e)}});var ie=Object(P.compose)(Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.getBlocks,o=t.getEditorSettings,i=e("core/edit-post").getEditorMode,r=n().find(function(e){return"a8c/post-content"===e.name});return{rootClientId:r?r.clientId:"",showInserter:"visual"===i()&&o().richEditingEnabled}}))(function(e){var t=e.rootClientId,n=e.showInserter;return Object(o.createElement)(l.Inserter,{rootClientId:t,disabled:!n,position:"bottom right"})});X()(function(){return function(){if("page"===fullSiteEditing.editorPostType)var e=setInterval(function(){var t=document.querySelector(".edit-post-header-toolbar");if(t){clearInterval(e);var n=document.createElement("div");n.classList.add("fse-post-content-block-inserter"),t.insertBefore(n,t.firstChild),Object(o.render)(Object(o.createElement)(ie,null),n)}})}()}),X()(function(){"page"===fullSiteEditing.editorPostType&&Object(k.dispatch)("core/editor").setTemplateValidity(!0)})}]));
full-site-editing/dist/full-site-editing.rtl.css CHANGED
@@ -1 +1 @@
1
- .wp-block-a8c-navigation-menu .main-navigation{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:700;letter-spacing:-.02em;line-height:1.2;pointer-events:none;-webkit-font-smoothing:antialiased}.wp-block-a8c-navigation-menu .main-navigation .main-menu{display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li{color:#0073aa;display:inline;position:relative}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li>a{font-weight:700;color:#0073aa;margin-left:.5rem}.main-navigation .main-menu>li:last-child.menu-item-has-children .submenu-expand,.wp-block-a8c-navigation-menu .main-navigation .main-menu>li:last-child>a{margin-left:0}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children>a{margin-left:.125rem}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children{display:inline-block;position:inherit}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children .submenu-expand{display:inline-block;margin-left:.25rem}.wp-block-a8c-navigation-menu .main-navigation .main-menu>li.menu-item-has-children .submenu-expand svg{position:relative;top:.3rem}.main-navigation .main-menu>li>a:hover+svg,.wp-block-a8c-navigation-menu .main-navigation .main-menu>li>a:hover{color:#005177}.wp-block-a8c-navigation-menu .main-navigation svg{transition:fill .12s ease-in-out;fill:currentColor}.wp-block-a8c-navigation-menu .main-navigation a{text-decoration:none}.wp-block-a8c-navigation-menu .main-navigation button{display:inline-block;border:none;padding:0;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.88889em;font-weight:700;line-height:1.2;text-decoration:none;vertical-align:bottom;background:transparent;color:inherit;cursor:pointer;transition:background .25s ease-in-out,transform .15s ease;-webkit-appearance:none;-moz-appearance:none}.wp-block-a8c-navigation-menu .main-menu-more{display:none}.wp-block-a8c-navigation-menu .social-navigation{line-height:1.25;margin-top:.5rem;text-align:right}.wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu{content:"";display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu li{display:inline-block;vertical-align:bottom;vertical-align:-webkit-baseline-middle;list-style:none}.wp-block-a8c-navigation-menu .social-navigation ul.social-links-menu li a svg{display:block;width:32px;height:32px;transform:translateZ(0)}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu{display:inline;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.71111em;padding-right:0}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu li{display:inline;margin-left:1rem}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu a{text-decoration:none;color:#767676}.wp-block-a8c-navigation-menu .footer-navigation .footer-menu a:hover{text-decoration:none;color:#0073aa}.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a,.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a:hover{color:#555d66}.a8c-post-autocomplete{position:relative}.a8c-post-autocomplete .components-spinner{bottom:7px;position:absolute;left:-5px}.a8c-post-autocomplete__suggestions{max-height:200px;overflow-y:auto;width:302px}.a8c-post-autocomplete__suggestions .components-button{display:block;height:auto;min-height:30px;white-space:normal;width:100%;word-wrap:break-word}.post-content-block.alignfull{padding:0 12px}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.block-editor .wp-block-a8c-site-description,.block-editor .wp-block-a8c-site-description:focus{display:inline;color:#767676;font-size:1.125em;font-weight:400;letter-spacing:-.01em;margin:0}.block-editor .site-description__save-button{margin-right:auto;display:block}.block-editor .wp-block-a8c-site-title,.block-editor .wp-block-a8c-site-title:focus{display:inline;color:#111;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:400;letter-spacing:-.02em;line-height:1.2;margin:0}.template-block{min-height:200px}.template-block:hover .template-block__overlay{display:flex}.template-block.alignfull{padding:0 12px}.template-block__selector{width:300px}.template-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.template-block__content{pointer-events:none}.template-block__content:after{content:"";clear:both;display:table}.template-block__overlay{display:none;position:absolute;top:0;right:0;width:100%;height:100%}.wp-block-a8c-site-logo{pointer-events:none}
1
+ .wp-block-a8c-navigation-menu.main-navigation{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:700;letter-spacing:-.02em;line-height:1.2;pointer-events:none;-webkit-font-smoothing:antialiased}.wp-block-a8c-navigation-menu.main-navigation .main-menu{display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li{color:#0073aa;display:inline;position:relative}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li>a{font-weight:700;color:#0073aa;margin-left:.5rem}.main-navigation .main-menu>li:last-child.menu-item-has-children .submenu-expand,.wp-block-a8c-navigation-menu.main-navigation .main-menu>li:last-child>a{margin-left:0}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children>a{margin-left:.125rem}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children{display:inline-block;position:inherit}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children .submenu-expand{display:inline-block;margin-left:.25rem}.wp-block-a8c-navigation-menu.main-navigation .main-menu>li.menu-item-has-children .submenu-expand svg{position:relative;top:.3rem}.main-navigation .main-menu>li>a:hover+svg,.wp-block-a8c-navigation-menu.main-navigation .main-menu>li>a:hover{color:#005177}.wp-block-a8c-navigation-menu.main-navigation .main-menu-more{display:none}.wp-block-a8c-navigation-menu.main-navigation svg{transition:fill .12s ease-in-out;fill:currentColor}.wp-block-a8c-navigation-menu.main-navigation a{text-decoration:none}.wp-block-a8c-navigation-menu.main-navigation button{display:inline-block;border:none;padding:0;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.88889em;font-weight:700;line-height:1.2;text-decoration:none;vertical-align:bottom;background:transparent;color:inherit;cursor:pointer;transition:background .25s ease-in-out,transform .15s ease;-webkit-appearance:none;-moz-appearance:none}.wp-block-a8c-navigation-menu.main-menu-more{display:none}.wp-block-a8c-navigation-menu.social-navigation{line-height:1.25;margin-top:.5rem;text-align:right}.wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu{content:"";display:inline-block;margin:0;padding:0}.wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu li{display:inline-block;vertical-align:bottom;vertical-align:-webkit-baseline-middle;list-style:none}.wp-block-a8c-navigation-menu.social-navigation ul.social-links-menu li a svg{display:block;width:32px;height:32px;transform:translateZ(0)}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu{display:inline;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:.71111em;padding-right:0}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu li{display:inline;margin-left:1rem}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu a{text-decoration:none;color:#767676}.wp-block-a8c-navigation-menu.footer-navigation .footer-menu a:hover{text-decoration:none;color:#0073aa}.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a,.editor-styles-wrapper .wp-block-a8c-navigation-menu-toolbar a:hover{color:#555d66}.a8c-post-autocomplete{position:relative}.a8c-post-autocomplete .components-spinner{bottom:7px;position:absolute;left:-5px}.a8c-post-autocomplete__suggestions{max-height:200px;overflow-y:auto;width:302px}.a8c-post-autocomplete__suggestions .components-button{display:block;height:auto;min-height:30px;white-space:normal;width:100%;word-wrap:break-word}.post-content-block.alignfull{padding:0 12px}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor .wp-block-a8c-site-description,.block-editor .wp-block-a8c-site-description:focus{display:inline;color:#767676;font-size:1.125em;font-weight:400;letter-spacing:-.01em;margin:0;box-shadow:none;background-color:transparent}.block-editor .site-description__save-button{margin-right:auto;display:block}.block-editor .site-title:not(:empty)+.site-description:not(:empty):before{content:"\2014";margin:0 .2em}.block-editor .wp-block-a8c-site-title,.block-editor .wp-block-a8c-site-title:focus{display:inline;color:#111;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1.125em;font-weight:400;letter-spacing:-.02em;line-height:1.2;margin:0;box-shadow:none;background-color:transparent}.block-editor .site-title__save-button{margin-right:auto;display:block}.block-editor .site-title a:link,.block-editor .site-title a:visited{color:#111;text-decoration:none;font-weight:400}.template-block{min-height:200px}.template-block:hover .template-block__overlay{display:flex}.template-block.alignfull{padding:0 12px}.template-block__selector{width:300px}.template-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.template-block__content{pointer-events:none}.template-block__content:after{content:"";clear:both;display:table}.template-block__overlay{display:none;position:absolute;top:0;right:0;width:100%;height:100%;background:rgba(0,0,0,.75)}.template-block__overlay .components-placeholder__instructions{color:#fff}.wp-block-a8c-site-logo{pointer-events:none}
full-site-editing/editor/block-inserter/index.js ADDED
@@ -0,0 +1,39 @@
1
+ /* global fullSiteEditing */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import domReady from '@wordpress/dom-ready';
7
+ import { render } from '@wordpress/element';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import PostContentBlockAppender from './post-content-block-appender';
13
+
14
+ /**
15
+ * Renders a custom block inserter that will append new blocks inside the post content block.
16
+ */
17
+ function renderPostContentBlockInserter() {
18
+ if ( 'page' !== fullSiteEditing.editorPostType ) {
19
+ return;
20
+ }
21
+
22
+ const editPostHeaderToolbarInception = setInterval( () => {
23
+ const headerToolbar = document.querySelector( '.edit-post-header-toolbar' );
24
+
25
+ if ( ! headerToolbar ) {
26
+ return;
27
+ }
28
+ clearInterval( editPostHeaderToolbarInception );
29
+
30
+ const blockInserterContainer = document.createElement( 'div' );
31
+ blockInserterContainer.classList.add( 'fse-post-content-block-inserter' );
32
+
33
+ headerToolbar.insertBefore( blockInserterContainer, headerToolbar.firstChild );
34
+
35
+ render( <PostContentBlockAppender />, blockInserterContainer );
36
+ } );
37
+ }
38
+
39
+ domReady( () => renderPostContentBlockInserter() );
full-site-editing/editor/block-inserter/post-content-block-appender.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { Inserter } from '@wordpress/editor';
5
+ import { compose } from '@wordpress/compose';
6
+ import { withSelect } from '@wordpress/data';
7
+
8
+ const PostContentBlockAppender = compose(
9
+ withSelect( select => {
10
+ const { getBlocks, getEditorSettings } = select( 'core/editor' );
11
+ const { getEditorMode } = select( 'core/edit-post' );
12
+
13
+ const postContentBlock = getBlocks().find( block => block.name === 'a8c/post-content' );
14
+
15
+ return {
16
+ rootClientId: postContentBlock ? postContentBlock.clientId : '',
17
+ showInserter: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled,
18
+ };
19
+ } )
20
+ )( ( { rootClientId, showInserter } ) => {
21
+ return (
22
+ <Inserter rootClientId={ rootClientId } disabled={ ! showInserter } position="bottom right" />
23
+ );
24
+ } );
25
+
26
+ export default PostContentBlockAppender;
full-site-editing/editor/index.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import './block-inserter';
5
+ import './template-validity-override';
full-site-editing/editor/template-validity-override/index.js ADDED
@@ -0,0 +1,25 @@
1
+ /* global fullSiteEditing */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import domReady from '@wordpress/dom-ready';
7
+ import { dispatch } from '@wordpress/data';
8
+
9
+ /**
10
+ * Forces the template validity.
11
+ *
12
+ * This is a work-around for the existing core issue that is showing a template mismatch warning when there is a parent
13
+ * block with a locked template containing a nested InnerBlocks with an unlocked template.
14
+ *
15
+ * @see https://github.com/WordPress/gutenberg/issues/11681
16
+ */
17
+ function resetTemplateValidity() {
18
+ if ( 'page' !== fullSiteEditing.editorPostType ) {
19
+ return;
20
+ }
21
+
22
+ dispatch( 'core/editor' ).setTemplateValidity( true );
23
+ }
24
+
25
+ domReady( () => resetTemplateValidity() );
full-site-editing/index.js CHANGED
@@ -10,3 +10,4 @@ import './blocks/site-logo';
10
import './plugins/template-selector-sidebar';
11
import './plugins/close-button-override';
12
import './plugins/template-update-confirmation';
10
import './plugins/template-selector-sidebar';
11
import './plugins/close-button-override';
12
import './plugins/template-update-confirmation';
13
+ import './editor';
full-site-editing/page-fse.php ADDED
@@ -0,0 +1,58 @@
1
+ <?php
2
+ /**
3
+ * The Full Site Editing page template.
4
+ *
5
+ * @package full-site-editing
6
+ */
7
+
8
+ ?>
9
+
10
+ <!doctype html>
11
+ <html <?php language_attributes(); ?>>
12
+ <head>
13
+ <meta charset="<?php bloginfo( 'charset' ); ?>" />
14
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
15
+ <link rel="profile" href="https://gmpg.org/xfn/11" />
16
+ <?php wp_head(); ?>
17
+ </head>
18
+
19
+ <body <?php body_class(); ?>>
20
+ <div id="page" class="site">
21
+ <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'twentynineteen' ); ?></a>
22
+
23
+ <?php fse_get_header(); ?>
24
+
25
+ <div id="content" class="site-content">
26
+
27
+ <section id="primary" class="content-area">
28
+ <main id="main" class="site-main">
29
+
30
+ <?php
31
+
32
+ /* Start the Loop */
33
+ while ( have_posts() ) :
34
+ the_post();
35
+
36
+ get_template_part( 'template-parts/content/content', 'page' );
37
+
38
+ // If comments are open or we have at least one comment, load up the comment template.
39
+ if ( comments_open() || get_comments_number() ) {
40
+ comments_template();
41
+ }
42
+
43
+ endwhile; // End of the loop.
44
+ ?>
45
+
46
+ </main><!-- #main -->
47
+ </section><!-- #primary -->
48
+
49
+ </div><!-- #content -->
50
+
51
+ <?php fse_get_footer(); ?>
52
+
53
+ </div><!-- #page -->
54
+
55
+ <?php wp_footer(); ?>
56
+
57
+ </body>
58
+ </html>
full-site-editing/plugins/close-button-override/index.js CHANGED
@@ -16,9 +16,16 @@ domReady( () => {
16
return;
17
}
18
19
- const closeButton = document.querySelector( '.edit-post-fullscreen-mode-close__toolbar a' );
20
21
- if ( closeButton ) {
22
- closeButton.href = fullSiteEditing.closeButtonUrl;
23
- }
24
} );
16
return;
17
}
18
19
+ const editPostHeaderInception = setInterval( () => {
20
+ const closeButton = document.querySelector( '.edit-post-fullscreen-mode-close__toolbar a' );
21
22
+ if ( ! closeButton ) {
23
+ return;
24
+ }
25
+ clearInterval( editPostHeaderInception );
26
+
27
+ if ( fullSiteEditing.closeButtonUrl ) {
28
+ closeButton.href = fullSiteEditing.closeButtonUrl;
29
+ }
30
+ } );
31
} );
full-site-editing/utils/class-a8c-wp-template-data-inserter.php CHANGED
@@ -72,9 +72,14 @@ class A8C_WP_Template_Data_Inserter {
72
*/
73
public function get_header_content() {
74
// TODO: replace with header blocks once they are ready.
75
- return '<!-- wp:heading -->' .
76
- '<h2>Test Header Content</h2>' .
77
- '<!-- /wp:heading -->';
78
}
79
80
/**
@@ -83,10 +88,7 @@ class A8C_WP_Template_Data_Inserter {
83
* @return string
84
*/
85
public function get_footer_content() {
86
- // TODO: replace with footer blocks once they are ready.
87
- return '<!-- wp:heading -->' .
88
- '<h2>Test Footer Content</h2>' .
89
- '<!-- /wp:heading -->';
90