Full Site Editing - Version 0.4

Version Description

  • Move template data initialization out of the plugin and delegate it to themes.
Download this release

Release Info

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

Code changes from version 0.3 to 0.4

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.3
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
@@ -18,7 +18,7 @@
18
  *
19
  * @var string
20
  */
21
- define( 'A8C_FSE_VERSION', '0.3' );
22
 
23
  /**
24
  * Load Full Site Editing.
@@ -96,31 +96,3 @@ function a8c_load_starter_page_templates() {
96
  Starter_Page_Templates::get_instance();
97
  }
98
  add_action( 'plugins_loaded', 'a8c_load_starter_page_templates' );
99
-
100
- /**
101
- * Set up the required plugin data on activation.
102
- *
103
- * Creates the default template that all pages use along with
104
- * the required template parts like header and footer.
105
- */
106
- function a8c_fse_on_plugin_activation() {
107
- /**
108
- * Can be used to disable Full Site Editing functionality.
109
- *
110
- * @since 0.2
111
- *
112
- * @param bool true if Full Site Editing should be disabled, false otherwise.
113
- */
114
- if ( apply_filters( 'a8c_disable_full_site_editing', false ) ) {
115
- return;
116
- }
117
-
118
- require_once __DIR__ . '/full-site-editing/class-full-site-editing.php';
119
- $fse = Full_Site_Editing::get_instance();
120
- $fse->register_template_post_types();
121
-
122
- require_once __DIR__ . '/full-site-editing/utils/class-a8c-wp-template-data-inserter.php';
123
- $data_inserter = new A8C_WP_Template_Data_Inserter();
124
- $data_inserter->insert_default_template_data();
125
- }
126
- register_activation_hook( __FILE__, 'a8c_fse_on_plugin_activation' );
2
  /**
3
  * Plugin Name: Full Site Editing
4
  * Description: Enhances your page creation workflow within the Block Editor.
5
+ * Version: 0.4
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
18
  *
19
  * @var string
20
  */
21
+ define( 'A8C_FSE_VERSION', '0.4' );
22
 
23
  /**
24
  * Load Full Site Editing.
96
  Starter_Page_Templates::get_instance();
97
  }
98
  add_action( 'plugins_loaded', 'a8c_load_starter_page_templates' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
full-site-editing/blocks/navigation-menu/edit.js CHANGED
@@ -6,34 +6,16 @@
6
  /**
7
  * WordPress dependencies
8
  */
9
- import { IconButton, ServerSideRender, Toolbar } from '@wordpress/components';
10
- import { BlockControls } from '@wordpress/editor';
11
- import { addQueryArgs } from '@wordpress/url';
12
  import { Fragment } from '@wordpress/element';
13
- import { __ } from '@wordpress/i18n';
14
 
15
  /**
16
  * Internal dependencies
17
  */
18
 
19
  const NavigationMenuEdit = ( { attributes } ) => {
20
- const url = addQueryArgs( 'customize.php', {
21
- 'autofocus[panel]': 'nav_menus',
22
- return: window.location.href,
23
- } );
24
-
25
  return (
26
  <Fragment>
27
- <BlockControls>
28
- <Toolbar className="wp-block-a8c-navigation-menu-toolbar">
29
- <IconButton
30
- icon="edit"
31
- label={ __( 'Edit Menu' ) }
32
- href={ url }
33
- className="components-toolbar__control"
34
- />
35
- </Toolbar>
36
- </BlockControls>
37
  <ServerSideRender attributes={ attributes } block="a8c/navigation-menu" />
38
  </Fragment>
39
  );
6
  /**
7
  * WordPress dependencies
8
  */
9
+ import { ServerSideRender } from '@wordpress/components';
 
 
10
  import { Fragment } from '@wordpress/element';
 
11
 
12
  /**
13
  * Internal dependencies
14
  */
15
 
16
  const NavigationMenuEdit = ( { attributes } ) => {
 
 
 
 
 
17
  return (
18
  <Fragment>
 
 
 
 
 
 
 
 
 
 
19
  <ServerSideRender attributes={ attributes } block="a8c/navigation-menu" />
20
  </Fragment>
21
  );
full-site-editing/blocks/navigation-menu/index.js CHANGED
@@ -26,12 +26,6 @@ registerBlockType( 'a8c/navigation-menu', {
26
  html: false,
27
  reusable: false,
28
  },
29
- attributes: {
30
- themeLocation: {
31
- type: 'string',
32
- default: 'menu-1',
33
- },
34
- },
35
  edit,
36
  save: () => null,
37
- } );
26
  html: false,
27
  reusable: false,
28
  },
 
 
 
 
 
 
29
  edit,
30
  save: () => null,
31
+ } );
full-site-editing/blocks/navigation-menu/index.php CHANGED
@@ -4,93 +4,49 @@
4
  *
5
  * @package full-site-editing
6
  */
7
-
8
- /**
9
- * Determines necessary wp_nav_menu() parameters by given theme location.
10
- *
11
- * @param string $location Theme location.
12
- * @return array
13
- */
14
- function get_menu_params_by_theme_location( $location ) {
15
- switch ( $location ) {
16
- case 'footer':
17
- $params = [
18
- 'theme_location' => 'footer',
19
- 'menu_class' => 'footer-menu',
20
- 'depth' => 1,
21
- ];
22
- break;
23
- case 'social':
24
- $params = [
25
- 'theme_location' => 'social',
26
- 'menu_class' => 'social-links-menu',
27
- 'link_before' => '<span class="screen-reader-text">',
28
- 'link_after' => '</span>' . twentynineteen_get_icon_svg( 'link' ),
29
- 'depth' => 1,
30
- ];
31
- break;
32
- case 'main-1':
33
- default:
34
- $params = [
35
- 'theme_location' => 'menu-1',
36
- 'menu_class' => 'main-menu',
37
- 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
38
- 'depth' => 1,
39
- ];
40
- break;
41
- }
42
- return $params;
43
- }
44
-
45
- /**
46
- * Determines necessary attributes for the wrapping `nav` element.
47
- *
48
- * @param string $location Theme location.
49
- * @return array
50
- */
51
- function get_wrapper_attributes_by_theme_location( $location ) {
52
- switch ( $location ) {
53
- case 'footer':
54
- $attributes = [
55
- 'class' => 'footer-navigation',
56
- 'label' => 'Footer Menu',
57
- ];
58
- break;
59
- case 'social':
60
- $attributes = [
61
- 'class' => 'social-navigation',
62
- 'label' => 'Social Links Menu',
63
- ];
64
- break;
65
- case 'main-1':
66
- default:
67
- $attributes = [
68
- 'class' => 'main-navigation',
69
- 'label' => 'Top Menu',
70
- ];
71
- break;
72
- }
73
- return $attributes;
74
- }
75
-
76
- /**
77
- * Renders post content.
78
- *
79
- * @param array $attributes Block attributes.
80
- * @return string
81
- */
82
- function render_navigation_menu_block( $attributes ) {
83
- $location = ! empty( $attributes['themeLocation'] ) ? $attributes['themeLocation'] : null;
84
- $wrapper_attr = get_wrapper_attributes_by_theme_location( $location );
85
  ob_start();
86
  // phpcs:disable WordPress.WP.I18n.NonSingularStringLiteralText
87
  ?>
88
- <nav class="<?php echo esc_attr( $wrapper_attr['class'] . ' wp-block-a8c-navigation-menu' ); ?>" aria-label="<?php esc_attr_e( $wrapper_attr['label'], 'twentynineteen' ); ?>">
89
- <?php
90
- wp_nav_menu( get_menu_params_by_theme_location( $location ) );
91
- ?>
 
 
 
 
 
 
92
  </nav>
93
  <!-- #site-navigation -->
94
  <?php
95
  return ob_get_clean();
96
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  *
5
  * @package full-site-editing
6
  */
7
+ function a8c_fse_render_navigation_menu_block( $attributes ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ob_start();
9
  // phpcs:disable WordPress.WP.I18n.NonSingularStringLiteralText
10
  ?>
11
+ <nav class="main-navigation wp-block-a8c-navigation-menu">
12
+ <div class="menu-nav-container">
13
+ <?php
14
+ echo wp_nav_menu([
15
+ 'theme_location' => 'menu-1',
16
+ 'menu_class' => 'main-menu',
17
+ 'fallback_cb' => 'a8c_fse_get_fallback_navigation_menu'
18
+ ]);
19
+ ?>
20
+ </div>
21
  </nav>
22
  <!-- #site-navigation -->
23
  <?php
24
  return ob_get_clean();
25
  }
26
+
27
+ /**
28
+ * Render a list of all site pages as a fallback
29
+ * for when a menu does not exist.
30
+ *
31
+ * @package full-site-editing
32
+ */
33
+ function a8c_fse_get_fallback_navigation_menu() {
34
+ $menu = wp_page_menu([
35
+ 'echo' => 0,
36
+ 'sort_column' => 'post_date',
37
+ 'container' => 'ul',
38
+ 'menu_class' => 'main-menu default-menu',
39
+ 'before' => false,
40
+ 'after' => false
41
+ ]);
42
+
43
+ /**
44
+ * Filter the fallback page menu to use the same
45
+ * CSS class structure as a regularly built menu
46
+ * so we don't have to duplicate CSS selectors everywhere.
47
+ */
48
+ $original_classes = [ 'children', 'page_item_has_sub-menu' ];
49
+ $replacement_classes = [ 'sub-menu', 'menu-item-has-children' ];
50
+
51
+ return str_replace( $original_classes, $replacement_classes, $menu );
52
+ }
full-site-editing/blocks/post-content/index.js CHANGED
@@ -17,7 +17,6 @@ registerBlockType( 'a8c/post-content', {
17
  icon: 'layout',
18
  category: 'layout',
19
  supports: {
20
- align: [ 'wide', 'full' ],
21
  anchor: true,
22
  html: false,
23
  multiple: false,
17
  icon: 'layout',
18
  category: 'layout',
19
  supports: {
 
20
  anchor: true,
21
  html: false,
22
  multiple: false,
full-site-editing/blocks/template/index.js CHANGED
@@ -19,12 +19,14 @@ if ( 'wp_template_part' !== fullSiteEditing.editorPostType ) {
19
  category: 'layout',
20
  attributes: { templateId: { type: 'number' } },
21
  supports: {
22
- align: [ 'wide', 'full' ],
23
  anchor: true,
24
  html: false,
25
  reusable: false,
26
  },
27
  edit,
28
  save: () => null,
 
 
 
29
  } );
30
  }
19
  category: 'layout',
20
  attributes: { templateId: { type: 'number' } },
21
  supports: {
 
22
  anchor: true,
23
  html: false,
24
  reusable: false,
25
  },
26
  edit,
27
  save: () => null,
28
+ getEditWrapperProps() {
29
+ return { 'data-align': 'full' };
30
+ },
31
  } );
32
  }
