Full Site Editing - Version 0.9

Version Description

  • Rename wp_template CPT to wp_template_part.
Download this release

Release Info

Developer vindl
Plugin Icon wp plugin Full Site Editing
Version 0.9
Comparing to
See all releases

Code changes from version 0.7.1 to 0.9

Files changed (36) hide show
  1. full-site-editing-plugin.php +2 -2
  2. full-site-editing/blocks/post-content/style.scss +18 -3
  3. full-site-editing/blocks/site-logo/edit.js +0 -41
  4. full-site-editing/blocks/site-logo/index.js +0 -21
  5. full-site-editing/blocks/site-logo/index.php +0 -54
  6. full-site-editing/blocks/site-logo/style.scss +0 -3
  7. full-site-editing/blocks/template/edit.js +19 -2
  8. full-site-editing/blocks/template/index.js +3 -3
  9. full-site-editing/blocks/template/style.scss +1 -1
  10. full-site-editing/class-a8c-rest-templates-controller.php +0 -47
  11. full-site-editing/class-full-site-editing.php +5 -10
  12. full-site-editing/components/post-autocomplete/index.js +0 -113
  13. full-site-editing/components/post-autocomplete/style.scss +0 -24
  14. full-site-editing/dist/full-site-editing.css +1 -1
  15. full-site-editing/dist/full-site-editing.js +2 -2
  16. full-site-editing/dist/full-site-editing.rtl.css +1 -1
  17. full-site-editing/editor/remove-editor-panels/index.js +1 -1
  18. full-site-editing/editor/style.scss +10 -12
  19. full-site-editing/editor/suppress-draft-action/index.js +5 -1
  20. full-site-editing/editor/suppress-trash-action/index.js +5 -1
  21. full-site-editing/page-fse.php +0 -58
  22. full-site-editing/plugins/close-button-override/index.js +1 -12
  23. full-site-editing/plugins/close-button-override/style.scss +0 -13
  24. full-site-editing/plugins/editor-template-classes/index.js +7 -3
  25. full-site-editing/plugins/template-selector-sidebar/index.js +0 -71
  26. full-site-editing/plugins/template-update-confirmation/button.js +0 -143
  27. full-site-editing/plugins/template-update-confirmation/index.js +0 -21
  28. full-site-editing/plugins/template-update-confirmation/panel.js +0 -40
  29. full-site-editing/plugins/template-update-notice/index.js +1 -1
  30. full-site-editing/templates/class-wp-template-inserter.php +148 -66
  31. full-site-editing/templates/class-wp-template.php +9 -2
  32. full-site-editing/utils/class-a8c-wp-template-data-inserter.php +0 -107
  33. full-site-editing/utils/class-a8c-wp-template.php +0 -234
  34. lib/feature-flags/class-a8c-full-site-editing-feature-flags.php +0 -118
  35. lib/feature-flags/index.js +0 -9
  36. readme.txt +4 -3
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.7.1
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
@@ -20,7 +20,7 @@ namespace A8C\FSE;
20
  *
21
  * @var string
22
  */
23
- define( 'PLUGIN_VERSION', '0.7.1' );
24
 
25
  // Themes which are supported by Full Site Editing (not the same as the SPT themes).
26
  const SUPPORTED_THEMES = [ 'maywood' ];
2
  /**
3
  * Plugin Name: Full Site Editing
4
  * Description: Enhances your page creation workflow within the Block Editor.
5
+ * Version: 0.9
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
20
  *
21
  * @var string
22
  */
23
+ define( 'PLUGIN_VERSION', '0.9' );
24
 
25
  // Themes which are supported by Full Site Editing (not the same as the SPT themes).
26
  const SUPPORTED_THEMES = [ 'maywood' ];
full-site-editing/blocks/post-content/style.scss CHANGED
@@ -1,5 +1,9 @@
1
  .post-content-block.alignfull {
2
  padding: 0 12px;
 
 
 
 
3
  }
4
 
