Full Site Editing - Version 0.14

Version Description

  • Stop using theme classes for template parts to improve support for FSE blocks' style attributes.
Download this release

Release Info

Developer Copons
Plugin Icon wp plugin Full Site Editing
Version 0.14
Comparing to
See all releases

Code changes from version 0.13 to 0.14

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.13
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.13' );
24
25
// Themes which are supported by Full Site Editing (not the same as the SPT themes).
26
const SUPPORTED_THEMES = [ 'maywood' ];
@@ -153,7 +153,7 @@ add_action( 'plugins_loaded', __NAMESPACE__ . '\load_posts_list_block' );
153
*/
154
function load_starter_page_templates() {
155
// We don't want the user to choose a template when copying a post.
156
- // phpcs:ignore WordPress.Security.NonceVerification.Recommended
157
if ( isset( $_GET['jetpack-copy'] ) ) {
158
return;
159
}
@@ -216,6 +216,11 @@ function enqueue_coblocks_gallery_scripts() {
216
return;
217
}
218
219
$template = new WP_Template();
220
$header = $template->get_template_content( 'header' );
221
$footer = $template->get_template_content( 'footer' );
2
/**
3
* Plugin Name: Full Site Editing
4
* Description: Enhances your page creation workflow within the Block Editor.
5
+ * Version: 0.14
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.14' );
24
25
// Themes which are supported by Full Site Editing (not the same as the SPT themes).
26
const SUPPORTED_THEMES = [ 'maywood' ];
153
*/
154
function load_starter_page_templates() {
155
// We don't want the user to choose a template when copying a post.
156
+ // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
157
if ( isset( $_GET['jetpack-copy'] ) ) {
158
return;
159
}
216
return;
217
}
218
219
+ // This happens in the Customizer because we try very hard not to load things and we get a fatal
220
+ // https://github.com/Automattic/wp-calypso/issues/36680.
221
+ if ( ! class_exists( '\A8C\FSE\WP_Template' ) ) {
222
+ require_once __DIR__ . '/full-site-editing/templates/class-wp-template.php';
223
+ }
224
$template = new WP_Template();
225
$header = $template->get_template_content( 'header' );
226
$footer = $template->get_template_content( 'footer' );
full-site-editing/blocks/navigation-menu/index.php CHANGED
@@ -16,16 +16,18 @@ namespace A8C\FSE;
16
function render_navigation_menu_block( $attributes ) {
17
$styles = '';
18
19
- $class = 'menu-primary-container';
20
if ( isset( $attributes['className'] ) ) {
21
- $class .= ' ' . $attributes['className'];
22
}
23
24
$align = ' alignwide';
25
if ( isset( $attributes['align'] ) ) {
26
$align = empty( $attributes['align'] ) ? '' : ' align' . $attributes['align'];
27
}
28
- $class .= $align;
29
30
if ( isset( $attributes['textAlign'] ) ) {
31
$class .= ' has-text-align-' . $attributes['textAlign'];
@@ -57,6 +59,9 @@ function render_navigation_menu_block( $attributes ) {
57
$class .= ' has-small-font-size';
58
}
59
60
$menu = wp_nav_menu(
61
[
62
'echo' => false,
@@ -73,14 +78,14 @@ function render_navigation_menu_block( $attributes ) {
73
?>
74
<nav class="main-navigation wp-block-a8c-navigation-menu<?php echo esc_attr( $align ); ?>">
75
<input type="checkbox" role="button" aria-haspopup="true" id="toggle" class="hide-visually">
76
- <label for="toggle" id="toggle-menu" class="button">
77
<?php esc_html_e( 'Menu', 'full-site-editing' ); ?>
78
<span class="dropdown-icon open">+</span>
79
<span class="dropdown-icon close">&times;</span>
80
<span class="hide-visually expanded-text"><?php esc_html_e( 'expanded', 'full-site-editing' ); ?></span>
81
<span class="hide-visually collapsed-text"><?php esc_html_e( 'collapsed', 'full-site-editing' ); ?></span>
82
</label>
83
- <div class="<?php echo esc_attr( $class ); ?>" style="<?php echo esc_attr( $styles ); ?>">
84
<?php echo $menu ? $menu : get_fallback_navigation_menu(); ?>
85
</div>
86
</nav>
16
function render_navigation_menu_block( $attributes ) {
17
$styles = '';
18
19
+ $container_class = 'menu-primary-container';
20
+ $toggle_class = 'button';
21
if ( isset( $attributes['className'] ) ) {
22
+ $container_class .= ' ' . $attributes['className'];
23
+ $toggle_class .= ' ' . $attributes['className'];
24
}
25
26
$align = ' alignwide';
27
if ( isset( $attributes['align'] ) ) {
28
$align = empty( $attributes['align'] ) ? '' : ' align' . $attributes['align'];
29
}
30
+ $class = $align;
31
32
if ( isset( $attributes['textAlign'] ) ) {
33
$class .= ' has-text-align-' . $attributes['textAlign'];
59
$class .= ' has-small-font-size';
60
}
61
62
+ $container_class .= $class;
63
+ $toggle_class .= $class;
64
+
65
$menu = wp_nav_menu(
66
[
67
'echo' => false,
78
?>
79
<nav class="main-navigation wp-block-a8c-navigation-menu<?php echo esc_attr( $align ); ?>">
80
<input type="checkbox" role="button" aria-haspopup="true" id="toggle" class="hide-visually">
81
+ <label for="toggle" id="toggle-menu" class="<?php echo esc_attr( $toggle_class ); ?>" style="<?php echo esc_attr( $styles ); ?>">
82
<?php esc_html_e( 'Menu', 'full-site-editing' ); ?>
83
<span class="dropdown-icon open">+</span>
84
<span class="dropdown-icon close">&times;</span>
85
<span class="hide-visually expanded-text"><?php esc_html_e( 'expanded', 'full-site-editing' ); ?></span>
86
<span class="hide-visually collapsed-text"><?php esc_html_e( 'collapsed', 'full-site-editing' ); ?></span>
87
</label>
88
+ <div class="<?php echo esc_attr( $container_class ); ?>" style="<?php echo esc_attr( $styles ); ?>">
89
<?php echo $menu ? $menu : get_fallback_navigation_menu(); ?>
90
</div>
91
</nav>
full-site-editing/blocks/post-content/style.scss CHANGED
@@ -57,7 +57,14 @@
57
}
58
}
59
60
- /* Hide the content slot block UI */
61
.block-editor-block-list__layout {
62
.post-content__block {
63
&.is-selected {
57
}
58
}
59
60
+ /**
61
+ * Hide the content slot block UI
62
+ *
63
+ * @TODO: Remove this once Gutenberg gets support for hiding block UI.
64
+ *
65
+ * @see https://github.com/WordPress/gutenberg/issues/7469
66
+ * @see https://github.com/WordPress/gutenberg/pull/18173
67
+ */
68
.block-editor-block-list__layout {
69
.post-content__block {
70
&.is-selected {
full-site-editing/blocks/template/index.js CHANGED
@@ -17,12 +17,14 @@ import './site-logo';
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: {
24
templateId: { type: 'number' },
25
className: { type: 'string' },
26
},
27
supports: {
28
anchor: false,
17
if ( 'wp_template_part' !== fullSiteEditing.editorPostType ) {
18
registerBlockType( 'a8c/template', {
19
title: __( 'Template Part' ),
20
+ __experimentalDisplayName: 'label',
21
description: __( 'Display a Template Part.' ),
22
icon: 'layout',
23
category: 'layout',
24
attributes: {
25
templateId: { type: 'number' },
26
className: { type: 'string' },
27
+ label: { type: 'string' },
28
},
29
supports: {
30
anchor: false,
full-site-editing/dist/full-site-editing.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-server-side-render', 'wp-url'), 'version' => '1ecf08ae71136d4a3598c69840c29f72');
1
+ <?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-server-side-render', 'wp-url'), 'version' => 'e334794f9b46e614735ba91ad5784ed7');
full-site-editing/dist/full-site-editing.js CHANGED
@@ -3,4 +3,4 @@
3
Copyright (c) 2017 Jed Watson.
4
Licensed under the MIT License (MIT), see
5
http://jedwatson.github.io/classnames
6
- */!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var o=arguments[e];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)&&o.length){var c=r.apply(null,o);c&&t.push(c)}else if("object"===i)for(var l in o)n.call(o,l)&&o[l]&&t.push(l)}}return t.join(" ")}t.exports?(r.default=r,t.exports=r):void 0===(o=function(){return r}.apply(e,[]))||(t.exports=o)}()},function(t,e){!function(){t.exports=this.wp.hooks}()},function(t,e){!function(){t.exports=this.wp.domReady}()},function(t,e,n){var o=n(33),r=n(34),i=n(35);t.exports=function(t,e){return o(t)||r(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 o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}t.exports=function(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}},function(t,e,n){var o=n(29),r=n(30);t.exports=function(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?r(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 o=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&&o(t,e)}},function(t,e){!function(){t.exports=this.wp.editor}()},function(t,e){!function(){t.exports=this.wp.url}()},function(t,e,n){var o=n(38),r=n(39),i=n(40);t.exports=function(t){return o(t)||r(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 o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(t){return n(t)}:t.exports=o=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},o(e)}t.exports=o},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,o){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,o)}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){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],o=!0,r=!1,i=void 0;try{for(var c,l=t[Symbol.iterator]();!(o=(c=l.next()).done)&&(n.push(c.value),!e||n.length!==e);o=!0);}catch(a){r=!0,i=a}finally{try{o||null==l.return||l.return()}finally{if(r)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 o=n(0),r=n(7),i=n(1),c=n(10),l=n.n(c),a=n(18),s=n.n(a),u=n(4),p=n(2),d=n(8),f=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize")])((function(t){var e=t.attributes,n=t.backgroundColor,r=t.fontSize,c=t.setAttributes,a=t.setBackgroundColor,u=t.setFontSize,f=t.setTextColor,b=t.textColor,m=e.customFontSize,g=e.textAlign,O=m||r.size;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:g,onChange:function(t){c({textAlign:t})}})),Object(o.createElement)(p.InspectorControls,null,Object(o.createElement)(d.PanelBody,{className:"blocks-font-size",title:Object(i.__)("Text Settings")},Object(o.createElement)(p.FontSizePicker,{onChange:u,value:O})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:n.color,onChange:a,label:Object(i.__)("Background Color")},{value:b.color,onChange:f,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:b.color,backgroundColor:n.color},{fontSize:O})))),Object(o.createElement)(s.a,{block:"a8c/navigation-menu",attributes:e}))})),b=(n(28),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(r.registerBlockType)("a8c/navigation-menu",{title:Object(i.__)("Navigation Menu"),description:Object(i.__)("Visual placeholder for site-wide navigation and menus."),icon:b,category:"layout",supports:{align:["wide","full"],html:!1,reusable:!1},edit:f,save:function(){return null}});var m=n(12),g=n(5),O=n.n(g),j=n(19),h=n.n(j),v=n(20),y=n.n(v),S=n(21),_=n.n(S),E=n(22),k=n.n(E),w=n(23),C=n.n(w),x=n(11),P=n.n(x),T=n(3),B=n(24),I=function(t){function e(){return h()(this,e),_()(this,k()(e).apply(this,arguments))}return C()(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(o.createElement)(o.Fragment,null,Object(o.createElement)("div",{className:P()("post-content-block",O()({},"align".concat(t),t))},Object(o.createElement)(B.PostTitle,null),Object(o.createElement)(p.InnerBlocks,{templateLock:!1})))}}]),e}(o.Component),z=Object(u.compose)([Object(u.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(T.withSelect)((function(t,e){var n=e.selectedPostId,o=e.selectedPostType;return{selectedPost:(0,t("core").getEntityRecord)("postType",o,n)}}))])(I);n(32);Object(r.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:z,save:function(){return Object(o.createElement)(p.InnerBlocks.Content,null)}});var A=Object(u.createHigherOrderComponent)((function(t){return function(e){return"a8c/post-content"!==e.name?Object(o.createElement)(t,e):Object(o.createElement)(t,l()({},e,{className:"post-content__block"}))}}),"addContentSlotClassname");Object(m.addFilter)("editor.BlockListBlock","full-site-editing/blocks/post-content",A,9);var N=n(6),F=n(9),D=n.n(F),L=n(14),R=n.n(L),M=n(15),U=n.n(M),H=n(16);function q(t){var e=Object(o.useRef)();return Object(o.useEffect)((function(){e.current=t}),[t]),e.current}function V(t,e,n,r,c,l){var a=Object(o.useState)({option:e,previousOption:"",loaded:!1,error:!1}),s=R()(a,2),u=s[0],p=s[1],d=q(r),f=q(c);function b(){p(D()({},u,{option:u.previousOption,isSaving:!1}))}return Object(o.useEffect)((function(){u.loaded||u.error?function(){var e=u.option,o=u.previousOption,l=e&&e.trim()===o.trim(),a=!e||0===e.trim().length;!r&&d&&a&&b();if(!c||l)return;!f&&c&&function(e){p(D()({},u,{isSaving:!0})),U()({path:"/wp/v2/settings",method:"POST",data:O()({},t,e)}).then((function(){return function(t){p(D()({},u,{previousOption:t,isDirty:!1,isSaving:!1}))}(e)})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to save site %s"),t)),b()}))}(e)}():U()({path:"/wp/v2/settings"}).then((function(e){return p(D()({},u,{option:Object(H.decodeEntities)(e[t]),previousOption:Object(H.decodeEntities)(e[t]),loaded:!0,error:!1}))})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to load site %s"),t)),p(D()({},u,{option:Object(i.sprintf)(Object(i.__)("Error loading site %s"),t),error:!0}))}))})),{siteOptions:u,handleChange:function(t){l({updated:Date.now()}),p(D()({},u,{option:t}))}}}var G=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(T.withSelect)((function(t,e){var n=e.clientId,o=t("core/editor"),r=o.isSavingPost,i=o.isPublishingPost,c=o.isAutosavingPost,l=o.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:(r()&&l()||i())&&!c()}})),Object(T.withDispatch)((function(t,e){var n=e.blockIndex,o=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},o,n+1)}}}))])((function(t){var e,n=t.attributes,r=t.backgroundColor,c=t.className,a=t.createErrorNotice,s=t.fontSize,u=t.insertDefaultBlock,f=t.isSelected,b=t.setAttributes,m=t.setBackgroundColor,g=t.setFontSize,j=t.setTextColor,h=t.shouldUpdateSiteOption,v=t.textColor,y=n.customFontSize,S=n.textAlign,_=y||s.size,E=V("description",Object(i.__)("Site description loading…"),a,f,h,b),k=E.siteOptions,w=E.handleChange,C=k.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:S,onChange:function(t){b({textAlign:t})}})),Object(o.createElement)(p.InspectorControls,null,Object(o.createElement)(d.PanelBody,{className:"blocks-font-size",title:Object(i.__)("Text Settings")},Object(o.createElement)(p.FontSizePicker,{onChange:g,value:_})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:r.color,onChange:m,label:Object(i.__)("Background Color")},{value:v.color,onChange:j,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:v.color,backgroundColor:r.color},{fontSize:_})))),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Description"),className:P()("site-description",c,(e={"has-text-color":v.color,"has-background":r.color},O()(e,"has-text-align-".concat(S),S),O()(e,r.class,r.class),O()(e,v.class,v.class),O()(e,s.class,!y&&s.class),e)),identifier:"content",onChange:function(t){return w(t)},onReplace:u,onSplit:N.noop,placeholder:Object(i.__)("Add a Site Description"),style:{backgroundColor:r.color,color:v.color,fontSize:_?_+"px":void 0},tagName:"p",value:C}))}));n(36);Object(r.registerBlockType)("a8c/site-description",{title:Object(i.__)("Site Description"),description:Object(i.__)("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:{align:["wide","full"],html:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"},textAlign:{type:"string",default:"center"},textColor:{type:"string"},customTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},fontSize:{type:"string",default:"small"},customFontSize:{type:"number"}},edit:G,save:function(){return null}});var W=Object(u.compose)([Object(p.withColors)({textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(T.withSelect)((function(t,e){var n=e.clientId,o=t("core/editor"),r=o.isSavingPost,i=o.isPublishingPost,c=o.isAutosavingPost,l=o.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:(r()&&l()||i())&&!c()}})),Object(T.withDispatch)((function(t,e){var n=e.blockIndex,o=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},o,n+1)}}}))])((function(t){var e,n=t.attributes,r=t.className,c=t.createErrorNotice,l=t.fontSize,a=t.insertDefaultBlock,s=t.isSelected,u=t.setAttributes,f=t.setFontSize,b=t.setTextColor,m=t.shouldUpdateSiteOption,g=t.textColor,j=n.customFontSize,h=n.textAlign,v=j||l.size,y=V("title",Object(i.__)("Site title loading…"),c,s,m,u),S=y.siteOptions,_=y.handleChange,E=S.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:h,onChange:function(t){u({textAlign:t})}})),Object(o.createElement)(p.InspectorControls,null,Object(o.createElement)(d.PanelBody,{className:"blocks-font-size",title:Object(i.__)("Text Settings")},Object(o.createElement)(p.FontSizePicker,{onChange:f,value:v})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:g.color,onChange:b,label:Object(i.__)("Text Color")}]})),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Title"),className:P()("site-title",r,(e={"has-text-color":g.color},O()(e,"has-text-align-".concat(h),h),O()(e,g.class,g.class),O()(e,l.class,!j&&l.class),e)),identifier:"content",onChange:function(t){return _(t)},onReplace:a,onSplit:N.noop,placeholder:Object(i.__)("Add a Site Title"),style:{color:g.color,fontSize:v?v+"px":void 0},tagName:"h1",value:E}))}));n(37);Object(r.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"},textAlign:{type:"string",default:"center"},textColor:{type:"string"},customTextColor:{type:"string"},fontSize:{type:"string",default:"normal"},customFontSize:{type:"number"}},edit:W,save:function(){return null}});var Q=n(25),Y=(n(17),Object(u.compose)(Object(u.withState)({templateClientId:null}),Object(T.withSelect)((function(t,e){var n=e.attributes,o=e.templateClientId,r=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&&r("postType","wp_template_part",d),m=Object(Q.addQueryArgs)(fullSiteEditing.editTemplateBaseUrl,{post:d,fse_parent_post:f}),g=u();return{currentPostId:f,editTemplateUrl:m,template:b,templateBlock:s(o),templateTitle:Object(N.get)(b,["title","rendered"],""),isDirty:l(),isEditorSidebarOpened:!!p(),isAnyTemplateBlockSelected:g&&"a8c/template"===g.name}})),Object(T.withDispatch)((function(t,e){var n=t("core/block-editor").receiveBlocks,o=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(r.parse)(Object(N.get)(i,["content","raw"],"")),e=Object(r.createBlock)("core/group",{},t);n([e]),l({templateClientId:e.clientId})}},openGeneralSidebar:o}})))((function(t){var e,n=t.attributes,r=t.editTemplateUrl,c=t.receiveTemplateBlocks,l=t.template,a=t.templateBlock,s=t.templateTitle,u=t.isDirty,f=t.savePost,b=t.isEditorSidebarOpened,m=t.openGeneralSidebar,g=t.isAnyTemplateBlockSelected;if(!l)return Object(o.createElement)(d.Placeholder,null,Object(o.createElement)(d.Spinner,null));var j=Object(o.createRef)(),h=Object(o.useState)(!1),v=R()(h,2),y=v[0],S=v[1];Object(o.useEffect)((function(){y&&!u&&j.current.click(),c()})),Object(o.useEffect)((function(){var t=document.querySelector(".edit-post-sidebar__panel-tabs ul li:last-child");if(b&&t){if(g)return m("edit-post/document"),void t.classList.add("hidden");t.classList.remove("hidden")}}),[g,b,m]);var _=n.align,E=n.className;return Object(o.createElement)("div",{className:P()("template-block",(e={},O()(e,"align".concat(_),_),O()(e,"is-navigating-to-template",y),e))},a&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(d.Disabled,null,Object(o.createElement)("div",{className:E},Object(o.createElement)(p.BlockEdit,{attributes:a.attributes,block:a,clientId:a.clientId,isSelected:!1,name:a.name,setAttributes:N.noop}))),Object(o.createElement)(d.Placeholder,{className:"template-block__overlay"},y&&Object(o.createElement)("div",{className:"template-block__loading"},Object(o.createElement)(d.Spinner,null)," ",Object(i.sprintf)(Object(i.__)("Loading editor for: %s"),s)),Object(o.createElement)(d.Button,{className:y?"hidden":null,href:r,onClick:function(t){S(!0),u&&(t.preventDefault(),f())},isDefault:!0,isLarge:!0,ref:j},Object(i.sprintf)(Object(i.__)("Edit %s"),s)))))}))),J=Object(u.createHigherOrderComponent)((function(t){return function(e){return"fse-site-logo"!==e.attributes.className?Object(o.createElement)(t,e):Object(o.createElement)(t,l()({},e,{className:"template__site-logo"}))}}),"addFSESiteLogoClassname");Object(m.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",J),"wp_template_part"!==fullSiteEditing.editorPostType&&Object(r.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:Y,save:function(){return null},getEditWrapperProps:function(){return{"data-align":"full"}}});var K=Object(u.createHigherOrderComponent)((function(t){return function(e){return"a8c/template"!==e.name?Object(o.createElement)(t,e):Object(o.createElement)(t,l()({},e,{className:"template__block-container"}))}}),"addFSETemplateClassname");Object(m.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",K,9);var X=n(13),Z=n.n(X);Z()((function(){var t=fullSiteEditing,e=t.closeButtonLabel,n=t.closeButtonUrl,o=t.editorPostType,r=setInterval((function(){var t=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");if(t&&(clearInterval(r),"wp_template_part"===o&&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(T.withSelect)((function(t){var e=t("core").getEntityRecord,n=t("core/editor").getEditedPostAttribute;return{templateClasses:Object(N.map)(n("template_part_types"),(function(t){var n=Object(N.get)(e("taxonomy","wp_template_part_type",t),"name","");return Object(N.endsWith)(n,"-header")?"site-header site-branding":Object(N.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(T.dispatch)("core/notices").createNotice("info",Object(i.__)("Updates to this template will affect all pages on your site."),{isDismissible:!1})}));var ot=Object(u.compose)(Object(T.withSelect)((function(t){var e=t("core/editor").getEditorSettings,n=t("core/block-editor").getBlocks,o=t("core/edit-post").getEditorMode,r=n().find((function(t){return"a8c/post-content"===t.name}));return{rootClientId:r?r.clientId:"",showInserter:"visual"===o()&&e().richEditingEnabled}})))((function(t){var e=t.rootClientId,n=t.showInserter;return Object(o.createElement)(p.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(o.render)(Object(o.createElement)(ot,null),n)}}))}()}));var rt=Object(T.subscribe)((function(){if("page"!==fullSiteEditing.editorPostType)return rt();!1===Object(T.select)("core/block-editor").isValidTemplate()&&Object(T.dispatch)("core/block-editor").setTemplateValidity(!0)})),it=["logo","brand","emblem","hallmark"];Object(m.addFilter)("blocks.registerBlockType","full-site-editing/editor/image-block-keywords",(function(t,e){return"core/image"!==e?t:t=Object(N.assign)({},t,{keywords:t.keywords.concat(it)})}));n(41);Object(T.use)((function(t){return{dispatch:function(e){var n=D()({},t.dispatch(e)),o=fullSiteEditing.editorPostType;return"core/editor"===e&&n.trashPost&&"wp_template_part"===o&&(n.trashPost=function(){}),n}}})),Object(T.use)((function(t){return{dispatch:function(e){var n=D()({},t.dispatch(e)),o=fullSiteEditing.editorPostType;if("core/editor"===e&&n.editPost&&"wp_template_part"===o){var r=n.editPost;n.editPost=function(t){"draft"!==t.status&&r(t)}}return n}}}));var ct=Object(T.subscribe)((function(){var t=Object(T.dispatch)("core/edit-post").removeEditorPanel;return"page"===fullSiteEditing.editorPostType&&t("featured-image"),"wp_template_part"===fullSiteEditing.editorPostType&&t("post-status"),ct()}))}]));
3
Copyright (c) 2017 Jed Watson.
4
Licensed under the MIT License (MIT), see
5
http://jedwatson.github.io/classnames
6
+ */!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var o=arguments[e];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)&&o.length){var c=r.apply(null,o);c&&t.push(c)}else if("object"===i)for(var l in o)n.call(o,l)&&o[l]&&t.push(l)}}return t.join(" ")}t.exports?(r.default=r,t.exports=r):void 0===(o=function(){return r}.apply(e,[]))||(t.exports=o)}()},function(t,e){!function(){t.exports=this.wp.hooks}()},function(t,e){!function(){t.exports=this.wp.domReady}()},function(t,e,n){var o=n(33),r=n(34),i=n(35);t.exports=function(t,e){return o(t)||r(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 o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}t.exports=function(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}},function(t,e,n){var o=n(29),r=n(30);t.exports=function(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?r(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 o=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&&o(t,e)}},function(t,e){!function(){t.exports=this.wp.editor}()},function(t,e){!function(){t.exports=this.wp.url}()},function(t,e,n){var o=n(38),r=n(39),i=n(40);t.exports=function(t){return o(t)||r(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 o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(t){return n(t)}:t.exports=o=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},o(e)}t.exports=o},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,o){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,o)}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){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],o=!0,r=!1,i=void 0;try{for(var c,l=t[Symbol.iterator]();!(o=(c=l.next()).done)&&(n.push(c.value),!e||n.length!==e);o=!0);}catch(a){r=!0,i=a}finally{try{o||null==l.return||l.return()}finally{if(r)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 o=n(0),r=n(7),i=n(1),c=n(10),l=n.n(c),a=n(18),s=n.n(a),u=n(4),p=n(2),d=n(8),f=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize")])((function(t){var e=t.attributes,n=t.backgroundColor,r=t.fontSize,c=t.setAttributes,a=t.setBackgroundColor,u=t.setFontSize,f=t.setTextColor,b=t.textColor,m=e.customFontSize,g=e.textAlign,O=m||r.size;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:g,onChange:function(t){c({textAlign:t})}})),Object(o.createElement)(p.InspectorControls,null,Object(o.createElement)(d.PanelBody,{className:"blocks-font-size",title:Object(i.__)("Text Settings")},Object(o.createElement)(p.FontSizePicker,{onChange:u,value:O})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:n.color,onChange:a,label:Object(i.__)("Background Color")},{value:b.color,onChange:f,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:b.color,backgroundColor:n.color},{fontSize:O})))),Object(o.createElement)(s.a,{block:"a8c/navigation-menu",attributes:e}))})),b=(n(28),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(r.registerBlockType)("a8c/navigation-menu",{title:Object(i.__)("Navigation Menu"),description:Object(i.__)("Visual placeholder for site-wide navigation and menus."),icon:b,category:"layout",supports:{align:["wide","full"],html:!1,reusable:!1},edit:f,save:function(){return null}});var m=n(12),g=n(5),O=n.n(g),j=n(19),h=n.n(j),y=n(20),v=n.n(y),S=n(21),_=n.n(S),E=n(22),k=n.n(E),w=n(23),C=n.n(w),x=n(11),P=n.n(x),T=n(3),B=n(24),I=function(t){function e(){return h()(this,e),_()(this,k()(e).apply(this,arguments))}return C()(e,t),v()(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(o.createElement)(o.Fragment,null,Object(o.createElement)("div",{className:P()("post-content-block",O()({},"align".concat(t),t))},Object(o.createElement)(B.PostTitle,null),Object(o.createElement)(p.InnerBlocks,{templateLock:!1})))}}]),e}(o.Component),z=Object(u.compose)([Object(u.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(T.withSelect)((function(t,e){var n=e.selectedPostId,o=e.selectedPostType;return{selectedPost:(0,t("core").getEntityRecord)("postType",o,n)}}))])(I);n(32);Object(r.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:z,save:function(){return Object(o.createElement)(p.InnerBlocks.Content,null)}});var A=Object(u.createHigherOrderComponent)((function(t){return function(e){return"a8c/post-content"!==e.name?Object(o.createElement)(t,e):Object(o.createElement)(t,l()({},e,{className:"post-content__block"}))}}),"addContentSlotClassname");Object(m.addFilter)("editor.BlockListBlock","full-site-editing/blocks/post-content",A,9);var N=n(6),F=n(9),D=n.n(F),L=n(14),R=n.n(L),M=n(15),U=n.n(M),H=n(16);function q(t){var e=Object(o.useRef)();return Object(o.useEffect)((function(){e.current=t}),[t]),e.current}function V(t,e,n,r,c,l){var a=Object(o.useState)({option:e,previousOption:"",loaded:!1,error:!1}),s=R()(a,2),u=s[0],p=s[1],d=q(r),f=q(c);function b(){p(D()({},u,{option:u.previousOption,isSaving:!1}))}return Object(o.useEffect)((function(){u.loaded||u.error?function(){var e=u.option,o=u.previousOption,l=e&&e.trim()===o.trim(),a=!e||0===e.trim().length;!r&&d&&a&&b();if(!c||l)return;!f&&c&&function(e){p(D()({},u,{isSaving:!0})),U()({path:"/wp/v2/settings",method:"POST",data:O()({},t,e)}).then((function(){return function(t){p(D()({},u,{previousOption:t,isDirty:!1,isSaving:!1}))}(e)})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to save site %s"),t)),b()}))}(e)}():U()({path:"/wp/v2/settings"}).then((function(e){return p(D()({},u,{option:Object(H.decodeEntities)(e[t]),previousOption:Object(H.decodeEntities)(e[t]),loaded:!0,error:!1}))})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to load site %s"),t)),p(D()({},u,{option:Object(i.sprintf)(Object(i.__)("Error loading site %s"),t),error:!0}))}))})),{siteOptions:u,handleChange:function(t){l({updated:Date.now()}),p(D()({},u,{option:t}))}}}var G=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(T.withSelect)((function(t,e){var n=e.clientId,o=t("core/editor"),r=o.isSavingPost,i=o.isPublishingPost,c=o.isAutosavingPost,l=o.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:(r()&&l()||i())&&!c()}})),Object(T.withDispatch)((function(t,e){var n=e.blockIndex,o=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},o,n+1)}}}))])((function(t){var e,n=t.attributes,r=t.backgroundColor,c=t.className,a=t.createErrorNotice,s=t.fontSize,u=t.insertDefaultBlock,f=t.isSelected,b=t.setAttributes,m=t.setBackgroundColor,g=t.setFontSize,j=t.setTextColor,h=t.shouldUpdateSiteOption,y=t.textColor,v=n.customFontSize,S=n.textAlign,_=v||s.size,E=V("description",Object(i.__)("Site description loading…"),a,f,h,b),k=E.siteOptions,w=E.handleChange,C=k.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:S,onChange:function(t){b({textAlign:t})}})),Object(o.createElement)(p.InspectorControls,null,Object(o.createElement)(d.PanelBody,{className:"blocks-font-size",title:Object(i.__)("Text Settings")},Object(o.createElement)(p.FontSizePicker,{onChange:g,value:_})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:r.color,onChange:m,label:Object(i.__)("Background Color")},{value:y.color,onChange:j,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:y.color,backgroundColor:r.color},{fontSize:_})))),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Description"),className:P()("site-description",c,(e={"has-text-color":y.color,"has-background":r.color},O()(e,"has-text-align-".concat(S),S),O()(e,r.class,r.class),O()(e,y.class,y.class),O()(e,s.class,!v&&s.class),e)),identifier:"content",onChange:function(t){return w(t)},onReplace:u,onSplit:N.noop,placeholder:Object(i.__)("Add a Site Description"),style:{backgroundColor:r.color,color:y.color,fontSize:_?_+"px":void 0},tagName:"p",value:C}))}));n(36);Object(r.registerBlockType)("a8c/site-description",{title:Object(i.__)("Site Description"),description:Object(i.__)("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:{align:["wide","full"],html:!1,multiple:!1,reusable:!1},attributes:{align:{type:"string",default:"wide"},textAlign:{type:"string",default:"center"},textColor:{type:"string"},customTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},fontSize:{type:"string",default:"small"},customFontSize:{type:"number"}},edit:G,save:function(){return null}});var W=Object(u.compose)([Object(p.withColors)({textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(T.withSelect)((function(t,e){var n=e.clientId,o=t("core/editor"),r=o.isSavingPost,i=o.isPublishingPost,c=o.isAutosavingPost,l=o.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:(r()&&l()||i())&&!c()}})),Object(T.withDispatch)((function(t,e){var n=e.blockIndex,o=e.rootClientId;return{createErrorNotice:t("core/notices").createErrorNotice,insertDefaultBlock:function(){return t("core/block-editor").insertDefaultBlock({},o,n+1)}}}))])((function(t){var e,n=t.attributes,r=t.className,c=t.createErrorNotice,l=t.fontSize,a=t.insertDefaultBlock,s=t.isSelected,u=t.setAttributes,f=t.setFontSize,b=t.setTextColor,m=t.shouldUpdateSiteOption,g=t.textColor,j=n.customFontSize,h=n.textAlign,y=j||l.size,v=V("title",Object(i.__)("Site title loading…"),c,s,m,u),S=v.siteOptions,_=v.handleChange,E=S.option;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:h,onChange:function(t){u({textAlign:t})}})),Object(o.createElement)(p.InspectorControls,null,Object(o.createElement)(d.PanelBody,{className:"blocks-font-size",title:Object(i.__)("Text Settings")},Object(o.createElement)(p.FontSizePicker,{onChange:f,value:y})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:g.color,onChange:b,label:Object(i.__)("Text Color")}]})),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Title"),className:P()("site-title",r,(e={"has-text-color":g.color},O()(e,"has-text-align-".concat(h),h),O()(e,g.class,g.class),O()(e,l.class,!j&&l.class),e)),identifier:"content",onChange:function(t){return _(t)},onReplace:a,onSplit:N.noop,placeholder:Object(i.__)("Add a Site Title"),style:{color:g.color,fontSize:y?y+"px":void 0},tagName:"h1",value:E}))}));n(37);Object(r.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"},textAlign:{type:"string",default:"center"},textColor:{type:"string"},customTextColor:{type:"string"},fontSize:{type:"string",default:"normal"},customFontSize:{type:"number"}},edit:W,save:function(){return null}});var Q=n(25),Y=(n(17),Object(u.compose)(Object(u.withState)({templateClientId:null}),Object(T.withSelect)((function(t,e){var n=e.attributes,o=e.templateClientId,r=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&&r("postType","wp_template_part",d),m=Object(Q.addQueryArgs)(fullSiteEditing.editTemplateBaseUrl,{post:d,fse_parent_post:f}),g=u();return{currentPostId:f,editTemplateUrl:m,template:b,templateBlock:s(o),templateTitle:Object(N.get)(b,["title","rendered"],""),isDirty:l(),isEditorSidebarOpened:!!p(),isAnyTemplateBlockSelected:g&&"a8c/template"===g.name}})),Object(T.withDispatch)((function(t,e){var n=t("core/block-editor").receiveBlocks,o=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(r.parse)(Object(N.get)(i,["content","raw"],"")),e=Object(r.createBlock)("core/group",{},t);n([e]),l({templateClientId:e.clientId})}},openGeneralSidebar:o}})))((function(t){var e,n=t.attributes,r=t.editTemplateUrl,c=t.receiveTemplateBlocks,l=t.template,a=t.templateBlock,s=t.templateTitle,u=t.isDirty,f=t.savePost,b=t.isEditorSidebarOpened,m=t.openGeneralSidebar,g=t.isAnyTemplateBlockSelected;if(!l)return Object(o.createElement)(d.Placeholder,null,Object(o.createElement)(d.Spinner,null));var j=Object(o.createRef)(),h=Object(o.useState)(!1),y=R()(h,2),v=y[0],S=y[1];Object(o.useEffect)((function(){v&&!u&&j.current.click(),c()})),Object(o.useEffect)((function(){var t=document.querySelector(".edit-post-sidebar__panel-tabs ul li:last-child");if(b&&t){if(g)return m("edit-post/document"),void t.classList.add("hidden");t.classList.remove("hidden")}}),[g,b,m]);var _=n.align,E=n.className;return Object(o.createElement)("div",{className:P()("template-block",(e={},O()(e,"align".concat(_),_),O()(e,"is-navigating-to-template",v),e))},a&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(d.Disabled,null,Object(o.createElement)("div",{className:E},Object(o.createElement)(p.BlockEdit,{attributes:a.attributes,block:a,clientId:a.clientId,isSelected:!1,name:a.name,setAttributes:N.noop}))),Object(o.createElement)(d.Placeholder,{className:"template-block__overlay"},v&&Object(o.createElement)("div",{className:"template-block__loading"},Object(o.createElement)(d.Spinner,null)," ",Object(i.sprintf)(Object(i.__)("Loading editor for: %s"),s)),Object(o.createElement)(d.Button,{className:v?"hidden":null,href:r,onClick:function(t){S(!0),u&&(t.preventDefault(),f())},isDefault:!0,isLarge:!0,ref:j},Object(i.sprintf)(Object(i.__)("Edit %s"),s)))))}))),J=Object(u.createHigherOrderComponent)((function(t){return function(e){return"fse-site-logo"!==e.attributes.className?Object(o.createElement)(t,e):Object(o.createElement)(t,l()({},e,{className:"template__site-logo"}))}}),"addFSESiteLogoClassname");Object(m.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",J),"wp_template_part"!==fullSiteEditing.editorPostType&&Object(r.registerBlockType)("a8c/template",{title:Object(i.__)("Template Part"),__experimentalDisplayName:"label",description:Object(i.__)("Display a Template Part."),icon:"layout",category:"layout",attributes:{templateId:{type:"number"},className:{type:"string"},label:{type:"string"}},supports:{anchor:!1,customClassName:!1,html:!1,inserter:!1,reusable:!1},edit:Y,save:function(){return null},getEditWrapperProps:function(){return{"data-align":"full"}}});var K=Object(u.createHigherOrderComponent)((function(t){return function(e){return"a8c/template"!==e.name?Object(o.createElement)(t,e):Object(o.createElement)(t,l()({},e,{className:"template__block-container"}))}}),"addFSETemplateClassname");Object(m.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",K,9);var X=n(13),Z=n.n(X);Z()((function(){var t=fullSiteEditing,e=t.closeButtonLabel,n=t.closeButtonUrl,o=t.editorPostType,r=setInterval((function(){var t=document.querySelector(".edit-post-fullscreen-mode-close__toolbar a");if(t&&(clearInterval(r),"wp_template_part"===o&&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(T.withSelect)((function(t){var e=t("core").getEntityRecord,n=t("core/editor").getEditedPostAttribute;return{templateClasses:Object(N.map)(n("template_part_types"),(function(t){var n=Object(N.get)(e("taxonomy","wp_template_part_type",t),"name","");return Object(N.endsWith)(n,"-header")?"fse-header":Object(N.endsWith)(n,"-footer")?"fse-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 fse-template-part"].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(T.dispatch)("core/notices").createNotice("info",Object(i.__)("Updates to this template will affect all pages on your site."),{isDismissible:!1})}));var ot=Object(u.compose)(Object(T.withSelect)((function(t){var e=t("core/editor").getEditorSettings,n=t("core/block-editor").getBlocks,o=t("core/edit-post").getEditorMode,r=n().find((function(t){return"a8c/post-content"===t.name}));return{rootClientId:r?r.clientId:"",showInserter:"visual"===o()&&e().richEditingEnabled}})))((function(t){var e=t.rootClientId,n=t.showInserter;return Object(o.createElement)(p.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(o.render)(Object(o.createElement)(ot,null),n)}}))}()}));var rt=Object(T.subscribe)((function(){if("page"!==fullSiteEditing.editorPostType)return rt();!1===Object(T.select)("core/block-editor").isValidTemplate()&&Object(T.dispatch)("core/block-editor").setTemplateValidity(!0)})),it=["logo","brand","emblem","hallmark"];Object(m.addFilter)("blocks.registerBlockType","full-site-editing/editor/image-block-keywords",(function(t,e){return"core/image"!==e?t:t=Object(N.assign)({},t,{keywords:t.keywords.concat(it)})}));n(41);Object(T.use)((function(t){return{dispatch:function(e){var n=D()({},t.dispatch(e)),o=fullSiteEditing.editorPostType;return"core/editor"===e&&n.trashPost&&"wp_template_part"===o&&(n.trashPost=function(){}),n}}})),Object(T.use)((function(t){return{dispatch:function(e){var n=D()({},t.dispatch(e)),o=fullSiteEditing.editorPostType;if("core/editor"===e&&n.editPost&&"wp_template_part"===o){var r=n.editPost;n.editPost=function(t){"draft"!==t.status&&r(t)}}return n}}}));var ct=Object(T.subscribe)((function(){var t=Object(T.dispatch)("core/edit-post").removeEditorPanel;return"page"===fullSiteEditing.editorPostType&&t("featured-image"),"wp_template_part"===fullSiteEditing.editorPostType&&t("post-status"),ct()}))}]));
full-site-editing/plugins/editor-template-classes/index.js CHANGED
@@ -1,3 +1,4 @@
1
/* global fullSiteEditing */
2
/**
3
* External dependencies
@@ -21,10 +22,10 @@ const EditorTemplateClasses = withSelect( select => {
21
''
22
);
23
if ( endsWith( typeName, '-header' ) ) {
24
- return 'site-header site-branding';
25
}
26
if ( endsWith( typeName, '-footer' ) ) {
27
- return 'site-footer';
28
}
29
} );
30
return { templateClasses };
@@ -39,7 +40,7 @@ const EditorTemplateClasses = withSelect( select => {
39
}
40
clearInterval( blockListInception );
41
42
- blockList.className = classNames( 'a8c-template-editor', ...templateClasses );
43
} );
44
45
return null;
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
/* global fullSiteEditing */
3
/**
4
* External dependencies
22
''
23
);
24
if ( endsWith( typeName, '-header' ) ) {
25
+ return 'fse-header';
26
}
27
if ( endsWith( typeName, '-footer' ) ) {
28
+ return 'fse-footer';
29
}
30
} );
31
return { templateClasses };
40
}
41
clearInterval( blockListInception );
42
43
+ blockList.className = classNames( 'a8c-template-editor fse-template-part', ...templateClasses );
44
} );
45
46
return null;
full-site-editing/templates/class-wp-template.php CHANGED
@@ -161,9 +161,9 @@ class WP_Template {
161
return null;
162
}
163
164
- return "<!-- wp:a8c/template {\"templateId\":$header_id,\"className\":\"site-header site-branding\"} /-->" .
165
'<!-- wp:a8c/post-content /-->' .
166
- "<!-- wp:a8c/template {\"templateId\":$footer_id,\"className\":\"site-footer\"} /-->";
167
}
168
169
/**
161
return null;
162
}
163
164
+ return "<!-- wp:a8c/template {\"templateId\":$header_id,\"label\":\"" . __( 'Header', 'full-site-editing' ) . '","className":"fse-template-part fse-header"} /-->' .
165
'<!-- wp:a8c/post-content /-->' .
166
+ "<!-- wp:a8c/template {\"templateId\":$footer_id,\"label\":\"" . __( 'Footer', 'full-site-editing' ) . '","className":"fse-template-part fse-footer"} /-->';
167
}
168
169
/**
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
=== Full Site Editing ===
2
- Contributors: alexislloyd, allancole, automattic, codebykat, copons, dmsnell, get_dave, glendaviesnz, gwwar, iamtakashi, Joen, kwight, marekhrabe, mattwiebe, mmtr86, mppfeiffer, nrqsnchz, obenland, okenobi, vindl, noahtallen, owolski
3
Tags: block, blocks, editor, gutenberg, page
4
Requires at least: 5.0
5
Tested up to: 5.3
6
- Stable tag: 0.13
7
Requires PHP: 5.6.20
8
License: GPLv2 or later
9
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -42,6 +42,10 @@ This plugin is experimental, so we don't provide any support for it outside of w
42
43
== Changelog ==
44
45
= 0.13 =
46
47
* Incorporate Global Styles plugin functionality.
1
=== Full Site Editing ===
2
+ Contributors: alexislloyd, allancole, automattic, codebykat, copons, dmsnell, get_dave, glendaviesnz, gwwar, iamtakashi, Joen, kwight, marekhrabe, mattwiebe, mmtr86, mppfeiffer, nrqsnchz, obenland, okenobi, vindl, noahtallen, owolski, nosolosw
3
Tags: block, blocks, editor, gutenberg, page
4
Requires at least: 5.0
5
Tested up to: 5.3
6
+ Stable tag: 0.14
7
Requires PHP: 5.6.20
8
License: GPLv2 or later
9
License URI: https://www.gnu.org/licenses/gpl-2.0.html
42
43
== Changelog ==
44
45
+ = 0.14 =
46
+
47
+ * Stop using theme classes for template parts to improve support for FSE blocks' style attributes.
48
+
49
= 0.13 =
50
51
* Incorporate Global Styles plugin functionality.