full-site-editing/class-full-site-editing.php CHANGED
@@ -32,7 +32,6 @@ class Full_Site_Editing {
32
  add_action( 'init', array( $this, 'register_meta_template_id' ) );
33
  add_action( 'rest_api_init', array( $this, 'allow_searching_for_templates' ) );
34
  add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_script_and_style' ), 100 );
35
- add_filter( 'template_include', array( $this, 'load_page_template' ) );
36
  add_action( 'the_post', array( $this, 'merge_template_and_post' ) );
37
  add_filter( 'wp_insert_post_data', array( $this, 'remove_template_components' ), 10, 2 );
38
  add_filter( 'admin_body_class', array( $this, 'toggle_editor_post_title_visibility' ) );
@@ -324,12 +323,12 @@ class Full_Site_Editing {
324
  'a8c/navigation-menu',
325
  array(
326
  'attributes' => [
327
- 'themeLocation' => [
328
- 'default' => 'main-1',
329
  'type' => 'string',
330
  ],
331
  ],
332
- 'render_callback' => 'render_navigation_menu_block',
333
  )
334
  );
335
 
@@ -475,25 +474,7 @@ class Full_Site_Editing {
475
  return;
476
  }
477
 
478
- $template_blocks = parse_blocks( $template_content );
479
- $content_attrs = $this->get_post_content_block_attrs( $template_blocks );
480
-
481
- $wrapped_post_content = sprintf( '<!-- wp:a8c/post-content %s -->%s<!-- /wp:a8c/post-content -->', $content_attrs, $post->post_content );
482
- $post->post_content = str_replace( "<!-- wp:a8c/post-content $content_attrs /-->", $wrapped_post_content, $template_content );
483
- }
484
-
485
- /**
486
- * This will extract the attributes from the post content block
487
- * json encode them.
488
- *
489
- * @param array $blocks An array of template blocks.
490
- */
491
- private function get_post_content_block_attrs( $blocks ) {
492
- foreach ( $blocks as $key => $value ) {
493
- if ( 'a8c/post-content' === $value['blockName'] ) {
494
- return count( $value['attrs'] ) > 0 ? wp_json_encode( $value['attrs'] ) : '';
495
- }
496
- }
497
  }
498
 