5
  .post-content-block__selector {
@@ -37,9 +41,20 @@
37
  // Fix the size and positioning full-width blocks inside the Post Content block
38
  // TODO: Replace the magic numbers!
39
  .post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full] {
40
- max-width: calc( 100vw - 81px );
41
- margin-left: 3px;
42
- margin-right: 3px;
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
 
45
  /* Hide the content slot block UI */
1
  .post-content-block.alignfull {
2
  padding: 0 12px;
3
+
4
+ @media ( max-width: 768px ) {
5
+ overflow-x: hidden;
6
+ }
7
  }
8
 
9
  .post-content-block__selector {
41
  // Fix the size and positioning full-width blocks inside the Post Content block
42
  // TODO: Replace the magic numbers!
43
  .post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full] {
44
+ @media ( max-width: 768px ) {
45
+ max-width: 768px;
46
+ margin-left: 0;
47
+ margin-right: 0;
48
+
49
+ .block-editor-block-mover {
50
+ left: 60px;
51
+ }
52
+ }
53
+ @media ( min-width: 768px ) {
54
+ max-width: calc( 100vw - 81px );
55
+ margin-left: 3px;
56
+ margin-right: 3px;
57
+ }
58
  }
59
 
60
  /* Hide the content slot block UI */
full-site-editing/blocks/site-logo/edit.js DELETED
@@ -1,41 +0,0 @@
1
- /* eslint-disable wpcalypso/jsx-classname-namespace */
2
- /**
3
- * External dependencies
4
- */
5
- import { IconButton, ServerSideRender, Toolbar } from '@wordpress/components';
6
- import { Fragment } from '@wordpress/element';
7
- import { BlockControls } from '@wordpress/editor';
8
- import { __ } from '@wordpress/i18n';
9
- import { addQueryArgs } from '@wordpress/url';
10
-
11
- function SiteLogoEdit( { className } ) {
12
- const navigateToCustomerSiteIdentity = () => {
13
- const siteIdentityLink = addQueryArgs( 'customize.php', {
14
- 'autofocus[section]': 'title_tagline',
15
- return: window.location.href,
16
- } );
17
- window.location.href = siteIdentityLink;
18
- };
19
-
20
- return (
21
- <Fragment>
22
- <BlockControls>
23
- <Toolbar>
24
- <IconButton
25
- className={ 'components-toolbar__control' }
26
- icon="edit"
27
- label={ __( 'Edit Site Logo' ) }
28
- onClick={ navigateToCustomerSiteIdentity }
29
- />
30
- </Toolbar>
31
- </BlockControls>
32
- <ServerSideRender
33
- className={ className }
34
- block="a8c/site-logo"
35
- attributes={ { editorPreview: true } }
36
- />
37
- </Fragment>
38
- );
39
- }
40
-
41
- export default SiteLogoEdit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/blocks/site-logo/index.js DELETED
@@ -1,21 +0,0 @@
1
- /**
2
- * WordPress 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 './style.scss';
12
-
13
- registerBlockType( 'a8c/site-logo', {
14
- title: __( 'Site Logo' ),
15
- description: __( 'Site Logo' ),
16
- icon: 'format-image',
17
- category: 'layout',
18
- keywords: [ __( 'logo' ), __( 'icon' ), __( 'site' ) ],
19
- edit,
20
- save: () => null,
21
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/blocks/site-logo/index.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- /**
3
- * Render site-logo block file.
4
- *
5
- * @package full-site-editing
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
- }
31
-
32
- if ( ! has_custom_logo() ) {
33
- return '';
34
- }
35
-
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
- }
48
-
49
- if ( ! has_custom_logo() ) {
50
- return sprintf( '<div class="components-placeholder has-no-logo"><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' ), __( 'Click on the Edit button to select a Site Logo.', 'full-site-editing' ) );
51
- }
52
-
53
- return get_custom_logo();
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/blocks/site-logo/style.scss DELETED
@@ -1,3 +0,0 @@
1
- .wp-block-a8c-site-logo {
2
- pointer-events: none;
3
- }
 
 
 
full-site-editing/blocks/template/edit.js CHANGED
@@ -1,3 +1,4 @@
 
1
  /* eslint-disable wpcalypso/jsx-classname-namespace */
2
  /* global fullSiteEditing */
3
  /**
@@ -32,7 +33,7 @@ const TemplateEdit = compose(
32
  const { isEditorSidebarOpened } = select( 'core/edit-post' );
33
  const { templateId } = attributes;
34
  const currentPostId = getCurrentPostId();
35
- const template = templateId && getEntityRecord( 'postType', 'wp_template', templateId );
36
  const editTemplateUrl = addQueryArgs( fullSiteEditing.editTemplateBaseUrl, {
37
  post: templateId,
38
  fse_parent_post: currentPostId,
@@ -62,7 +63,7 @@ const TemplateEdit = compose(
62
  }
63
 
64
  const templateBlocks = parse( get( template, [ 'content', 'raw' ], '' ) );
65
- const templateBlock = createBlock( 'core/template', {}, templateBlocks );
66
 
67
  receiveBlocks( [ templateBlock ] );
68
  setState( { templateClientId: templateBlock.clientId } );
@@ -131,6 +132,22 @@ const TemplateEdit = compose(
131
  savePost();
132
  };
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  return (
135
  <div
136
  className={ classNames( 'template-block', {
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
  /* eslint-disable wpcalypso/jsx-classname-namespace */
3
  /* global fullSiteEditing */
4
  /**
33
  const { isEditorSidebarOpened } = select( 'core/edit-post' );
34
  const { templateId } = attributes;
35
  const currentPostId = getCurrentPostId();
36
+ const template = templateId && getEntityRecord( 'postType', 'wp_template_part', templateId );
37
  const editTemplateUrl = addQueryArgs( fullSiteEditing.editTemplateBaseUrl, {
38
  post: templateId,
39
  fse_parent_post: currentPostId,
63
  }
64
 
65
  const templateBlocks = parse( get( template, [ 'content', 'raw' ], '' ) );
66
+ const templateBlock = createBlock( 'core/group', {}, templateBlocks );
67
 
68
  receiveBlocks( [ templateBlock ] );
69
  setState( { templateClientId: templateBlock.clientId } );
132
  savePost();
133
  };
134
 
135
+ /**
136
+ * IMPORTANT: Be careful about changes to the overlay button. There is code in
137
+ * iframe-bridge-server.js (setupEditTemplateLinks) which looks for two
138
+ * elements matching '.template__block-container .template-block__overlay a'.
139
+ * This code updates the href of the button to match the calypso URL (which is
140
+ * sent through the iFrame port) since editTemplateUrl here will be the wpadmin URL.
141
+ *
142
+ * If you make changes to the button, navigation to the template editor MAY BREAK.
143
+ *
144
+ * For example, if the button does not exist in the DOM as the editor is loaded,
145
+ * the links may not be updated in time, or an interval will continuously try to
146
+ * find them (which is bad for performance).
147
+ *
148
+ * This has already broken several times, so be careful!
149
+ */
150
+
151
  return (
152
  <div
153
  className={ classNames( 'template-block', {
full-site-editing/blocks/template/index.js CHANGED
@@ -14,10 +14,10 @@ import edit from './edit';
14
  import './style.scss';
15
  import './site-logo';
16
 
17
- if ( 'wp_template' !== fullSiteEditing.editorPostType ) {
18
  registerBlockType( 'a8c/template', {
19
- title: __( 'Template' ),
20
- description: __( 'Display a template.' ),
21
  icon: 'layout',
22
  category: 'layout',
23
  attributes: {
14
  import './style.scss';
15
  import './site-logo';
16
 
17
+ if ( 'wp_template_part' !== fullSiteEditing.editorPostType ) {
18
  registerBlockType( 'a8c/template', {
19
+ title: __( 'Template Part' ),
20
+ description: __( 'Display a Template Part.' ),
21
  icon: 'layout',
22
  category: 'layout',
23
  attributes: {
full-site-editing/blocks/template/style.scss CHANGED
@@ -85,7 +85,7 @@
85
  }
86
 
87
  // Hide the site logo description and buttons when not editing the Template
88
- .block-editor-page:not( .post-type-wp_template ) {
89
  .fse-site-logo {
90
  .components-placeholder__fieldset, .components-placeholder__instructions {
91
  display: none;
85
  }
86
 
87
  // Hide the site logo description and buttons when not editing the Template
88
+ .block-editor-page:not( .post-type-wp_template_part ) {
89
  .fse-site-logo {
90
  .components-placeholder__fieldset, .components-placeholder__instructions {
91
  display: none;
full-site-editing/class-a8c-rest-templates-controller.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- /**
3
- * A8C REST Templates Controller file.
4
- *
5
- * @package full-site-editing
6
- */
7
-
8
- /**
9
- * Based on `WP_REST_Blocks_Controller` from core
10
- */
11
- class A8C_REST_Templates_Controller extends WP_REST_Posts_Controller {
12
-
13
- /**
14
- * Checks if a template can be read.
15
- *
16
- * @param object $post Post object that backs the template.
17
- * @return bool Whether the template can be read.
18
- */
19
- public function check_read_permission( $post ) {
20
- // Ensure that the user is logged in and has the edit_posts capability.
21
- $post_type = get_post_type_object( $post->post_type );
22
- if ( ! current_user_can( $post_type->cap->read_post, $post->ID ) ) {
23
- return false;
24
- }
25
-
26
- return parent::check_read_permission( $post );
27
- }
28
-
29
- /**
30
- * Retrieves the template's schema, conforming to JSON Schema.
31
- *
32
- * @return array Item schema data.
33
- */
34
- public function get_item_schema() {
35
- $schema = parent::get_item_schema();
36
-
37
- /*
38
- * Allow all contexts to access `title.raw` and `content.raw`. Clients always
39
- * need the raw markup of a reusable template to do anything useful, e.g. parse
40
- * it or display it in an editor.
41
- */
42
- $schema['properties']['title']['properties']['raw']['context'] = array( 'view', 'edit' );
43
- $schema['properties']['content']['properties']['raw']['context'] = array( 'view', 'edit' );
44
-
45
- return $schema;
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/class-full-site-editing.php CHANGED
@@ -23,7 +23,7 @@ class Full_Site_Editing {
23
  *
24
  * @var array
25
  */
26
- private $template_post_types = [ 'wp_template' ];
27
 
28
  /**
29
  * Current theme slug.
@@ -106,13 +106,8 @@ class Full_Site_Editing {
106
  return;
107
  }
108
 
109
- if ( ! $this->wp_template_inserter->is_template_data_inserted() ) {
110
- $this->wp_template_inserter->insert_default_template_data();
111
- }
112
-
113
- if ( ! $this->wp_template_inserter->is_pages_data_inserted() ) {
114
- $this->wp_template_inserter->insert_default_pages();
115
- }
116
  }
117
 
118
  /**
@@ -561,7 +556,7 @@ class Full_Site_Editing {
561
  * @return array
562
  */
563
  public function remove_delete_row_action_for_template_taxonomy( $actions, $term ) {
564
- if ( 'wp_template_type' === $term->taxonomy ) {
565
  unset( $actions['delete'] );
566
  }
567
  return $actions;
@@ -585,7 +580,7 @@ class Full_Site_Editing {
585
  * @param string $taxonomy Taxonomy name.
586
  */
587
  public function restrict_template_taxonomy_deletion( $term, $taxonomy ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
588
- if ( 'wp_template_type' === $taxonomy ) {
589
  wp_die( esc_html__( 'Template Types cannon be deleted.' ) );
590
  }
591
  }
23
  *
24
  * @var array
25
  */
26
+ private $template_post_types = [ 'wp_template_part' ];
27
 
28
  /**
29
  * Current theme slug.
106
  return;
107
  }
108
 
109
+ $this->wp_template_inserter->insert_default_template_data();
110
+ $this->wp_template_inserter->insert_default_pages();
 
 
 
 
 
111
  }
112
 
113
  /**
556
  * @return array
557
  */
558
  public function remove_delete_row_action_for_template_taxonomy( $actions, $term ) {
559
+ if ( 'wp_template_part_type' === $term->taxonomy ) {
560
  unset( $actions['delete'] );
561
  }
562
  return $actions;
580
  * @param string $taxonomy Taxonomy name.
581
  */
582
  public function restrict_template_taxonomy_deletion( $term, $taxonomy ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
583
+ if ( 'wp_template_part_type' === $taxonomy ) {
584
  wp_die( esc_html__( 'Template Types cannon be deleted.' ) );
585
  }
586
  }
full-site-editing/components/post-autocomplete/index.js DELETED
@@ -1,113 +0,0 @@
1
- /* eslint-disable wpcalypso/jsx-classname-namespace */
2
- /**
3
- * External dependencies
4
- */
5
- import { debounce, map } from 'lodash';
6
-
7
- /**
8
- * WordPress dependencies
9
- */
10
- import apiFetch from '@wordpress/api-fetch';
11
- import { Button, Popover, Spinner, TextControl } from '@wordpress/components';
12
- import { withState } from '@wordpress/compose';
13
- import { useState } from '@wordpress/element';
14
- import { __ } from '@wordpress/i18n';
15
- import { addQueryArgs } from '@wordpress/url';
16
-
17
- /**
18
- * Internal dependencies
19
- */
20
- import './style.scss';
21
-
22
- const updateSuggestions = debounce( async ( search, postType, setState ) => {
23
- setState( {
24
- loading: true,
25
- showSuggestions: true,
26
- suggestions: [],
27
- } );
28
-
29
- const suggestions = await apiFetch( {
30
- path: addQueryArgs( '/wp/v2/search', {
31
- context: 'embed',
32
- per_page: 20,
33
- search,
34
- ...( !! postType && { subtype: postType } ),
35
- } ),
36
- } );
37
-
38
- setState( {
39
- loading: false,
40
- showSuggestions: true,
41
- suggestions,
42
- } );
43
- }, 200 );
44
-
45
- const selectSuggestion = ( { id, title, subtype: type }, setState, setSearch ) => {
46
- setState( {
47
- loading: false,
48
- showSuggestions: false,
49
- suggestions: [],
50
- } );
51
- setSearch( title );
52
-
53
- return { id, type };
54
- };
55
-
56
- /**
57
- * External props:
58
- * @param {Function} onSelectPost Callback invoked when a post is selected, returning its object.
59
- * @param {?string|Array} postType If set, limits the search to the given post type, or array of post types.
60
- * @param {?string} initialValue If set, is the initial value of the input field.
61
- */
62
- const PostAutocomplete = withState( {
63
- loading: false,
64
- showSuggestions: false,
65
- suggestions: [],
66
- } )(
67
- ( { initialValue, loading, onSelectPost, postType, setState, showSuggestions, suggestions } ) => {
68
- const [ search, setSearch ] = useState( initialValue );
69
-
70
- const onChange = inputValue => {
71
- setSearch( inputValue );
72
- if ( inputValue.length < 2 ) {
73
- setState( {
74
- loading: false,
75
- showSuggestions: false,
76
- } );
77
- return;
78
- }
79
- updateSuggestions( inputValue, postType, setState );
80
- };
81
-
82
- const onClick = suggestion => () => {
83
- const selectedPost = selectSuggestion( suggestion, setState, setSearch );
84
- onSelectPost( selectedPost );
85
- };
86
-
87
- return (
88
- <div className="a8c-post-autocomplete">
89
- <TextControl
90
- autoComplete="off"
91
- onChange={ onChange }
92
- placeholder={ __( 'Type to search' ) }
93
- type="search"
94
- value={ search }
95
- />
96
- { loading && <Spinner /> }
97
- { showSuggestions && !! suggestions.length && (
98
- <Popover focusOnMount={ false } noArrow position="bottom">
99
- <div className="a8c-post-autocomplete__suggestions">
100
- { map( suggestions, suggestion => (
101
- <Button isLarge isLink key={ suggestion.id } onClick={ onClick( suggestion ) }>
102
- { suggestion.title }
103
- </Button>
104
- ) ) }
105
- </div>
106
- </Popover>
107
- ) }
108
- </div>
109
- );
110
- }
111
- );
112
-
113
- export default PostAutocomplete;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/components/post-autocomplete/style.scss DELETED
@@ -1,24 +0,0 @@
1
- .a8c-post-autocomplete {
2
- position: relative;
3
-
4
- .components-spinner {
5
- bottom: 7px;
6
- position: absolute;
7
- right: -5px;
8
- }
9
- }
10
-
11
- .a8c-post-autocomplete__suggestions {
12
- max-height: 200px;
13
- overflow-y: auto;
14
- width: 302px;
15
-
16
- .components-button {
17
- display: block;
18
- height: auto;
19
- min-height: 30px;
20
- white-space: normal;
21
- width: 100%;
22
- word-wrap: break-word;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/dist/full-site-editing.css CHANGED
@@ -1 +1 @@
1
- .wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.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}.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{max-width:calc(100vw - 81px);margin-left:3px;margin-right:3px}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear .7s}.template__block-container.is-hovered .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container.is-selected .template-block__overlay{opacity:1;transition:opacity .2s linear}.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear .7s}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template) .fse-site-logo .components-placeholder__instructions{display:none}.edit-post-fullscreen-mode-close__toolbar a.is-button.is-default{height:auto}.edit-post-fullscreen-mode-close__toolbar a.is-button.is-default span{display:none}.edit-post-fullscreen-mode-close__toolbar a.a8c-close-button{padding:4px}.post-type-wp_template .edit-post-post-status,.post-type-wp_template .editor-post-title,.post-type-wp_template .editor-post-trash{display:none}.post-type-wp_template .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template .editor-post-switch-to-draft{display:none}.post-type-page .edit-post-layout__content,.post-type-wp_template .edit-post-layout__content{background:#eee}.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template .edit-post-layout__content .edit-post-visual-editor{flex:none;margin:36px 32px;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2)}@media (max-width:768px){.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template .edit-post-layout__content .edit-post-visual-editor{margin:0}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
1
+ .wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block.alignfull{padding:0 12px}@media (max-width:768px){.post-content-block.alignfull{overflow-x:hidden}}.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}@media (max-width:768px){.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{max-width:768px;margin-left:0;margin-right:0}.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full] .block-editor-block-mover{left:60px}}@media (min-width:768px){.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{max-width:calc(100vw - 81px);margin-left:3px;margin-right:3px}}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear .7s}.template__block-container.is-hovered .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container.is-selected .template-block__overlay{opacity:1;transition:opacity .2s linear}.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear .7s}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions,.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .edit-post-layout__content,.post-type-wp_template_part .edit-post-layout__content{background:#eee}.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-layout__content .edit-post-visual-editor{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template_part .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
full-site-editing/dist/full-site-editing.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(t,e){for(var n in e)t[n]=e[n]}(window,function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=43)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e){!function(){t.exports=this.wp.data}()},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e){!function(){t.exports=this.wp.blocks}()},function(t,e){!function(){t.exports=this.wp.editor}()},function(t,e,n){var r=n(10);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}t.exports=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(n,!0).forEach(function(e){r(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}},function(t,e){!function(){t.exports=this.lodash}()},function(t,e,n){var r;
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 t=[],e=0;e<arguments.length;e++){var r=arguments[e];if(r){var i=typeof r;if("string"===i||"number"===i)t.push(r);else if(Array.isArray(r)&&r.length){var c=o.apply(null,r);c&&t.push(c)}else if("object"===i)for(var l in r)n.call(r,l)&&r[l]&&t.push(l)}}return t.join(" ")}t.exports?(o.default=o,t.exports=o):void 0===(r=function(){return o}.apply(e,[]))||(t.exports=r)}()},function(t,e){!function(){t.exports=this.wp.hooks}()},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n.apply(this,arguments)}t.exports=n},function(t,e){!function(){t.exports=this.wp.domReady}()},function(t,e){!function(){t.exports=this.wp.keycodes}()},function(t,e,n){var r=n(33),o=n(34),i=n(35);t.exports=function(t,e){return r(t)||o(t,e)||i()}},function(t,e){!function(){t.exports=this.wp.apiFetch}()},function(t,e){!function(){t.exports=this.wp.htmlEntities}()},function(t,e,n){},function(t,e){!function(){t.exports=this.wp.serverSideRender}()},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e,n){var r=n(29),o=n(30);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?o(t):e}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var r=n(31);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}},function(t,e){!function(){t.exports=this.wp.url}()},function(t,e,n){var r=n(39),o=n(40),i=n(41);t.exports=function(t){return r(t)||o(t)||i()}},function(t,e){!function(){t.exports=this.wp.plugins}()},function(t,e,n){},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=r=function(t){return n(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(e)}t.exports=r},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},function(t,e,n){},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var c,l=t[Symbol.iterator]();!(r=(c=l.next()).done)&&(n.push(c.value),!e||n.length!==e);r=!0);}catch(a){o=!0,i=a}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}return n}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e,n){},function(t,e,n){"use strict";n.r(e);var r=n(0),o=n(4),i=n(1),c=n(19),l=n.n(c),a=function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(l.a,{block:"a8c/navigation-menu"}))},s=(n(28),Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.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(i.__)("Navigation Menu"),description:Object(i.__)("Visual placeholder for site-wide navigation and menus."),icon:s,category:"layout",supports:{align:["wide","full"],html:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"}},edit:a,save:function(){return null}});var u=n(12),p=n.n(u),d=n(3),f=n(9),b=n(10),m=n.n(b),O=n(20),g=n.n(O),v=n(21),h=n.n(v),y=n(22),j=n.n(y),w=n(23),E=n.n(w),S=n(24),k=n.n(S),_=n(8),P=n.n(_),x=n(2),T=n(5),I=function(t){function e(){return g()(this,e),j()(this,E()(e).apply(this,arguments))}return k()(e,t),h()(e,[{key:"toggleEditing",value:function(){var t=this.props,e=t.isEditing;(0,t.setState)({isEditing:!e})}},{key:"onSelectPost",value:function(t){var e=t.id,n=t.type;this.props.setState({isEditing:!1,selectedPostId:e,selectedPostType:n})}},{key:"render",value:function(){var t=this.props.attributes.align;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:P()("post-content-block",m()({},"align".concat(t),t))},Object(r.createElement)(T.PostTitle,null),Object(r.createElement)(T.InnerBlocks,{templateLock:!1})))}}]),e}(r.Component),B=Object(d.compose)([Object(d.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(x.withSelect)(function(t,e){var n=e.selectedPostId,r=e.selectedPostType;return{selectedPost:(0,t("core").getEntityRecord)("postType",r,n)}})])(I);n(32);Object(o.registerBlockType)("a8c/post-content",{title:Object(i.__)("Content"),description:Object(i.__)("The page content."),icon:"layout",category:"layout",supports:{align:["full"],anchor:!1,customClassName:!1,html:!1,inserter:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"full"}},edit:B,save:function(){return Object(r.createElement)(T.InnerBlocks.Content,null)}});var C=Object(d.createHigherOrderComponent)(function(t){return function(e){return"a8c/post-content"!==e.name?Object(r.createElement)(t,e):Object(r.createElement)(t,p()({},e,{className:"post-content__block"}))}},"addContentSlotClassname");Object(f.addFilter)("editor.BlockListBlock","full-site-editing/blocks/post-content",C,9);var D=n(14),N=n(6),L=n.n(N),A=n(15),M=n.n(A),F=n(16),R=n.n(F),U=n(17);function H(t){var e=Object(r.useRef)();return Object(r.useEffect)(function(){e.current=t},[t]),e.current}function z(t,e,n,o,c,l){var a=Object(r.useState)({option:e,previousOption:"",loaded:!1,error:!1}),s=M()(a,2),u=s[0],p=s[1],d=H(o),f=H(c);function b(){p(L()({},u,{option:u.previousOption,isSaving:!1}))}return Object(r.useEffect)(function(){u.loaded||u.error?function(){var e=u.option,r=u.previousOption,l=e&&e.trim()===r.trim(),a=!e||0===e.trim().length;!o&&d&&a&&b();if(!c||l)return;!f&&c&&function(e){p(L()({},u,{isSaving:!0})),R()({path:"/wp/v2/settings",method:"POST",data:m()({},t,e)}).then(function(){return function(t){p(L()({},u,{previousOption:t,isDirty:!1,isSaving:!1}))}(e)}).catch(function(){n(Object(i.sprintf)(Object(i.__)("Unable to save site %s"),t)),b()})}(e)}():R()({path:"/wp/v2/settings"}).then(function(e){return p(L()({},u,{option:Object(U.decodeEntities)(e[t]),previousOption:Object(U.decodeEntities)(e[t]),loaded:!0,error:!1}))}).catch(function(){n(Object(i.sprintf)(Object(i.__)("Unable to load site %s"),t)),p(L()({},u,{option:Object(i.sprintf)(Object(i.__)("Error loading site %s"),t),error:!0}))})}),{siteOptions:u,handleChange:function(t){l({updated:Date.now()}),p(L()({},u,{option:t}))}}}var q=Object(d.compose)([Object(x.withSelect)(function(t,e){var n=e.clientId,r=t("core/editor"),o=r.isSavingPost,i=r.isPublishingPost,c=r.isAutosavingPost,l=r.isCurrentPostPublished,a=t("core/block-editor"),s=a.getBlockIndex,u=a.getBlockRootClientId,p=a.getTemplateLock,d=u(n);return{blockIndex:s(n,d),isLocked:!!p(d),rootClientId:d,shouldUpdateSiteOption:(o()&&l()||i())&&!c()}}),Object(x.withDispatch)(function(t,e){var n=e.blockIndex,r=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},r,n+1)}}})])(function(t){var e=t.className,n=t.createErrorNotice,o=t.shouldUpdateSiteOption,c=t.isSelected,l=t.setAttributes,a=t.isLocked,s=t.insertDefaultBlock,u=z("description",Object(i.__)("Site description loading…"),n,c,o,l),p=u.siteOptions,d=u.handleChange,f=p.option;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(T.PlainText,{className:P()("site-description",e),value:f,onChange:function(t){return d(t)},onKeyDown:function(t){t.keyCode===D.ENTER&&(t.preventDefault(),a||s())},placeholder:Object(i.__)("Add a Site Description"),"aria-label":Object(i.__)("Site Description")}))});n(36);Object(o.registerBlockType)("a8c/site-description",{title:Object(i.__)("Site Description"),description:Object(i.__)("Site description, also known as the tagline."),icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(r.createElement)("path",{d:"M4 9h16v2H4V9zm0 4h10v2H4v-2z"})),category:"layout",supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"}},edit:q,save:function(){return null}});var V=Object(d.compose)([Object(x.withSelect)(function(t,e){var n=e.clientId,r=t("core/editor"),o=r.isSavingPost,i=r.isPublishingPost,c=r.isAutosavingPost,l=r.isCurrentPostPublished,a=t("core/block-editor"),s=a.getBlockIndex,u=a.getBlockRootClientId,p=a.getTemplateLock,d=u(n);return{blockIndex:s(n,d),isLocked:!!p(d),rootClientId:d,shouldUpdateSiteOption:(o()&&l()||i())&&!c()}}),Object(x.withDispatch)(function(t,e){var n=e.blockIndex,r=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},r,n+1)}}})])(function(t){var e=t.className,n=t.createErrorNotice,o=t.shouldUpdateSiteOption,c=t.isSelected,l=t.setAttributes,a=t.isLocked,s=t.insertDefaultBlock,u=z("title",Object(i.__)("Site title loading…"),n,c,o,l),p=u.siteOptions,d=u.handleChange,f=p.option;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(T.PlainText,{className:P()("site-title",e),value:f,onChange:function(t){return d(t)},onKeyDown:function(t){t.keyCode===D.ENTER&&(t.preventDefault(),a||s())},placeholder:Object(i.__)("Add a Site Title"),"aria-label":Object(i.__)("Site Title")}))});n(37);Object(o.registerBlockType)("a8c/site-title",{title:Object(i.__)("Site Title"),description:Object(i.__)("Your site title."),icon:"layout",category:"layout",supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"}},edit:V,save:function(){return null}});var G=n(7),W=n(11),K=n(25),Q=(n(18),Object(d.compose)(Object(d.withState)({templateClientId:null}),Object(x.withSelect)(function(t,e){var n=e.attributes,r=e.templateClientId,o=t("core").getEntityRecord,i=t("core/editor"),c=i.getCurrentPostId,l=i.isEditedPostDirty,a=t("core/block-editor"),s=a.getBlock,u=a.getSelectedBlock,p=t("core/edit-post").isEditorSidebarOpened,d=n.templateId,f=c(),b=d&&o("postType","wp_template",d),m=Object(K.addQueryArgs)(fullSiteEditing.editTemplateBaseUrl,{post:d,fse_parent_post:f}),O=u();return{currentPostId:f,editTemplateUrl:m,template:b,templateBlock:s(r),templateTitle:Object(G.get)(b,["title","rendered"],""),isDirty:l(),isEditorSidebarOpened:!!p(),isAnyTemplateBlockSelected:O&&"a8c/template"===O.name}}),Object(x.withDispatch)(function(t,e){var n=t("core/block-editor").receiveBlocks,r=t("core/edit-post").openGeneralSidebar,i=e.template,c=e.templateClientId,l=e.setState;return{savePost:t("core/editor").savePost,receiveTemplateBlocks:function(){if(i&&!c){var t=Object(o.parse)(Object(G.get)(i,["content","raw"],"")),e=Object(o.createBlock)("core/template",{},t);n([e]),l({templateClientId:e.clientId})}},openGeneralSidebar:r}}))(function(t){var e,n=t.attributes,o=t.editTemplateUrl,c=t.receiveTemplateBlocks,l=t.template,a=t.templateBlock,s=t.templateTitle,u=t.isDirty,p=t.savePost,d=t.isEditorSidebarOpened,f=t.openGeneralSidebar,b=t.isAnyTemplateBlockSelected;if(!l)return Object(r.createElement)(W.Placeholder,null,Object(r.createElement)(W.Spinner,null));var O=Object(r.createRef)(),g=Object(r.useState)(!1),v=M()(g,2),h=v[0],y=v[1];Object(r.useEffect)(function(){h&&!u&&O.current.click(),c()}),Object(r.useEffect)(function(){var t=document.querySelector(".edit-post-sidebar__panel-tabs ul li:last-child");if(d&&t){if(b)return f("edit-post/document"),void t.classList.add("hidden");t.classList.remove("hidden")}},[b,d,f]);var j=n.align,w=n.className;return Object(r.createElement)("div",{className:P()("template-block",(e={},m()(e,"align".concat(j),j),m()(e,"is-navigating-to-template",h),e))},a&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(W.Disabled,null,Object(r.createElement)("div",{className:w},Object(r.createElement)(T.BlockEdit,{attributes:a.attributes,block:a,clientId:a.clientId,isSelected:!1,name:a.name,setAttributes:G.noop}))),Object(r.createElement)(W.Placeholder,{className:"template-block__overlay"},h&&Object(r.createElement)("div",{className:"template-block__loading"},Object(r.createElement)(W.Spinner,null)," ",Object(i.sprintf)(Object(i.__)("Loading %s Editor"),s)),Object(r.createElement)(W.Button,{className:h?"hidden":null,href:o,onClick:function(t){y(!0),u&&(t.preventDefault(),p())},isDefault:!0,isLarge:!0,ref:O},Object(i.sprintf)(Object(i.__)("Edit %s"),s)))))})),Y=Object(d.createHigherOrderComponent)(function(t){return function(e){return"fse-site-logo"!==e.attributes.className?Object(r.createElement)(t,e):Object(r.createElement)(t,p()({},e,{className:"template__site-logo"}))}},"addFSESiteLogoClassname");Object(f.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",Y),"wp_template"!==fullSiteEditing.editorPostType&&Object(o.registerBlockType)("a8c/template",{title:Object(i.__)("Template"),description:Object(i.__)("Display a template."),icon:"layout",category:"layout",attributes:{templateId:{type:"number"},className:{type:"string"}},supports:{anchor:!1,customClassName:!1,html:!1,inserter:!1,reusable:!1},edit:Q,save:function(){return null},getEditWrapperProps:function(){return{"data-align":"full"}}});var J=Object(d.createHigherOrderComponent)(function(t){return function(e){return"a8c/template"!==e.name?Object(r.createElement)(t,e):Object(r.createElement)(t,p()({},e,{className:"template__block-container"}))}},"addFSETemplateClassname");Object(f.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",J,9);var X=n(13),Z=n.n(X);n(38);Z()(function(){var t=fullSiteEditing,e=t.closeButtonLabel,n=t.closeButtonUrl,r=t.editorPostType,o=setInterval(function(){var t=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");if(t)if(clearInterval(o),"wp_template"===r&&n){var i=document.createElement("a");i.href=n,i.innerHTML=e,i.className="components-button components-icon-button is-button is-default",i.setAttribute("aria-label",e),document.querySelector(".edit-post-fullscreen-mode-close__toolbar").replaceChild(i,t)}else t.innerHTML='<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28" height="28" viewBox="0 0 20 20"><path d="M14.95 6.46l-3.54 3.54 3.54 3.54-1.41 1.41-3.54-3.53-3.53 3.53-1.42-1.42 3.53-3.53-3.53-3.53 1.42-1.42 3.53 3.53 3.54-3.53z"></path></svg>',t.classList.add("a8c-close-button")})});var $=n(26),tt=n.n($),et=n(27),nt=Object(x.withSelect)(function(t){var e=t("core").getEntityRecord,n=t("core/editor").getEditedPostAttribute;return{templateClasses:Object(G.map)(n("template_types"),function(t){var n=Object(G.get)(e("taxonomy","wp_template_type",t),"name","");return Object(G.endsWith)(n,"-header")?"site-header site-branding":Object(G.endsWith)(n,"-footer")?"site-footer":void 0})}})(function(t){var e=t.templateClasses,n=setInterval(function(){var t=document.querySelector(".block-editor-writing-flow.editor-writing-flow > div");t&&(clearInterval(n),t.className=P.a.apply(void 0,["a8c-template-editor"].concat(tt()(e))))});return null});"wp_template"===fullSiteEditing.editorPostType&&Object(et.registerPlugin)("fse-editor-template-classes",{render:nt}),Z()(function(){"wp_template"===fullSiteEditing.editorPostType&&Object(x.dispatch)("core/notices").createNotice("info",Object(i.__)("Updates to this template will affect all pages on your site."),{isDismissible:!1})});var rt=Object(d.compose)(Object(x.withSelect)(function(t){var e=t("core/editor"),n=e.getBlocks,r=e.getEditorSettings,o=t("core/edit-post").getEditorMode,i=n().find(function(t){return"a8c/post-content"===t.name});return{rootClientId:i?i.clientId:"",showInserter:"visual"===o()&&r().richEditingEnabled}}))(function(t){var e=t.rootClientId,n=t.showInserter;return Object(r.createElement)(T.Inserter,{rootClientId:e,disabled:!n,position:"bottom right"})});Z()(function(){return function(){if("page"===fullSiteEditing.editorPostType)var t=setInterval(function(){var e=document.querySelector(".edit-post-header-toolbar");if(e){clearInterval(t);var n=document.createElement("div");n.classList.add("fse-post-content-block-inserter"),e.insertBefore(n,e.firstChild),Object(r.render)(Object(r.createElement)(rt,null),n)}})}()});var ot=Object(x.subscribe)(function(){if("page"!==fullSiteEditing.editorPostType)return ot();!1===Object(x.select)("core/editor").isValidTemplate()&&Object(x.dispatch)("core/editor").setTemplateValidity(!0)}),it=["logo","brand","emblem","hallmark"];Object(f.addFilter)("blocks.registerBlockType","full-site-editing/editor/image-block-keywords",function(t,e){return"core/image"!==e?t:t=Object(G.assign)({},t,{keywords:t.keywords.concat(it)})});n(42);Object(x.use)(function(t){return{dispatch:function(e){var n=L()({},t.dispatch(e)),r=fullSiteEditing.editorPostType;return"core/editor"===e&&n.trashPost&&"wp_template"===r&&(n.trashPost=function(){}),n}}}),Object(x.use)(function(t){return{dispatch:function(e){var n=L()({},t.dispatch(e)),r=fullSiteEditing.editorPostType;if("core/editor"===e&&n.editPost&&"wp_template"===r){var o=n.editPost;n.editPost=function(t){"draft"!==t.status&&o(t)}}return n}}});var ct=Object(x.subscribe)(function(){var t=Object(x.dispatch)("core/edit-post").removeEditorPanel;return"page"===fullSiteEditing.editorPostType&&t("featured-image"),"wp_template"===fullSiteEditing.editorPostType&&t("post-status"),ct()})}]));
1
+ !function(t,e){for(var n in e)t[n]=e[n]}(window,function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=42)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e){!function(){t.exports=this.wp.data}()},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e){!function(){t.exports=this.wp.blocks}()},function(t,e){!function(){t.exports=this.wp.editor}()},function(t,e,n){var r=n(10);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}t.exports=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(n,!0).forEach(function(e){r(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}},function(t,e){!function(){t.exports=this.lodash}()},function(t,e,n){var r;
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 o(){for(var t=[],e=0;e<arguments.length;e++){var r=arguments[e];if(r){var i=typeof r;if("string"===i||"number"===i)t.push(r);else if(Array.isArray(r)&&r.length){var c=o.apply(null,r);c&&t.push(c)}else if("object"===i)for(var a in r)n.call(r,a)&&r[a]&&t.push(a)}}return t.join(" ")}t.exports?(o.default=o,t.exports=o):void 0===(r=function(){return o}.apply(e,[]))||(t.exports=r)}()},function(t,e){!function(){t.exports=this.wp.hooks}()},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n.apply(this,arguments)}t.exports=n},function(t,e){!function(){t.exports=this.wp.domReady}()},function(t,e){!function(){t.exports=this.wp.keycodes}()},function(t,e,n){var r=n(33),o=n(34),i=n(35);t.exports=function(t,e){return r(t)||o(t,e)||i()}},function(t,e){!function(){t.exports=this.wp.apiFetch}()},function(t,e){!function(){t.exports=this.wp.htmlEntities}()},function(t,e,n){},function(t,e){!function(){t.exports=this.wp.serverSideRender}()},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e,n){var r=n(29),o=n(30);t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?o(t):e}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var r=n(31);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}},function(t,e){!function(){t.exports=this.wp.url}()},function(t,e,n){var r=n(38),o=n(39),i=n(40);t.exports=function(t){return r(t)||o(t)||i()}},function(t,e){!function(){t.exports=this.wp.plugins}()},function(t,e,n){},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=r=function(t){return n(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(e)}t.exports=r},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},function(t,e,n){},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(r=(c=a.next()).done)&&(n.push(c.value),!e||n.length!==e);r=!0);}catch(l){o=!0,i=l}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,n){},function(t,e,n){},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e,n){},function(t,e,n){"use strict";n.r(e);var r=n(0),o=n(4),i=n(1),c=n(19),a=n.n(c),l=function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.a,{block:"a8c/navigation-menu"}))},s=(n(28),Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.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(i.__)("Navigation Menu"),description:Object(i.__)("Visual placeholder for site-wide navigation and menus."),icon:s,category:"layout",supports:{align:["wide","full"],html:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"}},edit:l,save:function(){return null}});var u=n(12),p=n.n(u),d=n(3),f=n(9),b=n(10),m=n.n(b),O=n(20),g=n.n(O),v=n(21),y=n.n(v),h=n(22),j=n.n(h),E=n(23),_=n.n(E),w=n(24),S=n.n(w),k=n(8),P=n.n(k),x=n(2),T=n(5),I=function(t){function e(){return g()(this,e),j()(this,_()(e).apply(this,arguments))}return S()(e,t),y()(e,[{key:"toggleEditing",value:function(){var t=this.props,e=t.isEditing;(0,t.setState)({isEditing:!e})}},{key:"onSelectPost",value:function(t){var e=t.id,n=t.type;this.props.setState({isEditing:!1,selectedPostId:e,selectedPostType:n})}},{key:"render",value:function(){var t=this.props.attributes.align;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:P()("post-content-block",m()({},"align".concat(t),t))},Object(r.createElement)(T.PostTitle,null),Object(r.createElement)(T.InnerBlocks,{templateLock:!1})))}}]),e}(r.Component),B=Object(d.compose)([Object(d.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(x.withSelect)(function(t,e){var n=e.selectedPostId,r=e.selectedPostType;return{selectedPost:(0,t("core").getEntityRecord)("postType",r,n)}})])(I);n(32);Object(o.registerBlockType)("a8c/post-content",{title:Object(i.__)("Content"),description:Object(i.__)("The page content."),icon:"layout",category:"layout",supports:{align:["full"],anchor:!1,customClassName:!1,html:!1,inserter:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"full"}},edit:B,save:function(){return Object(r.createElement)(T.InnerBlocks.Content,null)}});var C=Object(d.createHigherOrderComponent)(function(t){return function(e){return"a8c/post-content"!==e.name?Object(r.createElement)(t,e):Object(r.createElement)(t,p()({},e,{className:"post-content__block"}))}},"addContentSlotClassname");Object(f.addFilter)("editor.BlockListBlock","full-site-editing/blocks/post-content",C,9);var D=n(14),N=n(6),L=n.n(N),A=n(15),F=n.n(A),M=n(16),R=n.n(M),U=n(17);function H(t){var e=Object(r.useRef)();return Object(r.useEffect)(function(){e.current=t},[t]),e.current}function q(t,e,n,o,c,a){var l=Object(r.useState)({option:e,previousOption:"",loaded:!1,error:!1}),s=F()(l,2),u=s[0],p=s[1],d=H(o),f=H(c);function b(){p(L()({},u,{option:u.previousOption,isSaving:!1}))}return Object(r.useEffect)(function(){u.loaded||u.error?function(){var e=u.option,r=u.previousOption,a=e&&e.trim()===r.trim(),l=!e||0===e.trim().length;!o&&d&&l&&b();if(!c||a)return;!f&&c&&function(e){p(L()({},u,{isSaving:!0})),R()({path:"/wp/v2/settings",method:"POST",data:m()({},t,e)}).then(function(){return function(t){p(L()({},u,{previousOption:t,isDirty:!1,isSaving:!1}))}(e)}).catch(function(){n(Object(i.sprintf)(Object(i.__)("Unable to save site %s"),t)),b()})}(e)}():R()({path:"/wp/v2/settings"}).then(function(e){return p(L()({},u,{option:Object(U.decodeEntities)(e[t]),previousOption:Object(U.decodeEntities)(e[t]),loaded:!0,error:!1}))}).catch(function(){n(Object(i.sprintf)(Object(i.__)("Unable to load site %s"),t)),p(L()({},u,{option:Object(i.sprintf)(Object(i.__)("Error loading site %s"),t),error:!0}))})}),{siteOptions:u,handleChange:function(t){a({updated:Date.now()}),p(L()({},u,{option:t}))}}}var z=Object(d.compose)([Object(x.withSelect)(function(t,e){var n=e.clientId,r=t("core/editor"),o=r.isSavingPost,i=r.isPublishingPost,c=r.isAutosavingPost,a=r.isCurrentPostPublished,l=t("core/block-editor"),s=l.getBlockIndex,u=l.getBlockRootClientId,p=l.getTemplateLock,d=u(n);return{blockIndex:s(n,d),isLocked:!!p(d),rootClientId:d,shouldUpdateSiteOption:(o()&&a()||i())&&!c()}}),Object(x.withDispatch)(function(t,e){var n=e.blockIndex,r=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},r,n+1)}}})])(function(t){var e=t.className,n=t.createErrorNotice,o=t.shouldUpdateSiteOption,c=t.isSelected,a=t.setAttributes,l=t.isLocked,s=t.insertDefaultBlock,u=q("description",Object(i.__)("Site description loading…"),n,c,o,a),p=u.siteOptions,d=u.handleChange,f=p.option;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(T.PlainText,{className:P()("site-description",e),value:f,onChange:function(t){return d(t)},onKeyDown:function(t){t.keyCode===D.ENTER&&(t.preventDefault(),l||s())},placeholder:Object(i.__)("Add a Site Description"),"aria-label":Object(i.__)("Site Description")}))});n(36);Object(o.registerBlockType)("a8c/site-description",{title:Object(i.__)("Site Description"),description:Object(i.__)("Site description, also known as the tagline."),icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(r.createElement)("path",{d:"M4 9h16v2H4V9zm0 4h10v2H4v-2z"})),category:"layout",supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"}},edit:z,save:function(){return null}});var V=Object(d.compose)([Object(x.withSelect)(function(t,e){var n=e.clientId,r=t("core/editor"),o=r.isSavingPost,i=r.isPublishingPost,c=r.isAutosavingPost,a=r.isCurrentPostPublished,l=t("core/block-editor"),s=l.getBlockIndex,u=l.getBlockRootClientId,p=l.getTemplateLock,d=u(n);return{blockIndex:s(n,d),isLocked:!!p(d),rootClientId:d,shouldUpdateSiteOption:(o()&&a()||i())&&!c()}}),Object(x.withDispatch)(function(t,e){var n=e.blockIndex,r=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},r,n+1)}}})])(function(t){var e=t.className,n=t.createErrorNotice,o=t.shouldUpdateSiteOption,c=t.isSelected,a=t.setAttributes,l=t.isLocked,s=t.insertDefaultBlock,u=q("title",Object(i.__)("Site title loading…"),n,c,o,a),p=u.siteOptions,d=u.handleChange,f=p.option;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(T.PlainText,{className:P()("site-title",e),value:f,onChange:function(t){return d(t)},onKeyDown:function(t){t.keyCode===D.ENTER&&(t.preventDefault(),l||s())},placeholder:Object(i.__)("Add a Site Title"),"aria-label":Object(i.__)("Site Title")}))});n(37);Object(o.registerBlockType)("a8c/site-title",{title:Object(i.__)("Site Title"),description:Object(i.__)("Your site title."),icon:"layout",category:"layout",supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"}},edit:V,save:function(){return null}});var G=n(7),W=n(11),K=n(25),Q=(n(18),Object(d.compose)(Object(d.withState)({templateClientId:null}),Object(x.withSelect)(function(t,e){var n=e.attributes,r=e.templateClientId,o=t("core").getEntityRecord,i=t("core/editor"),c=i.getCurrentPostId,a=i.isEditedPostDirty,l=t("core/block-editor"),s=l.getBlock,u=l.getSelectedBlock,p=t("core/edit-post").isEditorSidebarOpened,d=n.templateId,f=c(),b=d&&o("postType","wp_template_part",d),m=Object(K.addQueryArgs)(fullSiteEditing.editTemplateBaseUrl,{post:d,fse_parent_post:f}),O=u();return{currentPostId:f,editTemplateUrl:m,template:b,templateBlock:s(r),templateTitle:Object(G.get)(b,["title","rendered"],""),isDirty:a(),isEditorSidebarOpened:!!p(),isAnyTemplateBlockSelected:O&&"a8c/template"===O.name}}),Object(x.withDispatch)(function(t,e){var n=t("core/block-editor").receiveBlocks,r=t("core/edit-post").openGeneralSidebar,i=e.template,c=e.templateClientId,a=e.setState;return{savePost:t("core/editor").savePost,receiveTemplateBlocks:function(){if(i&&!c){var t=Object(o.parse)(Object(G.get)(i,["content","raw"],"")),e=Object(o.createBlock)("core/group",{},t);n([e]),a({templateClientId:e.clientId})}},openGeneralSidebar:r}}))(function(t){var e,n=t.attributes,o=t.editTemplateUrl,c=t.receiveTemplateBlocks,a=t.template,l=t.templateBlock,s=t.templateTitle,u=t.isDirty,p=t.savePost,d=t.isEditorSidebarOpened,f=t.openGeneralSidebar,b=t.isAnyTemplateBlockSelected;if(!a)return Object(r.createElement)(W.Placeholder,null,Object(r.createElement)(W.Spinner,null));var O=Object(r.createRef)(),g=Object(r.useState)(!1),v=F()(g,2),y=v[0],h=v[1];Object(r.useEffect)(function(){y&&!u&&O.current.click(),c()}),Object(r.useEffect)(function(){var t=document.querySelector(".edit-post-sidebar__panel-tabs ul li:last-child");if(d&&t){if(b)return f("edit-post/document"),void t.classList.add("hidden");t.classList.remove("hidden")}},[b,d,f]);var j=n.align,E=n.className;return Object(r.createElement)("div",{className:P()("template-block",(e={},m()(e,"align".concat(j),j),m()(e,"is-navigating-to-template",y),e))},l&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(W.Disabled,null,Object(r.createElement)("div",{className:E},Object(r.createElement)(T.BlockEdit,{attributes:l.attributes,block:l,clientId:l.clientId,isSelected:!1,name:l.name,setAttributes:G.noop}))),Object(r.createElement)(W.Placeholder,{className:"template-block__overlay"},y&&Object(r.createElement)("div",{className:"template-block__loading"},Object(r.createElement)(W.Spinner,null)," ",Object(i.sprintf)(Object(i.__)("Loading %s Editor"),s)),Object(r.createElement)(W.Button,{className:y?"hidden":null,href:o,onClick:function(t){h(!0),u&&(t.preventDefault(),p())},isDefault:!0,isLarge:!0,ref:O},Object(i.sprintf)(Object(i.__)("Edit %s"),s)))))})),Y=Object(d.createHigherOrderComponent)(function(t){return function(e){return"fse-site-logo"!==e.attributes.className?Object(r.createElement)(t,e):Object(r.createElement)(t,p()({},e,{className:"template__site-logo"}))}},"addFSESiteLogoClassname");Object(f.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",Y),"wp_template_part"!==fullSiteEditing.editorPostType&&Object(o.registerBlockType)("a8c/template",{title:Object(i.__)("Template Part"),description:Object(i.__)("Display a Template Part."),icon:"layout",category:"layout",attributes:{templateId:{type:"number"},className:{type:"string"}},supports:{anchor:!1,customClassName:!1,html:!1,inserter:!1,reusable:!1},edit:Q,save:function(){return null},getEditWrapperProps:function(){return{"data-align":"full"}}});var J=Object(d.createHigherOrderComponent)(function(t){return function(e){return"a8c/template"!==e.name?Object(r.createElement)(t,e):Object(r.createElement)(t,p()({},e,{className:"template__block-container"}))}},"addFSETemplateClassname");Object(f.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",J,9);var X=n(13),Z=n.n(X);Z()(function(){var t=fullSiteEditing,e=t.closeButtonLabel,n=t.closeButtonUrl,r=t.editorPostType,o=setInterval(function(){var t=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");if(t&&(clearInterval(o),"wp_template_part"===r&&n)){var i=document.createElement("a");i.href=n,i.innerHTML=e,i.className="components-button components-icon-button is-button is-default",i.setAttribute("aria-label",e),document.querySelector(".edit-post-fullscreen-mode-close__toolbar").replaceChild(i,t)}})});var $=n(26),tt=n.n($),et=n(27),nt=Object(x.withSelect)(function(t){var e=t("core").getEntityRecord,n=t("core/editor").getEditedPostAttribute;return{templateClasses:Object(G.map)(n("template_part_types"),function(t){var n=Object(G.get)(e("taxonomy","wp_template_part_type",t),"name","");return Object(G.endsWith)(n,"-header")?"site-header site-branding":Object(G.endsWith)(n,"-footer")?"site-footer":void 0})}})(function(t){var e=t.templateClasses,n=setInterval(function(){var t=document.querySelector(".block-editor-writing-flow.editor-writing-flow > div");t&&(clearInterval(n),t.className=P.a.apply(void 0,["a8c-template-editor"].concat(tt()(e))))});return null});"wp_template_part"===fullSiteEditing.editorPostType&&Object(et.registerPlugin)("fse-editor-template-classes",{render:nt}),Z()(function(){"wp_template_part"===fullSiteEditing.editorPostType&&Object(x.dispatch)("core/notices").createNotice("info",Object(i.__)("Updates to this template will affect all pages on your site."),{isDismissible:!1})});var rt=Object(d.compose)(Object(x.withSelect)(function(t){var e=t("core/editor"),n=e.getBlocks,r=e.getEditorSettings,o=t("core/edit-post").getEditorMode,i=n().find(function(t){return"a8c/post-content"===t.name});return{rootClientId:i?i.clientId:"",showInserter:"visual"===o()&&r().richEditingEnabled}}))(function(t){var e=t.rootClientId,n=t.showInserter;return Object(r.createElement)(T.Inserter,{rootClientId:e,disabled:!n,position:"bottom right"})});Z()(function(){return function(){if("page"===fullSiteEditing.editorPostType)var t=setInterval(function(){var e=document.querySelector(".edit-post-header-toolbar");if(e){clearInterval(t);var n=document.createElement("div");n.classList.add("fse-post-content-block-inserter"),e.insertBefore(n,e.firstChild),Object(r.render)(Object(r.createElement)(rt,null),n)}})}()});var ot=Object(x.subscribe)(function(){if("page"!==fullSiteEditing.editorPostType)return ot();!1===Object(x.select)("core/editor").isValidTemplate()&&Object(x.dispatch)("core/editor").setTemplateValidity(!0)}),it=["logo","brand","emblem","hallmark"];Object(f.addFilter)("blocks.registerBlockType","full-site-editing/editor/image-block-keywords",function(t,e){return"core/image"!==e?t:t=Object(G.assign)({},t,{keywords:t.keywords.concat(it)})});n(41);Object(x.use)(function(t){return{dispatch:function(e){var n=L()({},t.dispatch(e)),r=fullSiteEditing.editorPostType;return"core/editor"===e&&n.trashPost&&"wp_template_part"===r&&(n.trashPost=function(){}),n}}}),Object(x.use)(function(t){return{dispatch:function(e){var n=L()({},t.dispatch(e)),r=fullSiteEditing.editorPostType;if("core/editor"===e&&n.editPost&&"wp_template_part"===r){var o=n.editPost;n.editPost=function(t){"draft"!==t.status&&o(t)}}return n}}});var ct=Object(x.subscribe)(function(){var t=Object(x.dispatch)("core/edit-post").removeEditorPanel;return"page"===fullSiteEditing.editorPostType&&t("featured-image"),"wp_template_part"===fullSiteEditing.editorPostType&&t("post-status"),ct()})}]));
full-site-editing/dist/full-site-editing.rtl.css CHANGED
@@ -1 +1 @@
1
- .wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.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}.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{max-width:calc(100vw - 81px);margin-right:3px;margin-left:3px}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear .7s}.template__block-container.is-hovered .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container.is-selected .template-block__overlay{opacity:1;transition:opacity .2s linear}.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear .7s}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;right:0;margin:0;opacity:0;padding:0;position:absolute;left:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template) .fse-site-logo .components-placeholder__instructions{display:none}.edit-post-fullscreen-mode-close__toolbar a.is-button.is-default{height:auto}.edit-post-fullscreen-mode-close__toolbar a.is-button.is-default span{display:none}.edit-post-fullscreen-mode-close__toolbar a.a8c-close-button{padding:4px}.post-type-wp_template .edit-post-post-status,.post-type-wp_template .editor-post-title,.post-type-wp_template .editor-post-trash{display:none}.post-type-wp_template .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template .editor-post-switch-to-draft{display:none}.post-type-page .edit-post-layout__content,.post-type-wp_template .edit-post-layout__content{background:#eee}.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template .edit-post-layout__content .edit-post-visual-editor{flex:none;margin:36px 32px;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2)}@media (max-width:768px){.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template .edit-post-layout__content .edit-post-visual-editor{margin:0}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
1
+ .wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block.alignfull{padding:0 12px}@media (max-width:768px){.post-content-block.alignfull{overflow-x:hidden}}.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}@media (max-width:768px){.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{max-width:768px;margin-right:0;margin-left:0}.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full] .block-editor-block-mover{right:60px}}@media (min-width:768px){.post-content-block .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{max-width:calc(100vw - 81px);margin-right:3px;margin-left:3px}}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear .7s}.template__block-container.is-hovered .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container.is-selected .template-block__overlay{opacity:1;transition:opacity .2s linear}.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear .7s}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;right:0;margin:0;opacity:0;padding:0;position:absolute;left:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions,.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .edit-post-layout__content,.post-type-wp_template_part .edit-post-layout__content{background:#eee}.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-layout__content .edit-post-visual-editor{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template_part .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
full-site-editing/editor/remove-editor-panels/index.js CHANGED
@@ -24,7 +24,7 @@ const unsubscribe = subscribe( () => {
24
  // removeEditorPanel action won't have the desired effect. See:
25
  // https://github.com/WordPress/gutenberg/pull/17117
26
  // When support is added, we should remove the CSS hack at '../style.scss'
27
- if ( 'wp_template' === fullSiteEditing.editorPostType ) {
28
  removeEditorPanel( 'post-status' );
29
  }
30
  return unsubscribe();
24
  // removeEditorPanel action won't have the desired effect. See:
25
  // https://github.com/WordPress/gutenberg/pull/17117
26
  // When support is added, we should remove the CSS hack at '../style.scss'
27
+ if ( 'wp_template_part' === fullSiteEditing.editorPostType ) {
28
  removeEditorPanel( 'post-status' );
29
  }
30
  return unsubscribe();
full-site-editing/editor/style.scss CHANGED
@@ -1,4 +1,4 @@
1
- .post-type-wp_template {
2
  .editor-post-title,
3
  .editor-post-trash {
4
  display: none;
@@ -20,18 +20,16 @@
20
  }
21
  }
22
 
23
- .post-type-page, .post-type-wp_template {
24
- .edit-post-layout__content {
25
- background: #eee;
26
- }
27
-
28
- .edit-post-layout__content .edit-post-visual-editor {
29
- flex: none;
30
- margin: 36px 32px;
31
- box-shadow: 0 2px 2px 0 rgba( 0, 0, 0, 0.14 ), 0 3px 1px -2px rgba( 0, 0, 0, 0.12 ), 0 1px 5px 0 rgba( 0, 0, 0, 0.2 );
32
 
33
- @media ( max-width: 768px ) {
34
- margin: 0;
 
 
35
  }
36
  }
37
 
1
+ .post-type-wp_template_part {
2
  .editor-post-title,
3
  .editor-post-trash {
4
  display: none;
20
  }
21
  }
22
 
23
+ .post-type-page, .post-type-wp_template_part {
24
+ @media ( min-width: 768px ) {
25
+ .edit-post-layout__content {
26
+ background: #eee;
27
+ }
 
 
 
 
28
 
29
+ .edit-post-layout__content .edit-post-visual-editor {
30
+ box-shadow: 0 2px 2px 0 rgba( 0, 0, 0, 0.14 ), 0 3px 1px -2px rgba( 0, 0, 0, 0.12 ), 0 1px 5px 0 rgba( 0, 0, 0, 0.2 );
31
+ flex: none;
32
+ margin: 36px 32px;
33
  }
34
  }
35
 
full-site-editing/editor/suppress-draft-action/index.js CHANGED
@@ -12,7 +12,11 @@ use( registry => {
12
  const actions = { ...registry.dispatch( namespace ) };
13
  const { editorPostType } = fullSiteEditing;
14
 
15
- if ( namespace === 'core/editor' && actions.editPost && editorPostType === 'wp_template' ) {
 
 
 
 
16
  const originalEditPost = actions.editPost;
17
 
18
  actions.editPost = edits => {
12
  const actions = { ...registry.dispatch( namespace ) };
13
  const { editorPostType } = fullSiteEditing;
14
 
15
+ if (
16
+ namespace === 'core/editor' &&
17
+ actions.editPost &&
18
+ editorPostType === 'wp_template_part'
19
+ ) {
20
  const originalEditPost = actions.editPost;
21
 
22
  actions.editPost = edits => {
full-site-editing/editor/suppress-trash-action/index.js CHANGED
@@ -12,7 +12,11 @@ use( registry => {
12
  const actions = { ...registry.dispatch( namespace ) };
13
  const { editorPostType } = fullSiteEditing;
14
 
15
- if ( namespace === 'core/editor' && actions.trashPost && editorPostType === 'wp_template' ) {
 
 
 
 
16
  actions.trashPost = () => {};
17
  }
18
 
12
  const actions = { ...registry.dispatch( namespace ) };
13
  const { editorPostType } = fullSiteEditing;
14
 
15
+ if (
16
+ namespace === 'core/editor' &&
17
+ actions.trashPost &&
18
+ editorPostType === 'wp_template_part'
19
+ ) {
20
  actions.trashPost = () => {};
21
  }
22
 
full-site-editing/page-fse.php DELETED
@@ -1,58 +0,0 @@
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
@@ -5,11 +5,6 @@
5
  */
6
  import domReady from '@wordpress/dom-ready';
7
 
8
- /**
9
- * Internal dependencies
10
- */
11
- import './style.scss';
12
-
13
  domReady( () => {
14
  const { closeButtonLabel, closeButtonUrl, editorPostType } = fullSiteEditing;
15
 
@@ -22,7 +17,7 @@ domReady( () => {
22
  clearInterval( editPostHeaderInception );
23
 
24
  // When closing Template CPT (e.g. header) to navigate back to parent page.
25
- if ( 'wp_template' === editorPostType && closeButtonUrl ) {
26
  const newCloseButton = document.createElement( 'a' );
27
  newCloseButton.href = closeButtonUrl;
28
  newCloseButton.innerHTML = closeButtonLabel;
@@ -31,12 +26,6 @@ domReady( () => {
31
 
32
  const parentContainer = document.querySelector( '.edit-post-fullscreen-mode-close__toolbar' );
33
  parentContainer.replaceChild( newCloseButton, closeButton );
34
- } else {
35
- // Otherwise just replace the left caret with an X icon.
36
- // The size is 28 instead of 20 because `dashicons-no-alt` looks smaller than `dashicons-arrow-left-alt2`.
37
- closeButton.innerHTML =
38
- '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28" height="28" viewBox="0 0 20 20"><path d="M14.95 6.46l-3.54 3.54 3.54 3.54-1.41 1.41-3.54-3.53-3.53 3.53-1.42-1.42 3.53-3.53-3.53-3.53 1.42-1.42 3.53 3.53 3.54-3.53z"></path></svg>';
39
- closeButton.classList.add( 'a8c-close-button' );
40
  }
41
  } );
42
  } );
5
  */
6
  import domReady from '@wordpress/dom-ready';
7
 
 
 
 
 
 
8
  domReady( () => {
9
  const { closeButtonLabel, closeButtonUrl, editorPostType } = fullSiteEditing;
10
 
17
  clearInterval( editPostHeaderInception );
18
 
19
  // When closing Template CPT (e.g. header) to navigate back to parent page.
20
+ if ( 'wp_template_part' === editorPostType && closeButtonUrl ) {
21
  const newCloseButton = document.createElement( 'a' );
22
  newCloseButton.href = closeButtonUrl;
23
  newCloseButton.innerHTML = closeButtonLabel;
26
 
27
  const parentContainer = document.querySelector( '.edit-post-fullscreen-mode-close__toolbar' );
28
  parentContainer.replaceChild( newCloseButton, closeButton );
 
 
 
 
 
 
29
  }
30
  } );
31
  } );
full-site-editing/plugins/close-button-override/style.scss DELETED
@@ -1,13 +0,0 @@
1
- .edit-post-fullscreen-mode-close__toolbar a {
2
- &.is-button.is-default {
3
- height: auto;
4
- span {
5
- display: none;
6
- }
7
- }
8
-
9
- &.a8c-close-button {
10
- // Adjust the button padding to accommodate the bigger icon size.
11
- padding: 4px;
12
- }
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/plugins/editor-template-classes/index.js CHANGED
@@ -14,8 +14,12 @@ import { registerPlugin } from '@wordpress/plugins';
14
  const EditorTemplateClasses = withSelect( select => {
15
  const { getEntityRecord } = select( 'core' );
16
  const { getEditedPostAttribute } = select( 'core/editor' );
17
- const templateClasses = map( getEditedPostAttribute( 'template_types' ), typeId => {
18
- const typeName = get( getEntityRecord( 'taxonomy', 'wp_template_type', typeId ), 'name', '' );
 
 
 
 
19
  if ( endsWith( typeName, '-header' ) ) {
20
  return 'site-header site-branding';
21
  }
@@ -41,7 +45,7 @@ const EditorTemplateClasses = withSelect( select => {
41
  return null;
42
  } );
43
 
44
- if ( 'wp_template' === fullSiteEditing.editorPostType ) {
45
  registerPlugin( 'fse-editor-template-classes', {
46
  render: EditorTemplateClasses,
47
  } );
14
  const EditorTemplateClasses = withSelect( select => {
15
  const { getEntityRecord } = select( 'core' );
16
  const { getEditedPostAttribute } = select( 'core/editor' );
17
+ const templateClasses = map( getEditedPostAttribute( 'template_part_types' ), typeId => {
18
+ const typeName = get(
19
+ getEntityRecord( 'taxonomy', 'wp_template_part_type', typeId ),
20
+ 'name',
21
+ ''
22
+ );
23
  if ( endsWith( typeName, '-header' ) ) {
24
  return 'site-header site-branding';
25
  }
45
  return null;
46
  } );
47
 
48
+ if ( 'wp_template_part' === fullSiteEditing.editorPostType ) {
49
  registerPlugin( 'fse-editor-template-classes', {
50
  render: EditorTemplateClasses,
51
  } );
full-site-editing/plugins/template-selector-sidebar/index.js DELETED
@@ -1,71 +0,0 @@
1
- /* global fullSiteEditing */
2
- /**
3
- * External dependencies
4
- */
5
- import { get } from 'lodash';
6
-
7
- /**
8
- * WordPress dependencies
9
- */
10
- import { PanelBody } from '@wordpress/components';
11
- import { compose } from '@wordpress/compose';
12
- import { withDispatch, withSelect } from '@wordpress/data';
13
- import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
14
- import { Fragment } from '@wordpress/element';
15
- import { __ } from '@wordpress/i18n';
16
- import { registerPlugin } from '@wordpress/plugins';
17
-
18
- /**
19
- * Internal dependencies
20
- */
21
- import PostAutocomplete from '../../components/post-autocomplete';
22
-
23
- const TemplateSelectorSidebar = compose(
24
- withDispatch( dispatch => ( {
25
- setTemplateId: templateId =>
26
- dispatch( 'core/editor' ).editPost( { meta: { _wp_template_id: templateId } } ),
27
- } ) ),
28
- withSelect( select => {
29
- const { canUser, getEntityRecord } = select( 'core' );
30
- const templateId = get(
31
- select( 'core/editor' ).getEditedPostAttribute( 'meta' ),
32
- '_wp_template_id'
33
- );
34
- return {
35
- canUserUpdateSettings: canUser( 'update', 'settings' ),
36
- selectedTemplate: templateId && getEntityRecord( 'postType', 'wp_template', templateId ),
37
- };
38
- } )
39
- )( ( { canUserUpdateSettings, setTemplateId, selectedTemplate } ) => {
40
- if ( ! canUserUpdateSettings ) {
41
- return null;
42
- }
43
-
44
- const onSelectTemplate = ( { id } ) => {
45
- setTemplateId( parseInt( id, 10 ) );
46
- };
47
-
48
- return (
49
- <Fragment>
50
- <PluginSidebarMoreMenuItem target="fse-template-sidebar" icon="layout">
51
- { __( 'Template' ) }
52
- </PluginSidebarMoreMenuItem>
53
- <PluginSidebar icon="layout" name="fse-template-sidebar" title={ __( 'Template' ) }>
54
- <PanelBody>
55
- { __( 'Select a template' ) }
56
- <PostAutocomplete
57
- initialValue={ get( selectedTemplate, [ 'title', 'rendered' ] ) }
58
- onSelectPost={ onSelectTemplate }
59
- postType="wp_template"
60
- />
61
- </PanelBody>
62
- </PluginSidebar>
63
- </Fragment>
64
- );
65
- } );
66
-
67
- if ( 'page' === fullSiteEditing.editorPostType ) {
68
- registerPlugin( 'fse-template-selector-sidebar', {
69
- render: TemplateSelectorSidebar,
70
- } );
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/plugins/template-update-confirmation/button.js DELETED
@@ -1,143 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { Button } from '@wordpress/components';
5
- import { Component, Fragment } from '@wordpress/element';
6
- import { withGlobalEvents, compose } from '@wordpress/compose';
7
- import { withSelect } from '@wordpress/data';
8
- import { debounce, get, isNil } from 'lodash';
9
- import { __ } from '@wordpress/i18n';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import Panel from './panel';
15
-
16
- const initialState = {
17
- buttonStyle: {
18
- visibility: 'hidden',
19
- },
20
- isPanelOpen: false,
21
- };
22
-
23
- class TemplateUpdateConfirmationButton extends Component {
24
- constructor( props ) {
25
- super( props );
26
- this.onResize = debounce( this.onResize, 100 );
27
- this.state = initialState;
28
- this.onResize();
29
- }
30
-
31
- componentDidUpdate( props, prevProps ) {
32
- if ( props.isFullScreen !== prevProps.isFullScreen ) {
33
- // this ensures the button is repositioned properly when toggling fullscreen mode
34
- setTimeout( () => this.onResize(), 1 );
35
- }
36
- }
37
-
38
- getOriginalButton() {
39
- return document.querySelector( '.edit-post-header .editor-post-publish-button' );
40
- }
41
-
42
- onResize() {
43
- const originalButton = this.getOriginalButton();
44
- let { buttonStyle } = initialState;
45
- if ( isNil( originalButton ) || ! ( 'getBoundingClientRect' in originalButton ) ) {
46
- // if it's not there, might need a timeout to await it?
47
- return this.setState( { buttonStyle } );
48
- }
49
- const rect = originalButton.getBoundingClientRect();
50
- buttonStyle = {
51
- // height doesn't line up perfectly with default styles
52
- height: '33px',
53
- position: 'fixed',
54
- zIndex: '10001',
55
- top: rect.top,
56
- left: rect.x,
57
- };
58
- if ( ! window.matchMedia( '(min-width: 600px)' ).matches ) {
59
- buttonStyle.paddingLeft = '5px';
60
- buttonStyle.paddingRight = '5px';
61
- }
62
- this.setState( { buttonStyle } );
63
- }
64
-
65
- getHidingCss() {
66
- return `.edit-post-header .editor-post-publish-button {
67
- visibility: hidden !important;
68
- }`;
69
- }
70
-
71
- render() {
72
- if ( ! this.shouldRender() ) {
73
- return null;
74
- }
75
- const { isSaving, isSaveable, isPostSavingLocked, isPublishable } = this.props;
76
- const isButtonDisabled = isSaving || ! isSaveable || isPostSavingLocked || ! isPublishable;
77
- return (
78
- <Fragment>
79
- <Button
80
- onClick={ this.togglePanel }
81
- isPrimary
82
- isLarge
83
- style={ this.state.buttonStyle }
84
- disabled={ isButtonDisabled }
85
- isBusy={ this.isSaving }
86
- >
87
- { __( 'Update' ) }
88
- </Button>
89
- { this.state.isPanelOpen && (
90
- <Panel
91
- isBusy={ this.isSaving }
92
- onClose={ this.togglePanel }
93
- onSave={ this.onPublish }
94
- disabled={ isButtonDisabled }
95
- />
96
- ) }
97
- <style>{ this.getHidingCss() }</style>
98
- </Fragment>
99
- );
100
- }
101
-
102
- shouldRender() {
103
- const { isPublished, isPublishable, isSaveable } = this.props;
104
- if ( ! isPublished || ! isPublishable || ! isSaveable ) {
105
- return false;
106
- }
107
- return true;
108
- }
109
-
110
- onPublish = () => {
111
- this.togglePanel();
112
- this.getOriginalButton().click();
113
- };
114
-
115
- togglePanel = () => {
116
- this.setState( { isPanelOpen: ! this.state.isPanelOpen } );
117
- };
118
- }
119
-
120
- export default compose( [
121
- withSelect( select => {
122
- const {
123
- isSavingPost,
124
- isCurrentPostPublished,
125
- isEditedPostSaveable,
126
- isEditedPostPublishable,
127
- isPostSavingLocked,
128
- getCurrentPost,
129
- } = select( 'core/editor' );
130
- return {
131
- isSaving: isSavingPost(),
132
- isSaveable: isEditedPostSaveable(),
133
- isPostSavingLocked: isPostSavingLocked(),
134
- isPublishable: isEditedPostPublishable(),
135
- isPublished: isCurrentPostPublished(),
136
- hasPublishAction: get( getCurrentPost(), [ '_links', 'wp:action-publish' ], false ),
137
- isFullScreen: select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ),
138
- };
139
- } ),
140
- withGlobalEvents( {
141
- resize: 'onResize',
142
- } ),
143
- ] )( TemplateUpdateConfirmationButton );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/plugins/template-update-confirmation/index.js DELETED
@@ -1,21 +0,0 @@
1
- /* global fullSiteEditing */
2
- /**
3
- * External dependencies
4
- */
5
- import domReady from '@wordpress/dom-ready';
6
- import { render } from '@wordpress/element';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import TemplateUpdateConfirmationButton from './button';
12
-
13
- domReady( () => {
14
- if ( 'wp_template_part' !== fullSiteEditing.editorPostType ) {
15
- return;
16
- }
17
- const element = document.createElement( 'div' );
18
- element.id = 'template-update-confirmation';
19
- document.getElementById( 'wpcontent' ).appendChild( element );
20
- render( <TemplateUpdateConfirmationButton />, element );
21
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/plugins/template-update-confirmation/panel.js DELETED
@@ -1,40 +0,0 @@
1
- /* eslint-disable wpcalypso/jsx-classname-namespace */
2
- /**
3
- * External dependencies
4
- */
5
- import { Component } from '@wordpress/element';
6
- import { Button, IconButton } from '@wordpress/components';
7
- import { __ } from '@wordpress/i18n';
8
-
9
- export default class Panel extends Component {
10
- render() {
11
- const { onSave, onClose, isBusy, disabled } = this.props;
12
- return (
13
- <div className="edit-post-layout">
14
- <div className="editor-post-publish-panel">
15
- <div className="editor-post-publish-panel__header">
16
- <div className="editor-post-publish-panel__header-publish-button">
17
- <Button isPrimary isLarge isBusy={ isBusy } onClick={ onSave } disabled={ disabled }>
18
- { __( 'Publish' ) }
19
- </Button>
20
- <span className="editor-post-publish-panel__spacer" />
21
- </div>
22
-
23
- <IconButton
24
- aria-expanded={ true }
25
- onClick={ onClose }
26
- icon="no-alt"
27
- label={ __( 'Close panel' ) }
28
- />
29
- </div>
30
- <div className="editor-post-publish-panel__prepublish">
31
- <p>
32
- <strong>{ __( 'Are you ready to publish?' ) }</strong>
33
- </p>
34
- <p>{ __( 'Changes you publish will update all pages with this template part.' ) }</p>
35
- </div>
36
- </div>
37
- </div>
38
- );
39
- }
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/plugins/template-update-notice/index.js CHANGED
@@ -7,7 +7,7 @@ import { dispatch } from '@wordpress/data';
7
  import { __ } from '@wordpress/i18n';
8
 
9
  domReady( () => {
10
- if ( 'wp_template' !== fullSiteEditing.editorPostType ) {
11
  return;
12
  }
13
  dispatch( 'core/notices' ).createNotice(
7
  import { __ } from '@wordpress/i18n';
8
 
9
  domReady( () => {
10
+ if ( 'wp_template_part' !== fullSiteEditing.editorPostType ) {
11
  return;
12
  }
13
  dispatch( 'core/notices' ).createNotice(
full-site-editing/templates/class-wp-template-inserter.php CHANGED
@@ -82,6 +82,17 @@ class WP_Template_Inserter {
82
  $response = $this->fetch_retry( $request_url, $request_args );
83
 
84
  if ( ! $response ) {
 
 
 
 
 
 
 
 
 
 
 
85
  return;
86
  }
87
 
@@ -124,6 +135,26 @@ class WP_Template_Inserter {
124
  $this->fetch_retry( $request_url, $request_args, $attempt );
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  /**
128
  * Determines whether FSE data has already been inserted.
129
  *
@@ -137,11 +168,29 @@ class WP_Template_Inserter {
137
  * This function will be called on plugin activation hook.
138
  */
139
  public function insert_default_template_data() {
 
 
 
 
 
 
 
 
 
140
  if ( $this->is_template_data_inserted() ) {
141
  /*
142
  * Bail here to prevent inserting the FSE data twice for any given theme.
143
  * Multiple themes will still be able to insert different templates.
144
  */
 
 
 
 
 
 
 
 
 
145
  return;
146
  }
147
 
@@ -160,36 +209,45 @@ class WP_Template_Inserter {
160
  'post_title' => 'Header',
161
  'post_content' => $this->header_content,
162
  'post_status' => 'publish',
163
- 'post_type' => 'wp_template',
164
  'comment_status' => 'closed',
165
  'ping_status' => 'closed',
166
  ]
167
  );
168
 
169
- if ( ! term_exists( "$this->theme_slug-header", 'wp_template_type' ) ) {
170
- wp_insert_term( "$this->theme_slug-header", 'wp_template_type' );
171
  }
172
 
173
- wp_set_object_terms( $header_id, "$this->theme_slug-header", 'wp_template_type' );
174
 
175
  $footer_id = wp_insert_post(
176
  [
177
  'post_title' => 'Footer',
178
  'post_content' => $this->footer_content,
179
  'post_status' => 'publish',
180
- 'post_type' => 'wp_template',
181
  'comment_status' => 'closed',
182
  'ping_status' => 'closed',
183
  ]
184
  );
185
 
186
- if ( ! term_exists( "$this->theme_slug-footer", 'wp_template_type' ) ) {
187
- wp_insert_term( "$this->theme_slug-footer", 'wp_template_type' );
188
  }
189
 
190
- wp_set_object_terms( $footer_id, "$this->theme_slug-footer", 'wp_template_type' );
191
 
192
  add_option( $this->fse_template_data_option, true );
 
 
 
 
 
 
 
 
 
193
  }
194
 
195
  /**
@@ -208,8 +266,26 @@ class WP_Template_Inserter {
208
  * with 'About' and 'Contact' titles already exist.
209
  */
210
  public function insert_default_pages() {
 
 
 
 
 
 
 
 
 
211
  // Bail if this data has already been inserted.
212
  if ( $this->is_pages_data_inserted() ) {
 
 
 
 
 
 
 
 
 
213
  return;
214
  }
215
 
@@ -223,42 +299,39 @@ class WP_Template_Inserter {
223
  $response = $this->fetch_retry( $request_url );
224
 
225
  if ( ! $response ) {
 
 
 
 
 
 
 
 
 
226
  return;
227
  }
228
 
229
  $api_response = json_decode( wp_remote_retrieve_body( $response ), true );
230
 
231
- $about_page_content = '';
232
- $contact_page_content = '';
233
-
234
- /*
235
- * Array of returned templates is not keyed by name, so we have to access it directly like this.
236
- * About page is at position 6 in the array, and Contact page at 1.
237
- */
238
- if ( ! empty( $api_response['templates'][6]['content'] ) ) {
239
- $about_page_content = $api_response['templates'][6]['content'];
240
- }
241
 
242
- if ( ! empty( $api_response['templates'][1]['content'] ) ) {
243
- $contact_page_content = $api_response['templates'][1]['content'];
244
- }
245
-
246
- if ( empty( get_page_by_title( 'About' ) ) ) {
247
  wp_insert_post(
248
  [
249
  'post_title' => _x( 'About', 'Default page title', 'full-site-editing' ),
250
- 'post_content' => $about_page_content,
251
  'post_status' => 'publish',
252
  'post_type' => 'page',
253
  ]
254
  );
255
  }
256
 
257
- if ( empty( get_page_by_title( 'Contact' ) ) ) {
258
  wp_insert_post(
259
  [
260
  'post_title' => _x( 'Contact', 'Default page title', 'full-site-editing' ),
261
- 'post_content' => $contact_page_content,
262
  'post_status' => 'publish',
263
  'post_type' => 'page',
264
  ]
@@ -266,6 +339,15 @@ class WP_Template_Inserter {
266
  }
267
 
268
  update_option( $this->fse_page_data_option, true );
 
 
 
 
 
 
 
 
 
269
  }
270
 
271
  /**
@@ -290,30 +372,30 @@ class WP_Template_Inserter {
290
  */
291
  public function register_template_post_types() {
292
  register_post_type(
293
- 'wp_template',
294
  array(
295
  'labels' => array(
296
- 'name' => _x( 'Templates', 'post type general name', 'full-site-editing' ),
297
- 'singular_name' => _x( 'Template', 'post type singular name', 'full-site-editing' ),
298
- 'menu_name' => _x( 'Templates', 'admin menu', 'full-site-editing' ),
299
- 'name_admin_bar' => _x( 'Template', 'add new on admin bar', 'full-site-editing' ),
300
  'add_new' => _x( 'Add New', 'Template', 'full-site-editing' ),
301
- 'add_new_item' => __( 'Add New Template', 'full-site-editing' ),
302
- 'new_item' => __( 'New Template', 'full-site-editing' ),
303
- 'edit_item' => __( 'Edit Template', 'full-site-editing' ),
304
- 'view_item' => __( 'View Template', 'full-site-editing' ),
305
- 'all_items' => __( 'All Templates', 'full-site-editing' ),
306
- 'search_items' => __( 'Search Templates', 'full-site-editing' ),
307
- 'not_found' => __( 'No templates found.', 'full-site-editing' ),
308
- 'not_found_in_trash' => __( 'No templates found in Trash.', 'full-site-editing' ),
309
- 'filter_items_list' => __( 'Filter templates list', 'full-site-editing' ),
310
- 'items_list_navigation' => __( 'Templates list navigation', 'full-site-editing' ),
311
- 'items_list' => __( 'Templates list', 'full-site-editing' ),
312
- 'item_published' => __( 'Template published.', 'full-site-editing' ),
313
- 'item_published_privately' => __( 'Template published privately.', 'full-site-editing' ),
314
- 'item_reverted_to_draft' => __( 'Template reverted to draft.', 'full-site-editing' ),
315
- 'item_scheduled' => __( 'Template scheduled.', 'full-site-editing' ),
316
- 'item_updated' => __( 'Template updated.', 'full-site-editing' ),
317
  ),
318
  'menu_icon' => 'dashicons-layout',
319
  'public' => false,
@@ -321,9 +403,9 @@ class WP_Template_Inserter {
321
  'show_in_menu' => false,
322
  'rewrite' => false,
323
  'show_in_rest' => true, // Otherwise previews won't be generated in full page view.
324
- 'rest_base' => 'templates',
325
  'rest_controller_class' => __NAMESPACE__ . '\REST_Templates_Controller',
326
- 'capability_type' => 'template',
327
  'capabilities' => array(
328
  // You need to be able to edit posts, in order to read templates in their raw form.
329
  'read' => 'edit_posts',
@@ -347,24 +429,24 @@ class WP_Template_Inserter {
347
  );
348
 
349
  register_taxonomy(
350
- 'wp_template_type',
351
- 'wp_template',
352
  array(
353
  'labels' => array(
354
- 'name' => _x( 'Template Types', 'taxonomy general name', 'full-site-editing' ),
355
- 'singular_name' => _x( 'Template Type', 'taxonomy singular name', 'full-site-editing' ),
356
- 'menu_name' => _x( 'Template Types', 'admin menu', 'full-site-editing' ),
357
- 'all_items' => __( 'All Template Types', 'full-site-editing' ),
358
- 'edit_item' => __( 'Edit Template Type', 'full-site-editing' ),
359
- 'view_item' => __( 'View Template Type', 'full-site-editing' ),
360
- 'update_item' => __( 'Update Template Type', 'full-site-editing' ),
361
- 'add_new_item' => __( 'Add New Template Type', 'full-site-editing' ),
362
- 'new_item_name' => __( 'New Template Type', 'full-site-editing' ),
363
- 'parent_item' => __( 'Parent Template Type', 'full-site-editing' ),
364
- 'parent_item_colon' => __( 'Parent Template Type:', 'full-site-editing' ),
365
- 'search_items' => __( 'Search Template Types', 'full-site-editing' ),
366
- 'not_found' => __( 'No template types found.', 'full-site-editing' ),
367
- 'back_to_items' => __( 'Back to template types', 'full-site-editing' ),
368
  ),
369
  'public' => false,
370
  'publicly_queryable' => false,
@@ -372,7 +454,7 @@ class WP_Template_Inserter {
372
  'show_in_menu' => false,
373
  'show_in_nav_menu' => false,
374
  'show_in_rest' => true,
375
- 'rest_base' => 'template_types',
376
  'show_tagcloud' => false,
377
  'hierarchical' => true,
378
  'rewrite' => false,
82
  $response = $this->fetch_retry( $request_url, $request_args );
83
 
84
  if ( ! $response ) {
85
+ do_action(
86
+ 'a8c_fse_log',
87
+ 'template_population_failure',
88
+ [
89
+ 'context' => 'WP_Template_Inserter->fetch_template_parts',
90
+ 'error' => 'Fetch retry timeout',
91
+ 'theme_slug' => $this->theme_slug,
92
+ ]
93
+ );
94
+ $this->header_content = $this->get_default_header();
95
+ $this->footer_content = $this->get_default_footer();
96
  return;
97
  }
98
 
135
  $this->fetch_retry( $request_url, $request_args, $attempt );
136
  }
137
 
138
+ /**
139
+ * Returns a default header if call to template api fails for some reason.
140
+ *
141
+ * @return string Content of a default header
142
+ */
143
+ public function get_default_header() {
144
+ return '<!-- wp:a8c/site-description /-->
145
+ <!-- wp:a8c/site-title /-->
146
+ <!-- wp:a8c/navigation-menu /-->';
147
+ }
148
+
149
+ /**
150
+ * Returns a default footer if call to template api fails for some reason.
151
+ *
152
+ * @return string Content of a default footer
153
+ */
154
+ public function get_default_footer() {
155
+ return '<!-- wp:a8c/navigation-menu /-->';
156
+ }
157
+
158
  /**
159
  * Determines whether FSE data has already been inserted.
160
  *
168
  * This function will be called on plugin activation hook.
169
  */
170
  public function insert_default_template_data() {
171
+ do_action(
172
+ 'a8c_fse_log',
173
+ 'before_template_population',
174
+ [
175
+ 'context' => 'WP_Template_Inserter->insert_default_template_data',
176
+ 'theme_slug' => $this->theme_slug,
177
+ ]
178
+ );
179
+
180
  if ( $this->is_template_data_inserted() ) {
181
  /*
182
  * Bail here to prevent inserting the FSE data twice for any given theme.
183
  * Multiple themes will still be able to insert different templates.
184
  */
185
+ do_action(
186
+ 'a8c_fse_log',
187
+ 'template_population_failure',
188
+ [
189
+ 'context' => 'WP_Template_Inserter->insert_default_template_data',
190
+ 'error' => 'Data already exist',
191
+ 'theme_slug' => $this->theme_slug,
192
+ ]
193
+ );
194
  return;
195
  }
196
 
209
  'post_title' => 'Header',
210
  'post_content' => $this->header_content,
211
  'post_status' => 'publish',
212
+ 'post_type' => 'wp_template_part',
213
  'comment_status' => 'closed',
214
  'ping_status' => 'closed',
215
  ]
216
  );
217
 
218
+ if ( ! term_exists( "$this->theme_slug-header", 'wp_template_part_type' ) ) {
219
+ wp_insert_term( "$this->theme_slug-header", 'wp_template_part_type' );
220
  }
221
 
222
+ wp_set_object_terms( $header_id, "$this->theme_slug-header", 'wp_template_part_type' );
223
 
224
  $footer_id = wp_insert_post(
225
  [
226
  'post_title' => 'Footer',
227
  'post_content' => $this->footer_content,
228
  'post_status' => 'publish',
229
+ 'post_type' => 'wp_template_part',
230
  'comment_status' => 'closed',
231
  'ping_status' => 'closed',
232
  ]
233
  );
234
 
235
+ if ( ! term_exists( "$this->theme_slug-footer", 'wp_template_part_type' ) ) {
236
+ wp_insert_term( "$this->theme_slug-footer", 'wp_template_part_type' );
237
  }
238
 
239
+ wp_set_object_terms( $footer_id, "$this->theme_slug-footer", 'wp_template_part_type' );
240
 
241
  add_option( $this->fse_template_data_option, true );
242
+
243
+ do_action(
244
+ 'a8c_fse_log',
245
+ 'template_population_success',
246
+ [
247
+ 'context' => 'WP_Template_Inserter->insert_default_template_data',
248
+ 'theme_slug' => $this->theme_slug,
249
+ ]
250
+ );
251
  }
252
 
253
  /**
266
  * with 'About' and 'Contact' titles already exist.
267
  */
268
  public function insert_default_pages() {
269
+ do_action(
270
+ 'a8c_fse_log',
271
+ 'before_pages_population',
272
+ [
273
+ 'context' => 'WP_Template_Inserter->insert_default_pages',
274
+ 'theme_slug' => $this->theme_slug,
275
+ ]
276
+ );
277
+
278
  // Bail if this data has already been inserted.
279
  if ( $this->is_pages_data_inserted() ) {
280
+ do_action(
281
+ 'a8c_fse_log',
282
+ 'pages_population_failure',
283
+ [
284
+ 'context' => 'WP_Template_Inserter->insert_default_pages',
285
+ 'error' => 'Data already exist',
286
+ 'theme_slug' => $this->theme_slug,
287
+ ]
288
+ );
289
  return;
290
  }
291
 
299
  $response = $this->fetch_retry( $request_url );
300
 
301
  if ( ! $response ) {
302
+ do_action(
303
+ 'a8c_fse_log',
304
+ 'pages_population_failure',
305
+ [
306
+ 'context' => 'WP_Template_Inserter->insert_default_pages',
307
+ 'error' => 'Fetch retry timeout',
308
+ 'theme_slug' => $this->theme_slug,
309
+ ]
310
+ );
311
  return;
312
  }
313
 
314
  $api_response = json_decode( wp_remote_retrieve_body( $response ), true );
315
 
316
+ // Convert templates response to [ slug => content ] pairs to extract required content more easily.
317
+ $template_content_by_slug = wp_list_pluck( $api_response['templates'], 'content', 'slug' );
 
 
 
 
 
 
 
 
318
 
319
+ if ( empty( get_page_by_title( 'About' ) ) && ! empty( $template_content_by_slug['about'] ) ) {
 
 
 
 
320
  wp_insert_post(
321
  [
322
  'post_title' => _x( 'About', 'Default page title', 'full-site-editing' ),
323
+ 'post_content' => $template_content_by_slug['about'],
324
  'post_status' => 'publish',
325
  'post_type' => 'page',
326
  ]
327
  );
328
  }
329
 
330
+ if ( empty( get_page_by_title( 'Contact' ) ) && ! empty( $template_content_by_slug['contact'] ) ) {
331
  wp_insert_post(
332
  [
333
  'post_title' => _x( 'Contact', 'Default page title', 'full-site-editing' ),
334
+ 'post_content' => $template_content_by_slug['contact'],
335
  'post_status' => 'publish',
336
  'post_type' => 'page',
337
  ]
339
  }
340
 
341
  update_option( $this->fse_page_data_option, true );
342
+
343
+ do_action(
344
+ 'a8c_fse_log',
345
+ 'pages_population_success',
346
+ [
347
+ 'context' => 'WP_Template_Inserter->insert_default_pages',
348
+ 'theme_slug' => $this->theme_slug,
349
+ ]
350
+ );
351
  }
352
 
353
  /**
372
  */
373
  public function register_template_post_types() {
374
  register_post_type(
375
+ 'wp_template_part',
376
  array(
377
  'labels' => array(
378
+ 'name' => _x( 'Template Parts', 'post type general name', 'full-site-editing' ),
379
+ 'singular_name' => _x( 'Template Part', 'post type singular name', 'full-site-editing' ),
380
+ 'menu_name' => _x( 'Template Parts', 'admin menu', 'full-site-editing' ),
381
+ 'name_admin_bar' => _x( 'Template Part', 'add new on admin bar', 'full-site-editing' ),
382
  'add_new' => _x( 'Add New', 'Template', 'full-site-editing' ),
383
+ 'add_new_item' => __( 'Add New Template Part', 'full-site-editing' ),
384
+ 'new_item' => __( 'New Template Part', 'full-site-editing' ),
385
+ 'edit_item' => __( 'Edit Template Part', 'full-site-editing' ),
386
+ 'view_item' => __( 'View Template Part', 'full-site-editing' ),
387
+ 'all_items' => __( 'All Template Parts', 'full-site-editing' ),
388
+ 'search_items' => __( 'Search Template Parts', 'full-site-editing' ),
389
+ 'not_found' => __( 'No template parts found.', 'full-site-editing' ),
390
+ 'not_found_in_trash' => __( 'No template parts found in Trash.', 'full-site-editing' ),
391
+ 'filter_items_list' => __( 'Filter template parts list', 'full-site-editing' ),
392
+ 'items_list_navigation' => __( 'Template parts list navigation', 'full-site-editing' ),
393
+ 'items_list' => __( 'Template parts list', 'full-site-editing' ),
394
+ 'item_published' => __( 'Template part published.', 'full-site-editing' ),
395
+ 'item_published_privately' => __( 'Template part published privately.', 'full-site-editing' ),
396
+ 'item_reverted_to_draft' => __( 'Template part reverted to draft.', 'full-site-editing' ),
397
+ 'item_scheduled' => __( 'Template part scheduled.', 'full-site-editing' ),
398
+ 'item_updated' => __( 'Template part updated.', 'full-site-editing' ),
399
  ),
400
  'menu_icon' => 'dashicons-layout',
401
  'public' => false,
403
  'show_in_menu' => false,
404
  'rewrite' => false,
405
  'show_in_rest' => true, // Otherwise previews won't be generated in full page view.
406
+ 'rest_base' => 'template_parts',
407
  'rest_controller_class' => __NAMESPACE__ . '\REST_Templates_Controller',
408
+ 'capability_type' => 'template_part',
409
  'capabilities' => array(
410
  // You need to be able to edit posts, in order to read templates in their raw form.
411
  'read' => 'edit_posts',
429
  );
430
 
431
  register_taxonomy(
432
+ 'wp_template_part_type',
433
+ 'wp_template_part',
434
  array(
435
  'labels' => array(
436
+ 'name' => _x( 'Template Part Types', 'taxonomy general name', 'full-site-editing' ),
437
+ 'singular_name' => _x( 'Template Part Type', 'taxonomy singular name', 'full-site-editing' ),
438
+ 'menu_name' => _x( 'Template Part Types', 'admin menu', 'full-site-editing' ),
439
+ 'all_items' => __( 'All Template Part Types', 'full-site-editing' ),
440
+ 'edit_item' => __( 'Edit Template Part Type', 'full-site-editing' ),
441
+ 'view_item' => __( 'View Template Part Type', 'full-site-editing' ),
442
+ 'update_item' => __( 'Update Template Part Type', 'full-site-editing' ),
443
+ 'add_new_item' => __( 'Add New Template Part Type', 'full-site-editing' ),
444
+ 'new_item_name' => __( 'New Template Part Type', 'full-site-editing' ),
445
+ 'parent_item' => __( 'Parent Template Part Type', 'full-site-editing' ),
446
+ 'parent_item_colon' => __( 'Parent Template Part Type:', 'full-site-editing' ),
447
+ 'search_items' => __( 'Search Template Part Types', 'full-site-editing' ),
448
+ 'not_found' => __( 'No template part types found.', 'full-site-editing' ),
449
+ 'back_to_items' => __( 'Back to template part types', 'full-site-editing' ),
450
  ),
451
  'public' => false,
452
  'publicly_queryable' => false,
454
  'show_in_menu' => false,
455
  'show_in_nav_menu' => false,
456
  'show_in_rest' => true,
457
+ 'rest_base' => 'template_part_types',
458
  'show_tagcloud' => false,
459
  'hierarchical' => true,
460
  'rewrite' => false,
full-site-editing/templates/class-wp-template.php CHANGED
@@ -93,7 +93,7 @@ class WP_Template {
93
  return null;
94
  }
95
 
96
- $term = get_term_by( 'name', "$this->current_theme_name-$template_type", 'wp_template_type', ARRAY_A );
97
 
98
  // Bail if current site doesn't have this term registered.
99
  if ( ! isset( $term['term_id'] ) ) {
@@ -203,11 +203,18 @@ class WP_Template {
203
 
204
  // 10 priority
205
  $content = wptexturize( $content );
206
- // @todo maybe look at WPCOM_Responsive_Images for WPCom responsive image handling
207
 
208
  // 11 priority
209
  $content = do_shortcode( $content );
210
 
 
 
 
 
 
 
 
 
211
  // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
212
  echo $content;
213
  }
93
  return null;
94
  }
95
 
96
+ $term = get_term_by( 'name', "$this->current_theme_name-$template_type", 'wp_template_part_type', ARRAY_A );
97
 
98
  // Bail if current site doesn't have this term registered.
99
  if ( ! isset( $term['term_id'] ) ) {
203
 
204
  // 10 priority
205
  $content = wptexturize( $content );
 
206
 
207
  // 11 priority
208
  $content = do_shortcode( $content );
209
 
210
+ $content = prepend_attachment( $content );
211
+
212
+ if ( has_filter( 'a8c_fse_make_content_images_responsive' ) ) {
213
+ $content = apply_filters( 'a8c_fse_make_content_images_responsive', $content );
214
+ } else {
215
+ $content = wp_make_content_images_responsive( $content );
216
+ }
217
+
218
  // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
219
  echo $content;
220
  }
full-site-editing/utils/class-a8c-wp-template-data-inserter.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
- /**
3
- * Template data inserter file.
4
- *
5
- * @package full-site-editing
6
- */
7
-
8
- /**
9
- * Class A8C_WP_Template_Data_Inserter
10
- */
11
- class A8C_WP_Template_Data_Inserter {
12
- /**
13
- * This function will be called on plugin activation hook.
14
- */
15
- public function insert_default_template_data() {
16
- $header_id = wp_insert_post(
17
- [
18
- 'post_title' => 'Header',
19
- 'post_content' => $this->get_header_content(),
20
- 'post_status' => 'publish',
21
- 'post_type' => 'wp_template_part',
22
- 'comment_status' => 'closed',
23
- 'ping_status' => 'closed',
24
- ]
25
- );
26
-
27
- if ( ! term_exists( 'header', 'wp_template_part_type' ) ) {
28
- wp_insert_term( 'header', 'wp_template_part_type' );
29
- }
30
-
31
- wp_set_object_terms( $header_id, 'header', 'wp_template_part_type' );
32
-
33
- $footer_id = wp_insert_post(
34
- [
35
- 'post_title' => 'Footer',
36
- 'post_content' => $this->get_footer_content(),
37
- 'post_status' => 'publish',
38
- 'post_type' => 'wp_template_part',
39
- 'comment_status' => 'closed',
40
- 'ping_status' => 'closed',
41
- ]
42
- );
43
-
44
- if ( ! term_exists( 'footer', 'wp_template_part_type' ) ) {
45
- wp_insert_term( 'footer', 'wp_template_part_type' );
46
- }
47
-
48
- wp_set_object_terms( $footer_id, 'footer', 'wp_template_part_type' );
49
-
50
- $page_template_id = wp_insert_post(
51
- [
52
- 'post_title' => 'Page Template',
53
- 'post_content' => $this->get_template_content( $header_id, $footer_id ),
54
- 'post_status' => 'publish',
55
- 'post_type' => 'wp_template',
56
- 'comment_status' => 'closed',
57
- 'ping_status' => 'closed',
58
- ]
59
- );
60
-
61
- if ( ! term_exists( 'footer', 'wp_template_part_type' ) ) {
62
- wp_insert_term( 'footer', 'wp_template_part_type' );
63
- }
64
-
65
- wp_set_object_terms( $page_template_id, 'page_template', 'wp_template_type' );
66
- }
67
-
68
- /**
69
- * Returns default header template part content.
70
- *
71
- * @return string
72
- */
73
- public function get_header_content() {
74
- // TODO: replace with header blocks once they are ready.
75
- return '<!-- wp:group {"className":"site-header site-branding"} -->' .
76
- '<div class="wp-block-group site-header site-branding">' .
77
- '<div class="wp-block-group__inner-container">' .
78
- '<!-- wp:a8c/site-description /-->' .
79
- '<!-- wp:a8c/site-title /-->' .
80
- '<!-- wp:a8c/navigation-menu /-->' .
81
- '</div></div>' .
82
- '<!-- /wp:group -->';
83
- }
84
-
85
- /**
86
- * Returns default footer template part content.
87
- *
88
- * @return string
89
- */
90
- public function get_footer_content() {
91
- return '<!-- wp:a8c/navigation-menu {\"themeLocation\":"footer"} /-->';
92
- }
93
-
94
- /**
95
- * Returns default page template content.
96
- *
97
- * @param int $header_id ID of referenced header template part CPT.
98
- * @param int $footer_id ID of referenced footer template part CPT.
99
- *
100
- * @return string
101
- */
102
- public function get_template_content( $header_id, $footer_id ) {
103
- return "<!-- wp:a8c/template {\"templateId\":$header_id,\"align\":\"full\"} /-->" .
104
- '<!-- wp:a8c/post-content {"align":"full"} /-->' .
105
- "<!-- wp:a8c/template {\"templateId\":$footer_id,\"align\":\"full\"} /-->";
106
- }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/utils/class-a8c-wp-template.php DELETED
@@ -1,234 +0,0 @@
1
- <?php
2
- /**
3
- * A8C WP Template file.
4
- *
5
- * @package full-site-editing
6
- */
7
-
8
- /**
9
- * Class A8C_WP_Template
10
- */
11
- class A8C_WP_Template {
12
- const TEMPLATE_META_KEY = '_wp_template_id';
13
-
14
- /**
15
- * ID of the current post that's being rendered.
16
- *
17
- * @var int $current_post_id ID of the current post.
18
- */
19
- private $current_post_id;
20
-
21
- /**
22
- * ID of the template associated with the current post.
23
- *
24
- * @var int $template_id ID of the template associated with the current post.
25
- */
26
- private $template_id;
27
-
28
- /**
29
- * Name of the currently active theme that is used to reference its template CPTs.
30
- *
31
- * @var string $current_theme_name Name of currently active theme on the site.
32
- */
33
- private $current_theme_name;
34
-
35
-
36
- /**
37
- * A8C_WP_Template constructor.
38
- *
39
- * @param int|null $post_id Defaults to current post id if not passed.
40
- */
41
- public function __construct( $post_id = null ) {
42
- if ( null === $post_id ) {
43
- $post = get_post();
44
-
45
- if ( ! $post ) {
46
- return;
47
- }
48
-
49
- $post_id = $post->ID;
50
- }
51
-
52
- $this->current_post_id = $post_id;
53
- $this->template_id = $this->get_template_id();
54
- $this->current_theme_name = get_option( 'stylesheet' );
55
- }
56
-
57
- /**
58
- * Returns template ID for current page if it exists.
59
- *
60
- * If template id is set in current post's meta (_wp_template_id) it will be returned.
61
- * Otherwise it falls back to global page template that is marked with page_template term
62
- * in wp_template_type taxonomy. Note that having only one term of this kind is not
63
- * currently enforced, so we'll just pick the latest page template that was created
64
- * (based on its post ID).
65
- *
66
- * @return null|int template ID for current page, or null if it doesn't exist.
67
- */
68
- public function get_template_id() {
69
- // If the specific template is referenced in post meta, use it.
70
- $template_id = get_post_meta( $this->current_post_id, self::TEMPLATE_META_KEY, true );
71
-
72
- if ( ! empty( $template_id ) ) {
73
- return $template_id;
74
- }
75
-
76
- $current_theme_name = get_option( 'stylesheet' );
77
-
78
- // Otherwise, fall back to latest global page template defined for current theme.
79
- $term = get_term_by( 'name', "$current_theme_name-page-template", 'wp_template_type', ARRAY_A );
80
-
81
- if ( ! isset( $term['term_id'] ) ) {
82
- return null;
83
- }
84
-
85
- $template_ids = get_objects_in_term( $term['term_id'], $term['taxonomy'], [ 'order' => 'DESC' ] );
86
-
87
- if ( empty( $template_ids ) ) {
88
- return null;
89
- }
90
-
91
- return $template_ids[0];
92
- }
93
-
94
- /**
95
- * Returns template's post content.
96
- *
97
- * @return null|string
98
- */
99
- public function get_template_content() {
100
- if ( empty( $this->template_id ) ) {
101
- return null;
102
- }
103
-
104
- $template_post = get_post( $this->template_id );
105
-
106
- return null === $template_post ? null : $template_post->post_content;
107
- }
108
-
109
- /**
110
- * Returns array of blocks that represent the template.
111
- *
112
- * @return array
113
- */
114
- public function get_template_blocks() {
115
- $template_content = $this->get_template_content();
116
-
117
- $template_blocks = parse_blocks( $template_content );
118
-
119
- return is_array( $template_blocks ) ? $template_blocks : [];
120
- }
121
-
122
- /**
123
- * Returns the post ID of the template part CPT that represents the Header in this template.
124
- *
125
- * This is simplified for now and we are just assuming that the first template part in every
126
- * template will represent the Header.
127
- *
128
- * @return null|int Header template part ID if it exists or null otherwise.
129
- */
130
- public function get_header_id() {
131
- $template_blocks = $this->get_template_blocks();
132
-
133
- if ( empty( $template_blocks ) ) {
134
- return null;
135
- }
136
-
137
- // TODO: Incorporate wp_template_part taxonomy checks.
138
- if ( ! isset( $template_blocks[0]['attrs']['templateId'] ) ) {
139
- return null;
140
- }
141
-
142
- $header_id = $template_blocks[0]['attrs']['templateId'];
143
-
144
- if ( ! has_term( "$this->current_theme_name-header", 'wp_template_part_type', $header_id ) ) {
145
- return null;
146
- }
147
-
148
- return $header_id;
149
- }
150
-
151
- /**
152
- * Returns the post ID of the template part CPT that represents the Footer in this template.
153
- *
154
- * This is simplified for now and we are just assuming that the last template part in every
155
- * template will represent the Footer.
156
- *
157
- * @return null|int Footer template part ID if it exists or null otherwise.
158
- */
159
- public function get_footer_id() {
160
- $template_blocks = $this->get_template_blocks();
161
-
162
- if ( ! isset( end( $template_blocks )['attrs']['templateId'] ) ) {
163
- return null;
164
- }
165
-
166
- $footer_id = end( $template_blocks )['attrs']['templateId'];
167
-
168
- if ( ! has_term( "$this->current_theme_name-footer", 'wp_template_part_type', $footer_id ) ) {
169
- return null;
170
- }
171
-
172
- return $footer_id;
173
- }
174
-
175
- /**
176
- * Returns header template part content of current template.
177
- *
178
- * @return null|string
179
- */
180
- public function get_header_content() {
181
- $header_id = $this->get_header_id();
182
-
183
- if ( null === $header_id ) {
184
- return null;
185
- }
186
-
187
- $header = get_post( $header_id );
188
-
189
- if ( null === $header ) {
190
- return null;
191
- }
192
-
193
- return $header->post_content;
194
- }
195
-
196
- /**
197
- * Returns footer template part content of current template.
198
- *
199
- * @return null|string
200
- */
201
- public function get_footer_content() {
202
- $footer_id = $this->get_footer_id();
203
-
204
- if ( null === $footer_id ) {
205
- return null;
206
- }
207
-
208
- $footer = get_post( $footer_id );
209
-
210
- if ( null === $footer ) {
211
- return null;
212
- }
213
-
214
- return $footer->post_content;
215
- }
216
- }
217
-
218
- /**
219
- * Template tag to output the FSE template header markup.
220
- */
221
- function fse_get_header() {
222
- $template = new A8C_WP_Template();
223
- // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
224
- echo do_blocks( $template->get_header_content() );
225
- }
226
-
227
- /**
228
- * Template tag to output the FSE template footer markup.
229
- */
230
- function fse_get_footer() {
231
- $template = new A8C_WP_Template();
232
- // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
233
- echo do_blocks( $template->get_footer_content() );
234
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/feature-flags/class-a8c-full-site-editing-feature-flags.php DELETED
@@ -1,118 +0,0 @@
1
- <?php
2
- // phpcs:ignoreFile
3
- // This file is not currently used
4
- /**
5
- * Feature flags file.
6
- *
7
- * @package full-site-editing
8
- */
9
-
10
- /**
11
- * Class A8C_Full_Site_Editing_Feature_Flags
12
- */
13
- class A8C_Full_Site_Editing_Feature_Flags {
14
- /**
15
- * Class instance.
16
- *
17
- * @var A8C_Full_Site_Editing_Feature_Flags
18
- */
19
- private static $instance = null;
20
-
21
- /**
22
- * Feature flags.
23
- *
24
- * @var array
25
- */
26
- private $flags = [];
27
-
28
- /**
29
- * Parameter and cookie name for storing/retrieving the feature flags.
30
- *
31
- * @var string
32
- */
33
- const FEATURE_FLAGS = 'fse_feature_flags';
34
-
35
- /**
36
- * A8C_Full_Site_Editing_Feature_Flags constructor.
37
- */
38
- private function __construct() {
39
- $this->set_flags();
40
- }
41
-
42
- /**
43
- * Creates instance.
44
- *
45
- * @return A8C_Full_Site_Editing_Feature_Flags
46
- */
47
- public static function get_instance() {
48
- if ( is_null( self::$instance ) ) {
49
- self::$instance = new self();
50
- }
51
-
52
- return self::$instance;
53
- }
54
-
55
- /**
56
- * Get the feature flags.
57
- *
58
- * @return array
59
- */
60
- public function get_flags() {
61
- return $this->flags;
62
- }
63
-
64
- /**
65
- * Check if a feature flag is enabled.
66
- *
67
- * @param string $flag_name Feature flag.
68
- * @return boolean
69
- */
70
- public function is_enabled( $flag_name ) {
71
- if ( ! isset( $flag_name, $this->flags[ $flag_name ] ) ) {
72
- return false;
73
- }
74
-
75
- return (bool) $this->flags[ $flag_name ];
76
- }
77
-
78
- /**
79
- * Set the feature flags based on GET parameter or cookie value.
80
- */
81
- private function set_flags() {
82
- $flags = null;
83
-
84
- $has_flags_param = isset( $_GET[ self::FEATURE_FLAGS ] );
85
- $has_flags_cookie = isset( $_COOKIE[ self::FEATURE_FLAGS ] );
86
-
87
- // Remove all of the flag values when empty parameter is passed.
88
- if ( $has_flags_param && empty( $_GET[ self::FEATURE_FLAGS ] ) ) {
89
- setcookie( self::FEATURE_FLAGS, '', time() - 3600 );
90
- $this->flags = [];
91
- return;
92
- }
93
-
94
- if ( $has_flags_param ) {
95
- setcookie( self::FEATURE_FLAGS, $_GET[ self::FEATURE_FLAGS ] );
96
- $flags = $_GET[ self::FEATURE_FLAGS ];
97
- } elseif ( $has_flags_cookie ) {
98
- $flags = $_COOKIE[ self::FEATURE_FLAGS ];
99
- }
100
-
101
- if ( empty( $flags ) ) {
102
- $this->flags = [];
103
- return;
104
- }
105
-
106
- // Feature flags are represented as a string of comma-separated feature flag names.
107
- // For example: "flag1,flag2,-flag3" (leading "-" denotes that the given flag is disabled).
108
- foreach ( explode( ',', $flags ) as $flag ) {
109
- $flag = trim( $flag );
110
- $is_enabled = '-' !== $flag[0];
111
-
112
- // Strip "-" for disabled flags to obtain the correct name
113
- $name = $is_enabled ? $flag : substr( $flag, 1 );
114
-
115
- $this->flags[ $name ] = $is_enabled;
116
- }
117
- }
118
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/feature-flags/index.js DELETED
@@ -1,9 +0,0 @@
1
- /* global fullSiteEditing */
2
- /**
3
- * External dependencies
4
- */
5
- import { get } from 'lodash';
6
-
7
- const isEnabled = flag => get( fullSiteEditing, [ 'featureFlags', flag ], false );
8
-
9
- export default isEnabled;
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: alexislloyd, allancole, automattic, codebykat, copons, dmsnell, ge
3
  Tags: block, blocks, editor, gutenberg, page
4
  Requires at least: 5.0
5
  Tested up to: 5.2
6
- Stable tag: 0.7.1
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -40,8 +40,9 @@ This plugin is experimental, so we don't provide any support for it outside of w
40
 
41
  == Changelog ==
42
 
43
- = 0.7.1 =
44
- * Passes stylesheet to templates API to get homepage templates for latest themes.
 
45
 
46
  = 0.7 =
47
  * Change theme support to Maywood instead of Modern Business.
3
  Tags: block, blocks, editor, gutenberg, page
4
  Requires at least: 5.0
5
  Tested up to: 5.2
6
+ Stable tag: 0.9
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
40
 
41
  == Changelog ==
42
 
43
+ = 0.9 =
44
+
45
+ * Rename wp_template CPT to wp_template_part.
46
 
47
  = 0.7 =
48
  * Change theme support to Maywood instead of Modern Business.