499
  /**
@@ -541,21 +522,6 @@ class Full_Site_Editing {
541
  return 'page' === get_post_type() && $fse_template->get_template_id();
542
  }
543
 
544
- /**
545
- * Determine the page template to use.
546
- * If it's a full site page being loaded, use our FSE template.
547
- *
548
- * @param string $template template URL passed to filter.
549
- * @return string Filtered template path.
550
- */
551
- public function load_page_template( $template ) {
552
- if ( $this->is_full_site_page() ) {
553
- return plugin_dir_path( __FILE__ ) . 'page-fse.php';
554
- }
555
-
556
- return $template;
557
- }
558
-
559
  /**
560
  * Return an extra class that will be assigned to the body element if a full site page is being edited.
561
  *
@@ -587,7 +553,7 @@ class Full_Site_Editing {
587
  foreach ( $template_blocks as $block ) {
588
  $template[] = fse_map_block_to_editor_template_setting( $block );
589
  }
590
- $editor_settings['template'] = $template;
591
  $editor_settings['templateLock'] = 'all';
592
  }
593
  return $editor_settings;
32
  add_action( 'init', array( $this, 'register_meta_template_id' ) );
33
  add_action( 'rest_api_init', array( $this, 'allow_searching_for_templates' ) );
34
  add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_script_and_style' ), 100 );
 
35
  add_action( 'the_post', array( $this, 'merge_template_and_post' ) );
36
  add_filter( 'wp_insert_post_data', array( $this, 'remove_template_components' ), 10, 2 );
37
  add_filter( 'admin_body_class', array( $this, 'toggle_editor_post_title_visibility' ) );
323
  'a8c/navigation-menu',
324
  array(
325
  'attributes' => [
326
+ 'className' => [
327
+ 'default' => '',
328
  'type' => 'string',
329
  ],
330
  ],
331
+ 'render_callback' => 'a8c_fse_render_navigation_menu_block',
332
  )
333
  );
334
 
474
  return;
475
  }
476
 
477
+ $post->post_content = preg_replace( '@(<!-- wp:a8c/post-content)(.*?)(/-->)@', "$1$2-->$post->post_content<!-- /wp:a8c/post-content -->", $template_content );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  }
479
 
480
  /**
522
  return 'page' === get_post_type() && $fse_template->get_template_id();
523
  }
524
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
525
  /**
526
  * Return an extra class that will be assigned to the body element if a full site page is being edited.
527
  *
553
  foreach ( $template_blocks as $block ) {
554
  $template[] = fse_map_block_to_editor_template_setting( $block );
555
  }
556
+ $editor_settings['template'] = $template;
557
  $editor_settings['templateLock'] = 'all';
558
  }
559
  return $editor_settings;
full-site-editing/dist/full-site-editing.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}([function(e,t){e.exports=wp.element},function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.components},function(e,t){e.exports=wp.data},function(e,t){e.exports=wp.compose},function(e,t){e.exports=wp.editor},function(e,t){e.exports=lodash},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var o=n(8);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){o(e,t,n[t])})}return e}},function(e,t){e.exports=wp.url},function(e,t){e.exports=wp.domReady},function(e,t,n){var o;
2
  /*!
3
  Copyright (c) 2017 Jed Watson.
4
  Licensed under the MIT License (MIT), see
@@ -9,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 i(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o)&&o.length){var c=i.apply(null,o);c&&e.push(c)}else if("object"===r)for(var l in o)n.call(o,l)&&o[l]&&e.push(l)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(o=function(){return i}.apply(t,[]))||(e.exports=o)}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(e,t,n){var o=n(27),i=n(19);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var o=n(28);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}},function(e,t){e.exports=wp.apiFetch},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){var o=n(29),i=n(30),r=n(31);e.exports=function(e,t){return o(e)||i(e,t)||r()}},function(e,t){e.exports=wp.editPost},function(e,t,n){},function(e,t){function n(e,t,n,o,i,r,c){try{var l=e[r](c),a=l.value}catch(s){return void n(s)}l.done?t(a):Promise.resolve(a).then(o,i)}e.exports=function(e){return function(){var t=this,o=arguments;return new Promise(function(i,r){var c=e.apply(t,o);function l(e){n(c,i,r,l,a,"next",e)}function a(e){n(c,i,r,l,a,"throw",e)}l(void 0)})}}},function(e,t){e.exports=wp.plugins},function(e,t,n){},,function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=o=function(e){return n(e)}:e.exports=o=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},o(t)}e.exports=o},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var c,l=e[Symbol.iterator]();!(o=(c=l.next()).done)&&(n.push(c.value),!t||n.length!==t);o=!0);}catch(a){i=!0,r=a}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,n){},,function(e,t,n){},,function(e,t,n){},,function(e,t,n){},,,function(e,t,n){},,function(e,t,n){"use strict";n.r(t);var o=n(0),i=n(7),r=n(1),c=n(2),l=n(5),a=n(10),s=function(e){var t=e.attributes,n=Object(a.addQueryArgs)("customize.php",{"autofocus[panel]":"nav_menus",return:window.location.href});return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.BlockControls,null,Object(o.createElement)(c.Toolbar,{className:"wp-block-a8c-navigation-menu-toolbar"},Object(o.createElement)(c.IconButton,{icon:"edit",label:Object(r.__)("Edit Menu"),href:n,className:"components-toolbar__control"}))),Object(o.createElement)(c.ServerSideRender,{attributes:t,block:"a8c/navigation-menu"}))},u=(n(25),Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M12 7.27l4.28 10.43-3.47-1.53-.81-.36-.81.36-3.47 1.53L12 7.27M12 2L4.5 20.29l.71.71L12 18l6.79 3 .71-.71L12 2z"})));Object(i.registerBlockType)("a8c/navigation-menu",{title:Object(r.__)("Navigation Menu"),description:Object(r.__)("Visual placeholder for site-wide navigation and menus."),icon:u,category:"layout",supports:{html:!1,reusable:!1},attributes:{themeLocation:{type:"string",default:"menu-1"}},edit:s,save:function(){return null}});var p=n(8),d=n.n(p),b=n(13),f=n.n(b),m=n(14),g=n.n(m),O=n(15),h=n.n(O),v=n(16),j=n.n(v),y=n(17),_=n.n(y),S=n(12),E=n.n(S),w=n(6),P=n(4),k=n(3),x=n(20),T=n.n(x),C=n(9),B=n.n(C),I=n(23),N=n.n(I),R=n(18),L=n.n(R),U=(n(32),Object(w.debounce)(function(){var e=N()(regeneratorRuntime.mark(function e(t,n,o){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o({loading:!0,showSuggestions:!0,suggestions:[]}),e.next=3,L()({path:Object(a.addQueryArgs)("/wp/v2/search",B()({context:"embed",per_page:20,search:t},!!n&&{subtype:n}))});case 3:i=e.sent,o({loading:!1,showSuggestions:!0,suggestions:i});case 5:case"end":return e.stop()}},e)}));return function(t,n,o){return e.apply(this,arguments)}}(),200)),A=Object(P.withState)({loading:!1,showSuggestions:!1,suggestions:[]})(function(e){var t=e.initialValue,n=e.loading,i=e.onSelectPost,l=e.postType,a=e.setState,s=e.showSuggestions,u=e.suggestions,p=Object(o.useState)(t),d=T()(p,2),b=d[0],f=d[1],m=function(e){return function(){var t=function(e,t,n){var o=e.id,i=e.title,r=e.subtype;return t({loading:!1,showSuggestions:!1,suggestions:[]}),n(i),{id:o,type:r}}(e,a,f);i(t)}};return Object(o.createElement)("div",{className:"a8c-post-autocomplete"},Object(o.createElement)(c.TextControl,{autoComplete:"off",onChange:function(e){f(e),e.length<2?a({loading:!1,showSuggestions:!1}):U(e,l,a)},placeholder:Object(r.__)("Type to search"),type:"search",value:b}),n&&Object(o.createElement)(c.Spinner,null),s&&!!u.length&&Object(o.createElement)(c.Popover,{focusOnMount:!1,noArrow:!0,position:"bottom"},Object(o.createElement)("div",{className:"a8c-post-autocomplete__suggestions"},Object(w.map)(u,function(e){return Object(o.createElement)(c.Button,{isLarge:!0,isLink:!0,key:e.id,onClick:m(e)},e.title)}))))}),M=function(e){function t(){return f()(this,t),h()(this,j()(t).apply(this,arguments))}return _()(t,e),g()(t,[{key:"toggleEditing",value:function(){var e=this.props,t=e.isEditing;(0,e.setState)({isEditing:!t})}},{key:"onSelectPost",value:function(e){var t=e.id,n=e.type;this.props.setState({isEditing:!1,selectedPostId:t,selectedPostType:n})}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.isEditing,i=e.selectedPost,a=t.align,s="wp_template"===fullSiteEditing.editorPostType,u=s&&(!n||!!i),p=s&&(n||!i),b=s&&!n&&!!i,f=!s;return Object(o.createElement)(o.Fragment,null,u&&Object(o.createElement)(l.BlockControls,null,Object(o.createElement)(c.Toolbar,null,Object(o.createElement)(c.IconButton,{className:E()("components-icon-button components-toolbar__control",{"is-active":n}),label:Object(r.__)("Change Preview"),onClick:this.toggleEditing,icon:"edit"}))),Object(o.createElement)("div",{className:E()("post-content-block",d()({},"align".concat(a),a))},Object(o.createElement)(l.PostTitle,null),f&&Object(o.createElement)(l.InnerBlocks,{templateLock:!1}),p&&Object(o.createElement)(c.Placeholder,{icon:"layout",label:Object(r.__)("Content Slot"),instructions:Object(r.__)("Placeholder for a post or a page.")},Object(o.createElement)("div",{className:"post-content-block__selector"},Object(o.createElement)("div",null,Object(r.__)("Select something to preview:")),Object(o.createElement)(A,{initialValue:Object(w.get)(i,["title","rendered"]),onSelectPost:this.onSelectPost,postType:["page","post"]}),!!i&&Object(o.createElement)("a",{href:"?post=".concat(i.id,"&action=edit")},Object(r.sprintf)(Object(r.__)('Edit "%s"'),Object(w.get)(i,["title","rendered"],""))))),b&&Object(o.createElement)(o.RawHTML,{className:"post-content-block__preview"},Object(w.get)(i,["content","rendered"]))))}}]),t}(o.Component),z=Object(P.compose)([Object(P.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(k.withSelect)(function(e,t){var n=t.selectedPostId,o=t.selectedPostType;return{selectedPost:(0,e("core").getEntityRecord)("postType",o,n)}})])(M),D="wp_template"===fullSiteEditing.editorPostType?function(){return null}:function(){return Object(o.createElement)(l.InnerBlocks.Content,null)};n(34);function F(e){var t=Object(o.useRef)();return Object(o.useEffect)(function(){t.current=e},[e]),t.current}function H(e,t,n,i,c,l){var a=Object(o.useState)({option:t,previousOption:"",loaded:!1,error:!1}),s=T()(a,2),u=s[0],p=s[1],b=F(i),f=F(c);function m(){p(B()({},u,{option:u.previousOption,isSaving:!1}))}return Object(o.useEffect)(function(){u.loaded||u.error?function(){var t=u.option,o=u.previousOption,l=t&&t.trim()===o.trim(),a=!t||0===t.trim().length;!i&&b&&a&&m();if(!c||l)return;!f&&c&&function(t){p(B()({},u,{isSaving:!0})),L()({path:"/wp/v2/settings",method:"POST",data:d()({},e,t)}).then(function(){return function(e){p(B()({},u,{previousOption:e,isDirty:!1,isSaving:!1}))}(t)}).catch(function(){n(Object(r.sprintf)(Object(r.__)("Unable to save site %s"),e)),m()})}(t)}():L()({path:"/wp/v2/settings"}).then(function(t){return p(B()({},u,{option:t[e],previousOption:t[e],loaded:!0,error:!1}))}).catch(function(){n(Object(r.sprintf)(Object(r.__)("Unable to load site %s"),e)),p(B()({},u,{option:Object(r.sprintf)(Object(r.__)("Error loading site %s"),e),error:!0}))})}),{siteOptions:u,handleChange:function(e){l({updated:Date.now()}),p(B()({},u,{option:e}))}}}Object(i.registerBlockType)("a8c/post-content",{title:Object(r.__)("Content Slot"),description:Object(r.__)("Placeholder for a post or a page."),icon:"layout",category:"layout",supports:{align:["wide","full"],anchor:!0,html:!1,multiple:!1,reusable:!1},edit:z,save:D});var V=Object(P.compose)([Object(k.withDispatch)(function(e){return{createErrorNotice:e("core/notices").createErrorNotice}}),Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,i=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||o())&&!i()}})])(function(e){var t=e.className,n=e.createErrorNotice,i=e.shouldUpdateSiteOption,c=e.isSelected,a=e.setAttributes,s=H("description",Object(r.__)("Site description loading…"),n,c,i,a),u=s.siteOptions,p=s.handleChange,d=u.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.PlainText,{className:t,value:d,onChange:function(e){return p(e)},placeholder:Object(r.__)("Site Description"),"aria-label":Object(r.__)("Site Description")}))});n(36);Object(i.registerBlockType)("a8c/site-description",{title:Object(r.__)("Site Description"),description:Object(r.__)("Site description, also known as the tagline."),icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M4 9h16v2H4V9zm0 4h10v2H4v-2z"})),category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:V,save:function(){return null}});var Q=Object(P.compose)([Object(k.withDispatch)(function(e){return{createErrorNotice:e("core/notices").createErrorNotice}}),Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,i=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||o())&&!i()}})])(function(e){var t=e.className,n=e.createErrorNotice,i=e.shouldUpdateSiteOption,c=e.isSelected,a=e.setAttributes,s=H("title",Object(r.__)("Site title loading…"),n,c,i,a),u=s.siteOptions,p=s.handleChange,d=u.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.PlainText,{className:E()("site-title",t),value:d,onChange:function(e){return p(e)},placeholder:Object(r.__)("Site Title"),"aria-label":Object(r.__)("Site Title")}))});n(38);Object(i.registerBlockType)("a8c/site-title",{title:Object(r.__)("Site Title"),description:Object(r.__)("Your site title."),icon:"layout",category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:Q,save:function(){return null}});n(22);var q=Object(P.compose)(Object(P.withState)({templateClientId:null}),Object(k.withSelect)(function(e,t){var n=t.attributes,o=t.templateClientId,i=e("core").getEntityRecord,r=e("core/editor").getCurrentPostId,c=e("core/block-editor").getBlock,l=n.templateId,s=r(),u=l&&i("postType","wp_template_part",l);return{currentPostId:s,editTemplatePartUrl:Object(a.addQueryArgs)(fullSiteEditing.editTemplatePartBaseUrl,{post:l,fse_parent_post:s}),template:u,templateBlock:c(o),templateTitle:Object(w.get)(u,["title","rendered"],"")}}),Object(k.withDispatch)(function(e,t){var n=e("core/block-editor").receiveBlocks,o=t.template,r=t.templateClientId,c=t.setState;return{receiveTemplateBlocks:function(){if(o&&!r){var e=Object(i.parse)(Object(w.get)(o,["content","raw"],"")),t=1===e.length?e[0]:Object(i.createBlock)("core/template",{},e);n([t]),c({templateClientId:t.clientId})}}}}))(function(e){var t=e.attributes,n=e.editTemplatePartUrl,i=e.receiveTemplateBlocks,a=e.template,s=e.templateBlock,u=e.templateTitle;if(!a)return Object(o.createElement)(c.Placeholder,null,Object(o.createElement)(c.Spinner,null));Object(o.useEffect)(function(){i()});var p=t.align;return Object(o.createElement)("div",{className:E()("template-block",d()({},"align".concat(p),p))},s&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.Disabled,null,Object(o.createElement)(l.BlockEdit,{attributes:s.attributes,block:s,clientId:s.clientId,isSelected:!1,name:s.name,setAttributes:w.noop})),Object(o.createElement)(c.Placeholder,{className:"template-block__overlay",instructions:Object(r.__)("This block is part of your site template and may appear on multiple pages.")},Object(o.createElement)(c.Button,{href:n,isDefault:!0},Object(r.sprintf)(Object(r.__)("Edit %s"),u)))))});"wp_template_part"!==fullSiteEditing.editorPostType&&Object(i.registerBlockType)("a8c/template",{title:Object(r.__)("Template Part"),description:Object(r.__)("Display a template part."),icon:"layout",category:"layout",attributes:{templateId:{type:"number"}},supports:{align:["wide","full"],anchor:!0,html:!1,reusable:!1},edit:q,save:function(){return null}});var G=function(e){var t=e.className;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.BlockControls,null,Object(o.createElement)(c.Toolbar,null,Object(o.createElement)(c.IconButton,{className:"components-toolbar__control",icon:"edit",label:Object(r.__)("Edit Site Logo"),onClick:function(){var e=Object(a.addQueryArgs)("customize.php",{"autofocus[section]":"title_tagline",return:window.location.href});window.location.href=e}}))),Object(o.createElement)(c.ServerSideRender,{className:t,block:"a8c/site-logo",attributes:{editorPreview:!0}}))};n(41);Object(i.registerBlockType)("a8c/site-logo",{title:Object(r.__)("Site Logo"),description:Object(r.__)("Site Logo"),icon:"format-image",category:"layout",keywords:[Object(r.__)("logo"),Object(r.__)("icon"),Object(r.__)("site")],edit:G,save:function(){return null}});var Y=n(21),J=n(24),K=Object(P.compose)(Object(k.withDispatch)(function(e){return{setTemplateId:function(t){return e("core/editor").editPost({meta:{_wp_template_id:t}})}}}),Object(k.withSelect)(function(e){var t=e("core"),n=t.canUser,o=t.getEntityRecord,i=Object(w.get)(e("core/editor").getEditedPostAttribute("meta"),"_wp_template_id");return{canUserUpdateSettings:n("update","settings"),selectedTemplate:i&&o("postType","wp_template",i)}}))(function(e){var t=e.canUserUpdateSettings,n=e.setTemplateId,i=e.selectedTemplate;if(!t)return null;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(Y.PluginSidebarMoreMenuItem,{target:"fse-template-sidebar",icon:"layout"},Object(r.__)("Template")),Object(o.createElement)(Y.PluginSidebar,{icon:"layout",name:"fse-template-sidebar",title:Object(r.__)("Template")},Object(o.createElement)(c.PanelBody,null,Object(r.__)("Select a template"),Object(o.createElement)(A,{initialValue:Object(w.get)(i,["title","rendered"]),onSelectPost:function(e){var t=e.id;n(parseInt(t,10))},postType:"wp_template"}))))});"page"===fullSiteEditing.editorPostType&&Object(J.registerPlugin)("fse-template-selector-sidebar",{render:K});var W=n(11),X=n.n(W);X()(function(){if("wp_template_part"===fullSiteEditing.editorPostType&&fullSiteEditing.closeButtonUrl)var e=setInterval(function(){var t=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");t&&(clearInterval(e),fullSiteEditing.closeButtonUrl&&(t.href=fullSiteEditing.closeButtonUrl))})});var Z=n(19),$=n.n(Z),ee=function(e){function t(){return f()(this,t),h()(this,j()(t).apply(this,arguments))}return _()(t,e),g()(t,[{key:"render",value:function(){var e=this.props,t=e.onSave,n=e.onClose,i=e.isBusy,l=e.disabled;return Object(o.createElement)("div",{className:"edit-post-layout"},Object(o.createElement)("div",{className:"editor-post-publish-panel"},Object(o.createElement)("div",{className:"editor-post-publish-panel__header"},Object(o.createElement)("div",{className:"editor-post-publish-panel__header-publish-button"},Object(o.createElement)(c.Button,{isPrimary:!0,isLarge:!0,isBusy:i,onClick:t,disabled:l},Object(r.__)("Publish")),Object(o.createElement)("span",{className:"editor-post-publish-panel__spacer"})),Object(o.createElement)(c.IconButton,{"aria-expanded":!0,onClick:n,icon:"no-alt",label:Object(r.__)("Close panel")})),Object(o.createElement)("div",{className:"editor-post-publish-panel__prepublish"},Object(o.createElement)("p",null,Object(o.createElement)("strong",null,Object(r.__)("Are you ready to publish?"))),Object(o.createElement)("p",null,Object(r.__)("Changes you publish will update all pages with this template part.")))))}}]),t}(o.Component),te={buttonStyle:{visibility:"hidden"},isPanelOpen:!1},ne=function(e){function t(e){var n;return f()(this,t),n=h()(this,j()(t).call(this,e)),d()($()(n),"onPublish",function(){n.togglePanel(),n.getOriginalButton().click()}),d()($()(n),"togglePanel",function(){n.setState({isPanelOpen:!n.state.isPanelOpen})}),n.onResize=Object(w.debounce)(n.onResize,100),n.state=te,n.onResize(),n}return _()(t,e),g()(t,[{key:"componentDidUpdate",value:function(e,t){var n=this;e.isFullScreen!==t.isFullScreen&&setTimeout(function(){return n.onResize()},1)}},{key:"getOriginalButton",value:function(){return document.querySelector(".edit-post-header .editor-post-publish-button")}},{key:"onResize",value:function(){var e=this.getOriginalButton(),t=te.buttonStyle;if(Object(w.isNil)(e)||!("getBoundingClientRect"in e))return this.setState({buttonStyle:t});var n=e.getBoundingClientRect();t={height:"33px",position:"fixed",zIndex:"10001",top:n.top,left:n.x},window.matchMedia("(min-width: 600px)").matches||(t.paddingLeft="5px",t.paddingRight="5px"),this.setState({buttonStyle:t})}},{key:"getHidingCss",value:function(){return".edit-post-header .editor-post-publish-button {\n\t\t\tvisibility: hidden !important;\n\t\t}"}},{key:"render",value:function(){if(!this.shouldRender())return null;var e=this.props,t=e.isSaving,n=e.isSaveable,i=e.isPostSavingLocked,l=e.isPublishable,a=t||!n||i||!l;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.Button,{onClick:this.togglePanel,isPrimary:!0,isLarge:!0,style:this.state.buttonStyle,disabled:a,isBusy:this.isSaving},Object(r.__)("Update")),this.state.isPanelOpen&&Object(o.createElement)(ee,{isBusy:this.isSaving,onClose:this.togglePanel,onSave:this.onPublish,disabled:a}),Object(o.createElement)("style",null,this.getHidingCss()))}},{key:"shouldRender",value:function(){var e=this.props,t=e.isPublished,n=e.isPublishable,o=e.isSaveable;return!!(t&&n&&o)}}]),t}(o.Component),oe=Object(P.compose)([Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isCurrentPostPublished,i=t.isEditedPostSaveable,r=t.isEditedPostPublishable,c=t.isPostSavingLocked,l=t.getCurrentPost;return{isSaving:n(),isSaveable:i(),isPostSavingLocked:c(),isPublishable:r(),isPublished:o(),hasPublishAction:Object(w.get)(l(),["_links","wp:action-publish"],!1),isFullScreen:e("core/edit-post").isFeatureActive("fullscreenMode")}}),Object(P.withGlobalEvents)({resize:"onResize"})])(ne);X()(function(){if("wp_template_part"===fullSiteEditing.editorPostType){var e=document.createElement("div");e.id="template-update-confirmation",document.getElementById("wpcontent").appendChild(e),Object(o.render)(Object(o.createElement)(oe,null),e)}});var ie=Object(P.compose)(Object(k.withSelect)(function(e){var t=e("core/editor"),n=t.getBlocks,o=t.getEditorSettings,i=e("core/edit-post").getEditorMode,r=n().find(function(e){return"a8c/post-content"===e.name});return{rootClientId:r?r.clientId:"",showInserter:"visual"===i()&&o().richEditingEnabled}}))(function(e){var t=e.rootClientId,n=e.showInserter;return Object(o.createElement)(l.Inserter,{rootClientId:t,disabled:!n,position:"bottom right"})});X()(function(){return function(){if("page"===fullSiteEditing.editorPostType)var e=setInterval(function(){var t=document.querySelector(".edit-post-header-toolbar");if(t){clearInterval(e);var n=document.createElement("div");n.classList.add("fse-post-content-block-inserter"),t.insertBefore(n,t.firstChild),Object(o.render)(Object(o.createElement)(ie,null),n)}})}()}),X()(function(){"page"===fullSiteEditing.editorPostType&&Object(k.dispatch)("core/editor").setTemplateValidity(!0)})}]));
1
+ !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}([function(e,t){e.exports=wp.element},function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.components},function(e,t){e.exports=wp.data},function(e,t){e.exports=wp.compose},function(e,t){e.exports=lodash},function(e,t){e.exports=wp.editor},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var o=n(8);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){o(e,t,n[t])})}return e}},function(e,t,n){var o;
2
  /*!
3
  Copyright (c) 2017 Jed Watson.
4
  Licensed under the MIT License (MIT), see
9
  Licensed under the MIT License (MIT), see
10
  http://jedwatson.github.io/classnames
11
  */
12
+ !function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o)&&o.length){var c=i.apply(null,o);c&&e.push(c)}else if("object"===r)for(var l in o)n.call(o,l)&&o[l]&&e.push(l)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(o=function(){return i}.apply(t,[]))||(e.exports=o)}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(e,t,n){var o=n(27),i=n(19);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var o=n(28);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}},function(e,t){e.exports=wp.url},function(e,t){e.exports=wp.domReady},function(e,t){e.exports=wp.apiFetch},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){var o=n(29),i=n(30),r=n(31);e.exports=function(e,t){return o(e)||i(e,t)||r()}},function(e,t){e.exports=wp.editPost},function(e,t,n){},function(e,t){function n(e,t,n,o,i,r,c){try{var l=e[r](c),a=l.value}catch(s){return void n(s)}l.done?t(a):Promise.resolve(a).then(o,i)}e.exports=function(e){return function(){var t=this,o=arguments;return new Promise(function(i,r){var c=e.apply(t,o);function l(e){n(c,i,r,l,a,"next",e)}function a(e){n(c,i,r,l,a,"throw",e)}l(void 0)})}}},function(e,t){e.exports=wp.plugins},function(e,t,n){},,function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=o=function(e){return n(e)}:e.exports=o=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},o(t)}e.exports=o},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var c,l=e[Symbol.iterator]();!(o=(c=l.next()).done)&&(n.push(c.value),!t||n.length!==t);o=!0);}catch(a){i=!0,r=a}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,n){},,function(e,t,n){},,function(e,t,n){},,function(e,t,n){},,,function(e,t,n){},,function(e,t,n){"use strict";n.r(t);var o=n(0),i=n(7),r=n(1),c=n(2),l=function(e){var t=e.attributes;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.ServerSideRender,{attributes:t,block:"a8c/navigation-menu"}))},a=(n(25),Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M12 7.27l4.28 10.43-3.47-1.53-.81-.36-.81.36-3.47 1.53L12 7.27M12 2L4.5 20.29l.71.71L12 18l6.79 3 .71-.71L12 2z"})));Object(i.registerBlockType)("a8c/navigation-menu",{title:Object(r.__)("Navigation Menu"),description:Object(r.__)("Visual placeholder for site-wide navigation and menus."),icon:a,category:"layout",supports:{html:!1,reusable:!1},edit:l,save:function(){return null}});var s=n(8),u=n.n(s),p=n(11),d=n.n(p),b=n(12),f=n.n(b),m=n(13),g=n.n(m),O=n(14),h=n.n(O),v=n(15),j=n.n(v),y=n(10),_=n.n(y),S=n(5),E=n(4),P=n(3),w=n(6),k=n(20),x=n.n(k),T=n(9),C=n.n(T),B=n(23),I=n.n(B),N=n(18),R=n.n(N),U=n(16),L=(n(32),Object(S.debounce)(function(){var e=I()(regeneratorRuntime.mark(function e(t,n,o){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o({loading:!0,showSuggestions:!0,suggestions:[]}),e.next=3,R()({path:Object(U.addQueryArgs)("/wp/v2/search",C()({context:"embed",per_page:20,search:t},!!n&&{subtype:n}))});case 3:i=e.sent,o({loading:!1,showSuggestions:!0,suggestions:i});case 5:case"end":return e.stop()}},e)}));return function(t,n,o){return e.apply(this,arguments)}}(),200)),A=Object(E.withState)({loading:!1,showSuggestions:!1,suggestions:[]})(function(e){var t=e.initialValue,n=e.loading,i=e.onSelectPost,l=e.postType,a=e.setState,s=e.showSuggestions,u=e.suggestions,p=Object(o.useState)(t),d=x()(p,2),b=d[0],f=d[1],m=function(e){return function(){var t=function(e,t,n){var o=e.id,i=e.title,r=e.subtype;return t({loading:!1,showSuggestions:!1,suggestions:[]}),n(i),{id:o,type:r}}(e,a,f);i(t)}};return Object(o.createElement)("div",{className:"a8c-post-autocomplete"},Object(o.createElement)(c.TextControl,{autoComplete:"off",onChange:function(e){f(e),e.length<2?a({loading:!1,showSuggestions:!1}):L(e,l,a)},placeholder:Object(r.__)("Type to search"),type:"search",value:b}),n&&Object(o.createElement)(c.Spinner,null),s&&!!u.length&&Object(o.createElement)(c.Popover,{focusOnMount:!1,noArrow:!0,position:"bottom"},Object(o.createElement)("div",{className:"a8c-post-autocomplete__suggestions"},Object(S.map)(u,function(e){return Object(o.createElement)(c.Button,{isLarge:!0,isLink:!0,key:e.id,onClick:m(e)},e.title)}))))}),M=function(e){function t(){return d()(this,t),g()(this,h()(t).apply(this,arguments))}return j()(t,e),f()(t,[{key:"toggleEditing",value:function(){var e=this.props,t=e.isEditing;(0,e.setState)({isEditing:!t})}},{key:"onSelectPost",value:function(e){var t=e.id,n=e.type;this.props.setState({isEditing:!1,selectedPostId:t,selectedPostType:n})}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.isEditing,i=e.selectedPost,l=t.align,a="wp_template"===fullSiteEditing.editorPostType,s=a&&(!n||!!i),p=a&&(n||!i),d=a&&!n&&!!i,b=!a;return Object(o.createElement)(o.Fragment,null,s&&Object(o.createElement)(w.BlockControls,null,Object(o.createElement)(c.Toolbar,null,Object(o.createElement)(c.IconButton,{className:_()("components-icon-button components-toolbar__control",{"is-active":n}),label:Object(r.__)("Change Preview"),onClick:this.toggleEditing,icon:"edit"}))),Object(o.createElement)("div",{className:_()("post-content-block",u()({},"align".concat(l),l))},Object(o.createElement)(w.PostTitle,null),b&&Object(o.createElement)(w.InnerBlocks,{templateLock:!1}),p&&Object(o.createElement)(c.Placeholder,{icon:"layout",label:Object(r.__)("Content Slot"),instructions:Object(r.__)("Placeholder for a post or a page.")},Object(o.createElement)("div",{className:"post-content-block__selector"},Object(o.createElement)("div",null,Object(r.__)("Select something to preview:")),Object(o.createElement)(A,{initialValue:Object(S.get)(i,["title","rendered"]),onSelectPost:this.onSelectPost,postType:["page","post"]}),!!i&&Object(o.createElement)("a",{href:"?post=".concat(i.id,"&action=edit")},Object(r.sprintf)(Object(r.__)('Edit "%s"'),Object(S.get)(i,["title","rendered"],""))))),d&&Object(o.createElement)(o.RawHTML,{className:"post-content-block__preview"},Object(S.get)(i,["content","rendered"]))))}}]),t}(o.Component),z=Object(E.compose)([Object(E.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(P.withSelect)(function(e,t){var n=t.selectedPostId,o=t.selectedPostType;return{selectedPost:(0,e("core").getEntityRecord)("postType",o,n)}})])(M),D="wp_template"===fullSiteEditing.editorPostType?function(){return null}:function(){return Object(o.createElement)(w.InnerBlocks.Content,null)};n(34);function F(e){var t=Object(o.useRef)();return Object(o.useEffect)(function(){t.current=e},[e]),t.current}function V(e,t,n,i,c,l){var a=Object(o.useState)({option:t,previousOption:"",loaded:!1,error:!1}),s=x()(a,2),p=s[0],d=s[1],b=F(i),f=F(c);function m(){d(C()({},p,{option:p.previousOption,isSaving:!1}))}return Object(o.useEffect)(function(){p.loaded||p.error?function(){var t=p.option,o=p.previousOption,l=t&&t.trim()===o.trim(),a=!t||0===t.trim().length;!i&&b&&a&&m();if(!c||l)return;!f&&c&&function(t){d(C()({},p,{isSaving:!0})),R()({path:"/wp/v2/settings",method:"POST",data:u()({},e,t)}).then(function(){return function(e){d(C()({},p,{previousOption:e,isDirty:!1,isSaving:!1}))}(t)}).catch(function(){n(Object(r.sprintf)(Object(r.__)("Unable to save site %s"),e)),m()})}(t)}():R()({path:"/wp/v2/settings"}).then(function(t){return d(C()({},p,{option:t[e],previousOption:t[e],loaded:!0,error:!1}))}).catch(function(){n(Object(r.sprintf)(Object(r.__)("Unable to load site %s"),e)),d(C()({},p,{option:Object(r.sprintf)(Object(r.__)("Error loading site %s"),e),error:!0}))})}),{siteOptions:p,handleChange:function(e){l({updated:Date.now()}),d(C()({},p,{option:e}))}}}Object(i.registerBlockType)("a8c/post-content",{title:Object(r.__)("Content Slot"),description:Object(r.__)("Placeholder for a post or a page."),icon:"layout",category:"layout",supports:{anchor:!0,html:!1,multiple:!1,reusable:!1},edit:z,save:D});var H=Object(E.compose)([Object(P.withDispatch)(function(e){return{createErrorNotice:e("core/notices").createErrorNotice}}),Object(P.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,i=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||o())&&!i()}})])(function(e){var t=e.className,n=e.createErrorNotice,i=e.shouldUpdateSiteOption,c=e.isSelected,l=e.setAttributes,a=V("description",Object(r.__)("Site description loading…"),n,c,i,l),s=a.siteOptions,u=a.handleChange,p=s.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(w.PlainText,{className:t,value:p,onChange:function(e){return u(e)},placeholder:Object(r.__)("Site Description"),"aria-label":Object(r.__)("Site Description")}))});n(36);Object(i.registerBlockType)("a8c/site-description",{title:Object(r.__)("Site Description"),description:Object(r.__)("Site description, also known as the tagline."),icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M4 9h16v2H4V9zm0 4h10v2H4v-2z"})),category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:H,save:function(){return null}});var q=Object(E.compose)([Object(P.withDispatch)(function(e){return{createErrorNotice:e("core/notices").createErrorNotice}}),Object(P.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,i=t.isAutosavingPost,r=t.isCurrentPostPublished;return{shouldUpdateSiteOption:(n()&&r()||o())&&!i()}})])(function(e){var t=e.className,n=e.createErrorNotice,i=e.shouldUpdateSiteOption,c=e.isSelected,l=e.setAttributes,a=V("title",Object(r.__)("Site title loading…"),n,c,i,l),s=a.siteOptions,u=a.handleChange,p=s.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(w.PlainText,{className:_()("site-title",t),value:p,onChange:function(e){return u(e)},placeholder:Object(r.__)("Site Title"),"aria-label":Object(r.__)("Site Title")}))});n(38);Object(i.registerBlockType)("a8c/site-title",{title:Object(r.__)("Site Title"),description:Object(r.__)("Your site title."),icon:"layout",category:"layout",supports:{html:!1,multiple:!1,reusable:!1},edit:q,save:function(){return null}});n(22);var Q=Object(E.compose)(Object(E.withState)({templateClientId:null}),Object(P.withSelect)(function(e,t){var n=t.attributes,o=t.templateClientId,i=e("core").getEntityRecord,r=e("core/editor").getCurrentPostId,c=e("core/block-editor").getBlock,l=n.templateId,a=r(),s=l&&i("postType","wp_template_part",l);return{currentPostId:a,editTemplatePartUrl:Object(U.addQueryArgs)(fullSiteEditing.editTemplatePartBaseUrl,{post:l,fse_parent_post:a}),template:s,templateBlock:c(o),templateTitle:Object(S.get)(s,["title","rendered"],"")}}),Object(P.withDispatch)(function(e,t){var n=e("core/block-editor").receiveBlocks,o=t.template,r=t.templateClientId,c=t.setState;return{receiveTemplateBlocks:function(){if(o&&!r){var e=Object(i.parse)(Object(S.get)(o,["content","raw"],"")),t=1===e.length?e[0]:Object(i.createBlock)("core/template",{},e);n([t]),c({templateClientId:t.clientId})}}}}))(function(e){var t=e.attributes,n=e.editTemplatePartUrl,i=e.receiveTemplateBlocks,l=e.template,a=e.templateBlock,s=e.templateTitle;if(!l)return Object(o.createElement)(c.Placeholder,null,Object(o.createElement)(c.Spinner,null));Object(o.useEffect)(function(){i()});var p=t.align;return Object(o.createElement)("div",{className:_()("template-block",u()({},"align".concat(p),p))},a&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.Disabled,null,Object(o.createElement)(w.BlockEdit,{attributes:a.attributes,block:a,clientId:a.clientId,isSelected:!1,name:a.name,setAttributes:S.noop})),Object(o.createElement)(c.Placeholder,{className:"template-block__overlay",instructions:Object(r.__)("This block is part of your site template and may appear on multiple pages.")},Object(o.createElement)(c.Button,{href:n,isDefault:!0},Object(r.sprintf)(Object(r.__)("Edit %s"),s)))))});"wp_template_part"!==fullSiteEditing.editorPostType&&Object(i.registerBlockType)("a8c/template",{title:Object(r.__)("Template Part"),description:Object(r.__)("Display a template part."),icon:"layout",category:"layout",attributes:{templateId:{type:"number"}},supports:{anchor:!0,html:!1,reusable:!1},edit:Q,save:function(){return null},getEditWrapperProps:function(){return{"data-align":"full"}}});var G=function(e){var t=e.className;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(w.BlockControls,null,Object(o.createElement)(c.Toolbar,null,Object(o.createElement)(c.IconButton,{className:"components-toolbar__control",icon:"edit",label:Object(r.__)("Edit Site Logo"),onClick:function(){var e=Object(U.addQueryArgs)("customize.php",{"autofocus[section]":"title_tagline",return:window.location.href});window.location.href=e}}))),Object(o.createElement)(c.ServerSideRender,{className:t,block:"a8c/site-logo",attributes:{editorPreview:!0}}))};n(41);Object(i.registerBlockType)("a8c/site-logo",{title:Object(r.__)("Site Logo"),description:Object(r.__)("Site Logo"),icon:"format-image",category:"layout",keywords:[Object(r.__)("logo"),Object(r.__)("icon"),Object(r.__)("site")],edit:G,save:function(){return null}});var W=n(21),Y=n(24),J=Object(E.compose)(Object(P.withDispatch)(function(e){return{setTemplateId:function(t){return e("core/editor").editPost({meta:{_wp_template_id:t}})}}}),Object(P.withSelect)(function(e){var t=e("core"),n=t.canUser,o=t.getEntityRecord,i=Object(S.get)(e("core/editor").getEditedPostAttribute("meta"),"_wp_template_id");return{canUserUpdateSettings:n("update","settings"),selectedTemplate:i&&o("postType","wp_template",i)}}))(function(e){var t=e.canUserUpdateSettings,n=e.setTemplateId,i=e.selectedTemplate;if(!t)return null;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(W.PluginSidebarMoreMenuItem,{target:"fse-template-sidebar",icon:"layout"},Object(r.__)("Template")),Object(o.createElement)(W.PluginSidebar,{icon:"layout",name:"fse-template-sidebar",title:Object(r.__)("Template")},Object(o.createElement)(c.PanelBody,null,Object(r.__)("Select a template"),Object(o.createElement)(A,{initialValue:Object(S.get)(i,["title","rendered"]),onSelectPost:function(e){var t=e.id;n(parseInt(t,10))},postType:"wp_template"}))))});"page"===fullSiteEditing.editorPostType&&Object(Y.registerPlugin)("fse-template-selector-sidebar",{render:J});var K=n(17),X=n.n(K);X()(function(){if("wp_template_part"===fullSiteEditing.editorPostType&&fullSiteEditing.closeButtonUrl)var e=setInterval(function(){var t=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");t&&(clearInterval(e),fullSiteEditing.closeButtonUrl&&(t.href=fullSiteEditing.closeButtonUrl))})});var Z=n(19),$=n.n(Z),ee=function(e){function t(){return d()(this,t),g()(this,h()(t).apply(this,arguments))}return j()(t,e),f()(t,[{key:"render",value:function(){var e=this.props,t=e.onSave,n=e.onClose,i=e.isBusy,l=e.disabled;return Object(o.createElement)("div",{className:"edit-post-layout"},Object(o.createElement)("div",{className:"editor-post-publish-panel"},Object(o.createElement)("div",{className:"editor-post-publish-panel__header"},Object(o.createElement)("div",{className:"editor-post-publish-panel__header-publish-button"},Object(o.createElement)(c.Button,{isPrimary:!0,isLarge:!0,isBusy:i,onClick:t,disabled:l},Object(r.__)("Publish")),Object(o.createElement)("span",{className:"editor-post-publish-panel__spacer"})),Object(o.createElement)(c.IconButton,{"aria-expanded":!0,onClick:n,icon:"no-alt",label:Object(r.__)("Close panel")})),Object(o.createElement)("div",{className:"editor-post-publish-panel__prepublish"},Object(o.createElement)("p",null,Object(o.createElement)("strong",null,Object(r.__)("Are you ready to publish?"))),Object(o.createElement)("p",null,Object(r.__)("Changes you publish will update all pages with this template part.")))))}}]),t}(o.Component),te={buttonStyle:{visibility:"hidden"},isPanelOpen:!1},ne=function(e){function t(e){var n;return d()(this,t),n=g()(this,h()(t).call(this,e)),u()($()(n),"onPublish",function(){n.togglePanel(),n.getOriginalButton().click()}),u()($()(n),"togglePanel",function(){n.setState({isPanelOpen:!n.state.isPanelOpen})}),n.onResize=Object(S.debounce)(n.onResize,100),n.state=te,n.onResize(),n}return j()(t,e),f()(t,[{key:"componentDidUpdate",value:function(e,t){var n=this;e.isFullScreen!==t.isFullScreen&&setTimeout(function(){return n.onResize()},1)}},{key:"getOriginalButton",value:function(){return document.querySelector(".edit-post-header .editor-post-publish-button")}},{key:"onResize",value:function(){var e=this.getOriginalButton(),t=te.buttonStyle;if(Object(S.isNil)(e)||!("getBoundingClientRect"in e))return this.setState({buttonStyle:t});var n=e.getBoundingClientRect();t={height:"33px",position:"fixed",zIndex:"10001",top:n.top,left:n.x},window.matchMedia("(min-width: 600px)").matches||(t.paddingLeft="5px",t.paddingRight="5px"),this.setState({buttonStyle:t})}},{key:"getHidingCss",value:function(){return".edit-post-header .editor-post-publish-button {\n\t\t\tvisibility: hidden !important;\n\t\t}"}},{key:"render",value:function(){if(!this.shouldRender())return null;var e=this.props,t=e.isSaving,n=e.isSaveable,i=e.isPostSavingLocked,l=e.isPublishable,a=t||!n||i||!l;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.Button,{onClick:this.togglePanel,isPrimary:!0,isLarge:!0,style:this.state.buttonStyle,disabled:a,isBusy:this.isSaving},Object(r.__)("Update")),this.state.isPanelOpen&&Object(o.createElement)(ee,{isBusy:this.isSaving,onClose:this.togglePanel,onSave:this.onPublish,disabled:a}),Object(o.createElement)("style",null,this.getHidingCss()))}},{key:"shouldRender",value:function(){var e=this.props,t=e.isPublished,n=e.isPublishable,o=e.isSaveable;return!!(t&&n&&o)}}]),t}(o.Component),oe=Object(E.compose)([Object(P.withSelect)(function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isCurrentPostPublished,i=t.isEditedPostSaveable,r=t.isEditedPostPublishable,c=t.isPostSavingLocked,l=t.getCurrentPost;return{isSaving:n(),isSaveable:i(),isPostSavingLocked:c(),isPublishable:r(),isPublished:o(),hasPublishAction:Object(S.get)(l(),["_links","wp:action-publish"],!1),isFullScreen:e("core/edit-post").isFeatureActive("fullscreenMode")}}),Object(E.withGlobalEvents)({resize:"onResize"})])(ne);X()(function(){if("wp_template_part"===fullSiteEditing.editorPostType){var e=document.createElement("div");e.id="template-update-confirmation",document.getElementById("wpcontent").appendChild(e),Object(o.render)(Object(o.createElement)(oe,null),e)}});var ie=Object(E.compose)(Object(P.withSelect)(function(e){var t=e("core/editor"),n=t.getBlocks,o=t.getEditorSettings,i=e("core/edit-post").getEditorMode,r=n().find(function(e){return"a8c/post-content"===e.name});return{rootClientId:r?r.clientId:"",showInserter:"visual"===i()&&o().richEditingEnabled}}))(function(e){var t=e.rootClientId,n=e.showInserter;return Object(o.createElement)(w.Inserter,{rootClientId:t,disabled:!n,position:"bottom right"})});X()(function(){return function(){if("page"===fullSiteEditing.editorPostType)var e=setInterval(function(){var t=document.querySelector(".edit-post-header-toolbar");if(t){clearInterval(e);var n=document.createElement("div");n.classList.add("fse-post-content-block-inserter"),t.insertBefore(n,t.firstChild),Object(o.render)(Object(o.createElement)(ie,null),n)}})}()});var re=Object(P.subscribe)(function(){if("page"!==fullSiteEditing.editorPostType)return re();!1===Object(P.select)("core/editor").isValidTemplate()&&(Object(P.dispatch)("core/editor").setTemplateValidity(!0),re())})}]));
full-site-editing/editor/template-validity-override/index.js CHANGED
@@ -3,8 +3,7 @@
3
  /**
4
  * External dependencies
5
  */
6
- import domReady from '@wordpress/dom-ready';
7
- import { dispatch } from '@wordpress/data';
8
 
9
  /**
10
  * Forces the template validity.
@@ -14,12 +13,13 @@ import { dispatch } from '@wordpress/data';
14
  *
15
  * @see https://github.com/WordPress/gutenberg/issues/11681
16
  */
17
- function resetTemplateValidity() {
18
  if ( 'page' !== fullSiteEditing.editorPostType ) {
19
- return;
20
  }
21
-
22
- dispatch( 'core/editor' ).setTemplateValidity( true );
23
- }
24
-
25
- domReady( () => resetTemplateValidity() );
 
3
  /**
4
  * External dependencies
5
  */
6
+ import { select, dispatch, subscribe } from '@wordpress/data';
 
7
 
8
  /**
9
  * Forces the template validity.
13
  *
14
  * @see https://github.com/WordPress/gutenberg/issues/11681
15
  */
16
+ const unsubscribe = subscribe( () => {
17
  if ( 'page' !== fullSiteEditing.editorPostType ) {
18
+ return unsubscribe();
19
  }
20
+ if ( select( 'core/editor' ).isValidTemplate() === false ) {
21
+ dispatch( 'core/editor' ).setTemplateValidity( true );
22
+ // should only need to do this once
23
+ unsubscribe();
24
+ }
25
+ } );
full-site-editing/utils/class-a8c-wp-template.php CHANGED
@@ -25,6 +25,13 @@ class A8C_WP_Template {
25
  */
26
  private $template_id;
27
 
 
 
 
 
 
 
 
28
 
29
  /**
30
  * A8C_WP_Template constructor.
@@ -33,11 +40,18 @@ class A8C_WP_Template {
33
  */
34
  public function __construct( $post_id = null ) {
35
  if ( null === $post_id ) {
36
- $post_id = get_post()->ID;
 
 
 
 
 
 
37
  }
38
 
39
- $this->current_post_id = $post_id;
40
- $this->template_id = $this->get_template_id();
 
41
  }
42
 
43
  /**
@@ -59,8 +73,10 @@ class A8C_WP_Template {
59
  return $template_id;
60
  }
61
 
62
- // Otherwise, fall back to latest global page template.
63
- $term = get_term_by( 'name', 'page_template', 'wp_template_type', ARRAY_A );
 
 
64
 
65
  if ( ! isset( $term['term_id'] ) ) {
66
  return null;
@@ -125,7 +141,7 @@ class A8C_WP_Template {
125
 
126
  $header_id = $template_blocks[0]['attrs']['templateId'];
127
 
128
- if ( ! has_term( 'header', 'wp_template_part_type', $header_id ) ) {
129
  return null;
130
  }
131
 
@@ -149,7 +165,7 @@ class A8C_WP_Template {
149
 
150
  $footer_id = end( $template_blocks )['attrs']['templateId'];
151
 
152
- if ( ! has_term( 'footer', 'wp_template_part_type', $footer_id ) ) {
153
  return null;
154
  }
155
 
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.
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
  /**
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;
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
 
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
 
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.2.2
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -40,6 +40,9 @@ This plugin is experimental, so we don't provide any support for it outside of w
40
 
41
  == Changelog ==
42
 
 
 
 
43
  = 0.3 =
44
  * Update modal UI.
45
 
3
  Tags: block, blocks, editor, gutenberg, page
4
  Requires at least: 5.0
5
  Tested up to: 5.2
6
+ Stable tag: 0.4
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.4 =
44
+ * Move template data initialization out of the plugin and delegate it to themes.
45
+
46
  = 0.3 =
47
  * Update modal UI.
48
 
starter-page-templates/dist/starter-page-templates.css CHANGED
@@ -1 +1 @@
1
- .page-template-modal-screen-overlay{background-color:rgba(0,0,0,.7);animation:none}@media screen and (min-width:783px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{left:36px}}@media screen and (min-width:961px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{left:160px}}body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:46px}@media screen and (min-width:783px){body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:32px}}.page-template-modal{width:100%;height:100vh;max-width:800px;animation:none}.page-template-modal .components-modal__header-heading-container{justify-content:center}.page-template-modal .components-modal__content{overflow-y:scroll;-webkit-overflow-scrolling:touch}.page-template-modal__inner{max-width:720px;margin:0 auto;padding:0}@media screen and (max-width:659px){.page-template-modal__inner{padding-bottom:3em}}.page-template-modal__list .components-base-control__label{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.page-template-modal__list .template-selector-control__options{display:grid;grid-template-columns:1fr 1fr;grid-gap:1.75em}@media screen and (min-width:660px){.page-template-modal__list .template-selector-control__options{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}}.page-template-modal__list .template-selector-control__option{margin-bottom:4px}.page-template-modal__list .template-selector-control__label{display:block;width:100%;font-size:14px;text-align:center;border:1px solid #a1aab2;border-radius:6px;cursor:pointer;background:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0 0 14px;overflow:hidden}.page-template-modal__list .template-selector-control__label:focus,.page-template-modal__list .template-selector-control__label:hover{border-color:#2562b7;box-shadow:0 0 0 1px #2562b7;outline:1px solid transparent;outline-offset:-1px}.page-template-modal__list .template-selector-control__media-wrap{width:100%;display:block;margin:0 auto 14px;border-bottom:1px solid #a1aab2;background:#f6f6f6;border-radius:0;overflow:hidden;padding-bottom:110%;box-sizing:content-box;position:relative;pointer-events:none}.page-template-modal__list .template-selector-control__media{width:100%;display:block;position:absolute;top:0;left:0}.page-template-modal__actions{display:flex;flex-direction:column;align-items:center}@media screen and (min-width:960px){.page-template-modal__actions{flex-direction:row;justify-content:flex-end}}@media screen and (max-width:960px){.page-template-modal__action{margin-bottom:1em}}@media screen and (min-width:960px){.page-template-modal__action-use{margin-right:1em}}
1
+ .page-template-modal-screen-overlay{animation:none}@media screen and (min-width:783px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{left:36px}}@media screen and (min-width:961px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{left:160px}}body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:46px}@media screen and (min-width:783px){body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:32px}}.page-template-modal{width:100%;height:100vh;max-width:800px;animation:none}.page-template-modal .components-modal__header-heading-container{justify-content:center}.page-template-modal .components-modal__content{overflow-y:scroll;-webkit-overflow-scrolling:touch}.page-template-modal__inner{max-width:720px;margin:0 auto;padding:0}@media screen and (max-width:659px){.page-template-modal__inner{padding-bottom:3em}}.page-template-modal__list .components-base-control__label{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.page-template-modal__list .template-selector-control__options{display:grid;grid-template-columns:1fr 1fr;grid-gap:1.75em}@media screen and (min-width:660px){.page-template-modal__list .template-selector-control__options{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}}.page-template-modal__list .template-selector-control__option{margin-bottom:4px}.page-template-modal__list .template-selector-control__label{display:block;width:100%;font-size:14px;text-align:center;border:1px solid #a1aab2;border-radius:6px;cursor:pointer;background:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0 0 14px;overflow:hidden}.page-template-modal__list .template-selector-control__label:focus,.page-template-modal__list .template-selector-control__label:hover{border-color:#2562b7;box-shadow:0 0 0 1px #2562b7;outline:1px solid transparent;outline-offset:-1px}.page-template-modal__list .template-selector-control__media-wrap{width:100%;display:block;margin:0 auto 14px;border-bottom:1px solid #a1aab2;background:#f6f6f6;border-radius:0;overflow:hidden;padding-bottom:110%;box-sizing:content-box;position:relative;pointer-events:none}.page-template-modal__list .template-selector-control__media{width:100%;display:block;position:absolute;top:0;left:0}.page-template-modal__actions{display:flex;flex-direction:column;align-items:center}@media screen and (min-width:960px){.page-template-modal__actions{flex-direction:row;justify-content:flex-end}}@media screen and (max-width:960px){.page-template-modal__action{margin-bottom:1em}}@media screen and (min-width:960px){.page-template-modal__action-use{margin-right:1em}}
starter-page-templates/dist/starter-page-templates.js CHANGED
@@ -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 r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o)&&o.length){var l=r.apply(null,o);l&&e.push(l)}else if("object"===i)for(var c in o)n.call(o,c)&&o[c]&&e.push(c)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=o=function(e){return n(e)}:e.exports=o=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},o(t)}e.exports=o},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t){e.exports=wp.nux},function(e,t,n){},,function(e,t,n){"use strict";n.r(t);var o=n(7),r=n.n(o),i=n(9),l=n.n(i),c=n(10),a=n.n(c),s=n(11),u=n.n(s),p=n(12),f=n.n(p),m=n(4),d=n.n(m),b=n(13),v=n.n(b),y=n(3),_=n.n(y),g=n(0),O=n(2),j=n(1),w=n(5),h=n(6),x=n(14),P=n(8),S=n(15),E=(n(19),{Address:Object(j._x)("123 Main St","default address","full-site-editing"),Phone:Object(j._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(j._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(j._x)("Business","default vertical name","full-site-editing")}),k={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},C=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.replace(/{{(\w+)}}/g,function(e,n){var o=E[n];return t[k[n]]||o||n})},N=(n(20),n(16)),T=n.n(N);var M=Object(w.withInstanceId)(function(e){var t=e.label,n=e.className,o=e.help,r=e.instanceId,i=e.onClick,l=e.templates,c=void 0===l?[]:l,a="template-selector-control-".concat(r),s=function(e){return i(e.target.value)};return Object(O.isEmpty)(c)?null:Object(g.createElement)(h.BaseControl,{label:t,id:a,help:o,className:T()(n,"template-selector-control")},Object(g.createElement)("ul",{className:"template-selector-control__options"},c.map(function(e,t){return Object(g.createElement)("li",{key:"".concat(a,"-").concat(t),className:"template-selector-control__option"},Object(g.createElement)("button",{type:"button",id:"".concat(a,"-").concat(t),className:"template-selector-control__label",value:e.value,onClick:s,"aria-describedby":o?"".concat(a,"__help"):void 0},Object(g.createElement)("div",{className:"template-selector-control__media-wrap"},e.preview&&Object(g.createElement)("img",{className:"template-selector-control__media",src:e.preview,alt:e.previewAlt||""})),e.label))})))});window._tkq=window._tkq||[];var I,q=null,A=function(e,t){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:q.blogid,segment_id:e,vertical_id:t}])},B=function(e,t,n){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:q.blogid,segment_id:e,vertical_id:t,template:n}])},D=function(e){function t(e){var n;return l()(this,t),n=u()(this,f()(t).call(this)),_()(d()(n),"state",{isLoading:!1}),_()(d()(n),"selectTemplate",function(e){n.setState({isOpen:!1}),B(n.props.segment.id,n.props.vertical.id,e);var t=n.props.templates[e];if(n.props.saveTemplateChoice(t),Object(O.has)(t,"content")){var o=r()({},t,{title:C(t.title,n.props.siteInformation),content:C(t.content,n.props.siteInformation)});n.props.insertTemplate(o)}}),_()(d()(n),"closeModal",function(){n.setState({isOpen:!1}),A(n.props.segment.id,n.props.vertical.id)}),n.state.isOpen=!Object(O.isEmpty)(e.templates),n}return v()(t,e),a()(t,[{key:"componentDidMount",value:function(){var e,t;this.state.isOpen&&(e=this.props.segment.id,t=this.props.vertical.id,q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:q.blogid,segment_id:e,vertical_id:t}]))}},{key:"render",value:function(){var e=this;return this.state.isOpen?Object(g.createElement)(h.Modal,{title:Object(j.__)("Select Page Template","full-site-editing"),onRequestClose:this.closeModal,className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay"},Object(g.createElement)("div",{className:"page-template-modal__inner"},Object(g.createElement)("form",{className:"page-template-modal__form"},Object(g.createElement)("fieldset",{className:"page-template-modal__list"},Object(g.createElement)(M,{label:Object(j.__)("Template","full-site-editing"),templates:Object(O.map)(this.props.templates,function(e){return{label:e.title,value:e.slug,preview:e.preview,previewAlt:e.description}}),onClick:function(t){return e.selectTemplate(t)}}))))):null}}]),t}(g.Component),R=Object(w.compose)(Object(P.withSelect)(function(e){return{getMeta:function(){return e("core/editor").getEditedPostAttribute("meta")},postContentBlock:e("core/editor").getBlocks().find(function(e){return"a8c/post-content"===e.name})}}),Object(P.withDispatch)(function(e,t){e("core/nux").disableTips();var n=e("core/editor");return{saveTemplateChoice:function(e){var o=t.getMeta();n.editPost({meta:r()({},o,{_starter_page_template:e.slug})})},insertTemplate:function(e){n.editPost({title:e.title});var o=t.postContentBlock,r=Object(S.parse)(e.content);n.insertBlocks(r,0,o?o.clientId:"")}}}))(D),U=window.starterPageTemplatesConfig,V=U.siteInformation,L=void 0===V?{}:V,Y=U.templates,z=void 0===Y?[]:Y,F=U.vertical,G=U.segment,H=U.tracksUserData;H&&(q=I=H,window._tkq.push(["identifyUser",I.userid,I.username])),Object(x.registerPlugin)("page-templates",{render:function(){return Object(g.createElement)(R,{templates:Object(O.keyBy)(z,"slug"),vertical:F,segment:G,siteInformation:L})}})}]));
9
  Licensed under the MIT License (MIT), see
10
  http://jedwatson.github.io/classnames
11
  */
12
+ !function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o)&&o.length){var l=r.apply(null,o);l&&e.push(l)}else if("object"===i)for(var c in o)n.call(o,c)&&o[c]&&e.push(c)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=o=function(e){return n(e)}:e.exports=o=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},o(t)}e.exports=o},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t){e.exports=wp.nux},function(e,t,n){},,function(e,t,n){"use strict";n.r(t);var o=n(7),r=n.n(o),i=n(9),l=n.n(i),c=n(10),a=n.n(c),s=n(11),u=n.n(s),p=n(12),f=n.n(p),m=n(4),d=n.n(m),b=n(13),v=n.n(b),y=n(3),_=n.n(y),g=n(0),O=n(2),j=n(1),w=n(5),h=n(6),x=n(14),P=n(8),S=n(15),E=(n(19),{Address:Object(j._x)("123 Main St","default address","full-site-editing"),Phone:Object(j._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(j._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(j._x)("Business","default vertical name","full-site-editing")}),k={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},C=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.replace(/{{(\w+)}}/g,function(e,n){var o=E[n];return t[k[n]]||o||n})},N=(n(20),n(16)),T=n.n(N);var M=Object(w.withInstanceId)(function(e){var t=e.label,n=e.className,o=e.help,r=e.instanceId,i=e.onClick,l=e.templates,c=void 0===l?[]:l,a="template-selector-control-".concat(r),s=function(e){return i(e.target.value)};return Object(O.isEmpty)(c)?null:Object(g.createElement)(h.BaseControl,{label:t,id:a,help:o,className:T()(n,"template-selector-control")},Object(g.createElement)("ul",{className:"template-selector-control__options"},c.map(function(e,t){return Object(g.createElement)("li",{key:"".concat(a,"-").concat(t),className:"template-selector-control__option"},Object(g.createElement)("button",{type:"button",id:"".concat(a,"-").concat(t),className:"template-selector-control__label",value:e.value,onClick:s,"aria-describedby":o?"".concat(a,"__help"):void 0},Object(g.createElement)("div",{className:"template-selector-control__media-wrap"},e.preview&&Object(g.createElement)("img",{className:"template-selector-control__media",src:e.preview,alt:e.previewAlt||""})),e.label))})))});window._tkq=window._tkq||[];var I,q=null,A=function(e,t){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:q.blogid,segment_id:e,vertical_id:t}])},B=function(e,t,n){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:q.blogid,segment_id:e,vertical_id:t,template:n}])},D=function(e){function t(e){var n;return l()(this,t),n=u()(this,f()(t).call(this)),_()(d()(n),"state",{isLoading:!1}),_()(d()(n),"selectTemplate",function(e){n.setState({isOpen:!1}),B(n.props.segment.id,n.props.vertical.id,e);var t=n.props.templates[e];if(n.props.saveTemplateChoice(t),Object(O.has)(t,"content")){var o=r()({},t,{title:C(t.title,n.props.siteInformation),content:C(t.content,n.props.siteInformation)});n.props.insertTemplate(o)}}),_()(d()(n),"closeModal",function(){n.setState({isOpen:!1}),A(n.props.segment.id,n.props.vertical.id)}),n.state.isOpen=!Object(O.isEmpty)(e.templates),n}return v()(t,e),a()(t,[{key:"componentDidMount",value:function(){var e,t;this.state.isOpen&&(e=this.props.segment.id,t=this.props.vertical.id,q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:q.blogid,segment_id:e,vertical_id:t}]))}},{key:"render",value:function(){var e=this;return this.state.isOpen?Object(g.createElement)(h.Modal,{title:Object(j.__)("Select Page Template","full-site-editing"),onRequestClose:this.closeModal,className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay"},Object(g.createElement)("div",{className:"page-template-modal__inner"},Object(g.createElement)("form",{className:"page-template-modal__form"},Object(g.createElement)("fieldset",{className:"page-template-modal__list"},Object(g.createElement)(M,{label:Object(j.__)("Template","full-site-editing"),templates:Object(O.map)(this.props.templates,function(e){return{label:e.title,value:e.slug,preview:e.preview,previewAlt:e.description}}),onClick:function(t){return e.selectTemplate(t)}}))))):null}}]),t}(g.Component),R=Object(w.compose)(Object(P.withSelect)(function(e){return{getMeta:function(){return e("core/editor").getEditedPostAttribute("meta")},postContentBlock:e("core/editor").getBlocks().find(function(e){return"a8c/post-content"===e.name})}}),Object(P.withDispatch)(function(e,t){e("core/nux").disableTips();var n=e("core/editor");return{saveTemplateChoice:function(e){var o=t.getMeta();n.editPost({meta:r()({},o,{_starter_page_template:e.slug})})},insertTemplate:function(e){n.editPost({title:e.title});var o=t.postContentBlock,r=Object(S.parse)(e.content);n.insertBlocks(r,0,o?o.clientId:"",!1)}}}))(D),U=window.starterPageTemplatesConfig,V=U.siteInformation,L=void 0===V?{}:V,Y=U.templates,z=void 0===Y?[]:Y,F=U.vertical,G=U.segment,H=U.tracksUserData;H&&(q=I=H,window._tkq.push(["identifyUser",I.userid,I.username])),Object(x.registerPlugin)("page-templates",{render:function(){return Object(g.createElement)(R,{templates:Object(O.keyBy)(z,"slug"),vertical:F,segment:G,siteInformation:L})}})}]));
starter-page-templates/dist/starter-page-templates.rtl.css CHANGED
@@ -1 +1 @@
1
- .page-template-modal-screen-overlay{background-color:rgba(0,0,0,.7);animation:none}@media screen and (min-width:783px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{right:36px}}@media screen and (min-width:961px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{right:160px}}body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:46px}@media screen and (min-width:783px){body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:32px}}.page-template-modal{width:100%;height:100vh;max-width:800px;animation:none}.page-template-modal .components-modal__header-heading-container{justify-content:center}.page-template-modal .components-modal__content{overflow-y:scroll;-webkit-overflow-scrolling:touch}.page-template-modal__inner{max-width:720px;margin:0 auto;padding:0}@media screen and (max-width:659px){.page-template-modal__inner{padding-bottom:3em}}.page-template-modal__list .components-base-control__label{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.page-template-modal__list .template-selector-control__options{display:grid;grid-template-columns:1fr 1fr;grid-gap:1.75em}@media screen and (min-width:660px){.page-template-modal__list .template-selector-control__options{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}}.page-template-modal__list .template-selector-control__option{margin-bottom:4px}.page-template-modal__list .template-selector-control__label{display:block;width:100%;font-size:14px;text-align:center;border:1px solid #a1aab2;border-radius:6px;cursor:pointer;background:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0 0 14px;overflow:hidden}.page-template-modal__list .template-selector-control__label:focus,.page-template-modal__list .template-selector-control__label:hover{border-color:#2562b7;box-shadow:0 0 0 1px #2562b7;outline:1px solid transparent;outline-offset:-1px}.page-template-modal__list .template-selector-control__media-wrap{width:100%;display:block;margin:0 auto 14px;border-bottom:1px solid #a1aab2;background:#f6f6f6;border-radius:0;overflow:hidden;padding-bottom:110%;box-sizing:content-box;position:relative;pointer-events:none}.page-template-modal__list .template-selector-control__media{width:100%;display:block;position:absolute;top:0;right:0}.page-template-modal__actions{display:flex;flex-direction:column;align-items:center}@media screen and (min-width:960px){.page-template-modal__actions{flex-direction:row;justify-content:flex-end}}@media screen and (max-width:960px){.page-template-modal__action{margin-bottom:1em}}@media screen and (min-width:960px){.page-template-modal__action-use{margin-left:1em}}
1
+ .page-template-modal-screen-overlay{animation:none}@media screen and (min-width:783px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{right:36px}}@media screen and (min-width:961px){body:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{right:160px}}body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:46px}@media screen and (min-width:783px){body.admin-bar:not(.is-fullscreen-mode) .page-template-modal-screen-overlay{top:32px}}.page-template-modal{width:100%;height:100vh;max-width:800px;animation:none}.page-template-modal .components-modal__header-heading-container{justify-content:center}.page-template-modal .components-modal__content{overflow-y:scroll;-webkit-overflow-scrolling:touch}.page-template-modal__inner{max-width:720px;margin:0 auto;padding:0}@media screen and (max-width:659px){.page-template-modal__inner{padding-bottom:3em}}.page-template-modal__list .components-base-control__label{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.page-template-modal__list .template-selector-control__options{display:grid;grid-template-columns:1fr 1fr;grid-gap:1.75em}@media screen and (min-width:660px){.page-template-modal__list .template-selector-control__options{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}}.page-template-modal__list .template-selector-control__option{margin-bottom:4px}.page-template-modal__list .template-selector-control__label{display:block;width:100%;font-size:14px;text-align:center;border:1px solid #a1aab2;border-radius:6px;cursor:pointer;background:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0 0 14px;overflow:hidden}.page-template-modal__list .template-selector-control__label:focus,.page-template-modal__list .template-selector-control__label:hover{border-color:#2562b7;box-shadow:0 0 0 1px #2562b7;outline:1px solid transparent;outline-offset:-1px}.page-template-modal__list .template-selector-control__media-wrap{width:100%;display:block;margin:0 auto 14px;border-bottom:1px solid #a1aab2;background:#f6f6f6;border-radius:0;overflow:hidden;padding-bottom:110%;box-sizing:content-box;position:relative;pointer-events:none}.page-template-modal__list .template-selector-control__media{width:100%;display:block;position:absolute;top:0;right:0}.page-template-modal__actions{display:flex;flex-direction:column;align-items:center}@media screen and (min-width:960px){.page-template-modal__actions{flex-direction:row;justify-content:flex-end}}@media screen and (max-width:960px){.page-template-modal__action{margin-bottom:1em}}@media screen and (min-width:960px){.page-template-modal__action-use{margin-left:1em}}
starter-page-templates/page-template-modal/index.js CHANGED
@@ -129,7 +129,8 @@ const PageTemplatesPlugin = compose(
129
  editorDispatcher.insertBlocks(
130
  blocks,
131
  0,
132
- postContentBlock ? postContentBlock.clientId : ''
 
133
  );
134
  },
135
  };
129
  editorDispatcher.insertBlocks(
130
  blocks,
131
  0,
132
+ postContentBlock ? postContentBlock.clientId : '',
133
+ false
134
  );
135
  },
136
  };
starter-page-templates/page-template-modal/styles/starter-page-templates-editor.scss CHANGED
@@ -13,7 +13,6 @@
13
 
14
  // Modal Overlay
15
  .page-template-modal-screen-overlay {
16
- background-color: hsla( 0, 0%, 0%, 0.7 );
17
  animation: none;
18
  }
19
 
13
 
14
  // Modal Overlay
15
  .page-template-modal-screen-overlay {
 
16
  animation: none;
17
  }
18