Version Description
Download this release
Release Info
Developer | vindl |
Plugin | Full Site Editing |
Version | 0.16 |
Comparing to | |
See all releases |
Code changes from version 0.15.1 to 0.16
- full-site-editing-plugin.php +75 -42
- full-site-editing/blocks/navigation-menu/index.js +1 -1
- full-site-editing/blocks/template/edit.js +6 -1
- full-site-editing/blocks/template/style.scss +2 -2
- full-site-editing/blocks/usePrevious.js +0 -22
- full-site-editing/blocks/useSiteOptions.js +0 -117
- full-site-editing/class-full-site-editing.php +1 -25
- full-site-editing/dist/full-site-editing.asset.php +1 -1
- full-site-editing/dist/full-site-editing.css +1 -1
- full-site-editing/dist/full-site-editing.js +1 -1
- full-site-editing/dist/full-site-editing.rtl.css +1 -1
- full-site-editing/editor/style.scss +6 -2
- full-site-editing/plugins/close-button-override/index.js +54 -20
- full-site-editing/templates/class-wp-template-inserter.php +12 -0
- full-site-editing/templates/class-wp-template.php +1 -25
- readme.txt +10 -1
- starter-page-templates/dist/starter-page-templates.asset.php +1 -1
- starter-page-templates/dist/starter-page-templates.js +1 -1
- starter-page-templates/page-template-modal/index.js +21 -1
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.
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com/wordpress-plugins/
|
8 |
* License: GPLv2 or later
|
@@ -20,10 +20,7 @@ namespace A8C\FSE;
|
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
-
define( 'PLUGIN_VERSION', '0.
|
24 |
-
|
25 |
-
// Themes which are supported by Full Site Editing (not the same as the SPT themes).
|
26 |
-
const SUPPORTED_THEMES = [ 'maywood' ];
|
27 |
|
28 |
/**
|
29 |
* Load Full Site Editing.
|
@@ -62,46 +59,51 @@ function dangerously_load_full_site_editing_files() {
|
|
62 |
|
63 |
/**
|
64 |
* Whether or not FSE is active.
|
65 |
-
* If false, FSE functionality
|
66 |
*
|
67 |
* @returns bool True if FSE is active, false otherwise.
|
68 |
*/
|
69 |
function is_full_site_editing_active() {
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
|
73 |
/**
|
74 |
-
* Returns
|
75 |
*
|
76 |
-
*
|
77 |
-
*
|
78 |
-
*
|
79 |
*
|
80 |
-
* @return string
|
81 |
*/
|
82 |
function get_theme_slug() {
|
83 |
/**
|
84 |
* Used to get the correct theme in certain contexts.
|
85 |
*
|
86 |
-
* For example, in the wpcom API context, the theme slug is a8c/public-api,
|
87 |
-
* to grab the correct one with the filter.
|
88 |
*
|
89 |
* @since 0.7
|
90 |
*
|
91 |
* @param string current theme slug is the default if nothing overrides it.
|
92 |
*/
|
93 |
-
|
94 |
-
|
95 |
-
// Normalize the theme slug.
|
96 |
-
if ( 'pub/' === substr( $theme_slug, 0, 4 ) ) {
|
97 |
-
$theme_slug = substr( $theme_slug, 4 );
|
98 |
-
}
|
99 |
-
|
100 |
-
if ( '-wpcom' === substr( $theme_slug, -6, 6 ) ) {
|
101 |
-
$theme_slug = substr( $theme_slug, 0, -6 );
|
102 |
-
}
|
103 |
-
|
104 |
-
return $theme_slug;
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -127,9 +129,8 @@ function normalize_theme_slug( $theme_slug ) {
|
|
127 |
}
|
128 |
|
129 |
/**
|
130 |
-
* Whether or not the site is eligible for FSE.
|
131 |
-
*
|
132 |
-
* on some sites which could theoretically otherwise use it.
|
133 |
*
|
134 |
* @return bool True if current site is eligible for FSE, false otherwise.
|
135 |
*/
|
@@ -150,7 +151,31 @@ function is_site_eligible_for_full_site_editing() {
|
|
150 |
* @return bool True if current theme supports FSE, false otherwise.
|
151 |
*/
|
152 |
function is_theme_supported() {
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
|
156 |
/**
|
@@ -184,7 +209,7 @@ add_action( 'plugins_loaded', __NAMESPACE__ . '\load_posts_list_block' );
|
|
184 |
*/
|
185 |
function load_starter_page_templates() {
|
186 |
// We don't want the user to choose a template when copying a post.
|
187 |
-
// phpcs:ignore WordPress.Security.NonceVerification.
|
188 |
if ( isset( $_GET['jetpack-copy'] ) ) {
|
189 |
return;
|
190 |
}
|
@@ -210,29 +235,37 @@ add_action( 'plugins_loaded', __NAMESPACE__ . '\load_starter_page_templates' );
|
|
210 |
* Load Global Styles plugin.
|
211 |
*/
|
212 |
function load_global_styles() {
|
213 |
-
|
214 |
-
require_once __DIR__ . '/global-styles/class-global-styles.php';
|
215 |
-
}
|
216 |
}
|
217 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_global_styles' );
|
218 |
|
219 |
/**
|
220 |
-
* Inserts default full site editing data for current theme
|
221 |
*
|
222 |
-
* We
|
223 |
-
* the
|
224 |
-
*
|
225 |
-
*
|
|
|
|
|
|
|
226 |
*/
|
227 |
function populate_wp_template_data() {
|
228 |
-
|
|
|
|
|
|
|
229 |
require_once __DIR__ . '/full-site-editing/templates/class-template-image-inserter.php';
|
230 |
require_once __DIR__ . '/full-site-editing/templates/class-wp-template-inserter.php';
|
231 |
|
232 |
-
$
|
233 |
-
|
|
|
|
|
|
|
234 |
}
|
235 |
register_activation_hook( __FILE__, __NAMESPACE__ . '\populate_wp_template_data' );
|
|
|
236 |
|
237 |
/**
|
238 |
* Add front-end CoBlocks gallery block scripts.
|
2 |
/**
|
3 |
* Plugin Name: Full Site Editing
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
+
* Version: 0.16
|
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.16' );
|
|
|
|
|
|
|
24 |
|
25 |
/**
|
26 |
* Load Full Site Editing.
|
59 |
|
60 |
/**
|
61 |
* Whether or not FSE is active.
|
62 |
+
* If false, FSE functionality should be disabled.
|
63 |
*
|
64 |
* @returns bool True if FSE is active, false otherwise.
|
65 |
*/
|
66 |
function is_full_site_editing_active() {
|
67 |
+
/**
|
68 |
+
* There are times when this function is called from the WordPress.com public
|
69 |
+
* API context. In this case, we need to switch to the correct blog so that
|
70 |
+
* the functions reference the correct blog context.
|
71 |
+
*/
|
72 |
+
$multisite_id = apply_filters( 'a8c_fse_get_multisite_id', false );
|
73 |
+
$should_switch = is_multisite() && $multisite_id;
|
74 |
+
if ( $should_switch ) {
|
75 |
+
switch_to_blog( $multisite_id );
|
76 |
+
}
|
77 |
+
|
78 |
+
$is_active = is_site_eligible_for_full_site_editing() && is_theme_supported() && did_insert_template_parts();
|
79 |
+
|
80 |
+
if ( $should_switch ) {
|
81 |
+
restore_current_blog();
|
82 |
+
}
|
83 |
+
return $is_active;
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
+
* Returns the slug for the current theme.
|
88 |
*
|
89 |
+
* This even works for the WordPress.com API context where the current theme is
|
90 |
+
* not correct. The filter correctly switches to the correct blog context if
|
91 |
+
* that is the case.
|
92 |
*
|
93 |
+
* @return string Theme slug.
|
94 |
*/
|
95 |
function get_theme_slug() {
|
96 |
/**
|
97 |
* Used to get the correct theme in certain contexts.
|
98 |
*
|
99 |
+
* For example, in the wpcom API context, the theme slug is a8c/public-api,
|
100 |
+
* so we need to grab the correct one with the filter.
|
101 |
*
|
102 |
* @since 0.7
|
103 |
*
|
104 |
* @param string current theme slug is the default if nothing overrides it.
|
105 |
*/
|
106 |
+
return apply_filters( 'a8c_fse_get_theme_slug', get_stylesheet() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
/**
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
+
* Whether or not the site is eligible for FSE. This is essentially a feature
|
133 |
+
* gate to disable FSE on some sites which could theoretically otherwise use it.
|
|
|
134 |
*
|
135 |
* @return bool True if current site is eligible for FSE, false otherwise.
|
136 |
*/
|
151 |
* @return bool True if current theme supports FSE, false otherwise.
|
152 |
*/
|
153 |
function is_theme_supported() {
|
154 |
+
// Use un-normalized theme slug because get_theme requires the full string.
|
155 |
+
$theme = wp_get_theme( get_theme_slug() );
|
156 |
+
return ! $theme->errors() && in_array( 'full-site-editing', $theme->tags, true );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Determines if the template parts have been inserted for the current theme.
|
161 |
+
*
|
162 |
+
* We want to gate on this check in is_full_site_editing_active so that we don't
|
163 |
+
* load FSE for sites which did not get template parts for some reason or another.
|
164 |
+
*
|
165 |
+
* For example, if a user activates theme A on their site and gets FSE, but then
|
166 |
+
* activates theme B which does not have FSE, they will not get FSE flows. If we
|
167 |
+
* retroactively add FSE support to theme B, the user should not get FSE flows
|
168 |
+
* because their site would be modified. Instead, FSE flows would become active
|
169 |
+
* when they specifically take action to re-activate the theme.
|
170 |
+
*
|
171 |
+
* @return bool True if the template parts have been inserted. False otherwise.
|
172 |
+
*/
|
173 |
+
function did_insert_template_parts() {
|
174 |
+
require_once __DIR__ . '/full-site-editing/templates/class-wp-template-inserter.php';
|
175 |
+
|
176 |
+
$theme_slug = normalize_theme_slug( get_theme_slug() );
|
177 |
+
$inserter = new WP_Template_Inserter( $theme_slug );
|
178 |
+
return $inserter->is_template_data_inserted();
|
179 |
}
|
180 |
|
181 |
/**
|
209 |
*/
|
210 |
function load_starter_page_templates() {
|
211 |
// We don't want the user to choose a template when copying a post.
|
212 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
213 |
if ( isset( $_GET['jetpack-copy'] ) ) {
|
214 |
return;
|
215 |
}
|
235 |
* Load Global Styles plugin.
|
236 |
*/
|
237 |
function load_global_styles() {
|
238 |
+
require_once __DIR__ . '/global-styles/class-global-styles.php';
|
|
|
|
|
239 |
}
|
240 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_global_styles' );
|
241 |
|
242 |
/**
|
243 |
+
* Inserts default full site editing data for current theme on plugin/theme activation.
|
244 |
*
|
245 |
+
* We put this here outside of the normal FSE class because FSE is not active
|
246 |
+
* until the template parts are inserted. This makes sure we insert the template
|
247 |
+
* parts when switching to a theme which supports FSE.
|
248 |
+
*
|
249 |
+
* This will populate the default header and footer for current theme, and create
|
250 |
+
* About and Contact pages. Nothing will populate if the data already exists, or
|
251 |
+
* if the theme is unsupported.
|
252 |
*/
|
253 |
function populate_wp_template_data() {
|
254 |
+
if ( ! is_theme_supported() ) {
|
255 |
+
return;
|
256 |
+
}
|
257 |
+
|
258 |
require_once __DIR__ . '/full-site-editing/templates/class-template-image-inserter.php';
|
259 |
require_once __DIR__ . '/full-site-editing/templates/class-wp-template-inserter.php';
|
260 |
|
261 |
+
$theme_slug = normalize_theme_slug( get_theme_slug() );
|
262 |
+
|
263 |
+
$template_inserter = new WP_Template_Inserter( $theme_slug );
|
264 |
+
$template_inserter->insert_default_template_data();
|
265 |
+
$template_inserter->insert_default_pages();
|
266 |
}
|
267 |
register_activation_hook( __FILE__, __NAMESPACE__ . '\populate_wp_template_data' );
|
268 |
+
add_action( 'after_switch_theme', __NAMESPACE__ . '\populate_wp_template_data' );
|
269 |
|
270 |
/**
|
271 |
* Add front-end CoBlocks gallery block scripts.
|
full-site-editing/blocks/navigation-menu/index.js
CHANGED
@@ -24,7 +24,7 @@ registerBlockType( 'a8c/navigation-menu', {
|
|
24 |
icon,
|
25 |
category: 'layout',
|
26 |
supports: {
|
27 |
-
align: [ 'wide', 'full' ],
|
28 |
html: false,
|
29 |
reusable: false,
|
30 |
},
|
24 |
icon,
|
25 |
category: 'layout',
|
26 |
supports: {
|
27 |
+
align: [ 'wide', 'full', 'right', 'left' ],
|
28 |
html: false,
|
29 |
reusable: false,
|
30 |
},
|
full-site-editing/blocks/template/edit.js
CHANGED
@@ -124,10 +124,15 @@ const TemplateEdit = compose(
|
|
124 |
const { align, className } = attributes;
|
125 |
|
126 |
const save = event => {
|
|
|
127 |
setNavigateToTemplate( true );
|
128 |
if ( ! isDirty ) {
|
129 |
return;
|
130 |
}
|
|
|
|
|
|
|
|
|
131 |
event.preventDefault();
|
132 |
savePost();
|
133 |
};
|
@@ -169,7 +174,7 @@ const TemplateEdit = compose(
|
|
169 |
/>
|
170 |
</div>
|
171 |
</Disabled>
|
172 |
-
<Placeholder className="template-block__overlay">
|
173 |
{ navigateToTemplate && (
|
174 |
<div className="template-block__loading">
|
175 |
<Spinner /> { sprintf( __( 'Loading editor for: %s' ), templateTitle ) }
|
124 |
const { align, className } = attributes;
|
125 |
|
126 |
const save = event => {
|
127 |
+
event.stopPropagation();
|
128 |
setNavigateToTemplate( true );
|
129 |
if ( ! isDirty ) {
|
130 |
return;
|
131 |
}
|
132 |
+
/**
|
133 |
+
* This must be after setNavigateToTemplate so that local navigation
|
134 |
+
* (without wpcom overrides) still works correctly.
|
135 |
+
*/
|
136 |
event.preventDefault();
|
137 |
savePost();
|
138 |
};
|
174 |
/>
|
175 |
</div>
|
176 |
</Disabled>
|
177 |
+
<Placeholder className="template-block__overlay" onClick={ save }>
|
178 |
{ navigateToTemplate && (
|
179 |
<div className="template-block__loading">
|
180 |
<Spinner /> { sprintf( __( 'Loading editor for: %s' ), templateTitle ) }
|
full-site-editing/blocks/template/style.scss
CHANGED
@@ -19,14 +19,14 @@
|
|
19 |
&.is-hovered, &.is-selected, .is-navigating-to-template {
|
20 |
.components-disabled {
|
21 |
filter: blur( 2px );
|
22 |
-
transition: filter 0.2s linear
|
23 |
}
|
24 |
.template-block__overlay {
|
25 |
opacity: 1;
|
26 |
transition: opacity 0.2s linear;
|
27 |
.components-button {
|
28 |
opacity: 1;
|
29 |
-
transition: opacity 0.2s linear
|
30 |
}
|
31 |
}
|
32 |
}
|
19 |
&.is-hovered, &.is-selected, .is-navigating-to-template {
|
20 |
.components-disabled {
|
21 |
filter: blur( 2px );
|
22 |
+
transition: filter 0.2s linear;
|
23 |
}
|
24 |
.template-block__overlay {
|
25 |
opacity: 1;
|
26 |
transition: opacity 0.2s linear;
|
27 |
.components-button {
|
28 |
opacity: 1;
|
29 |
+
transition: opacity 0.2s linear;
|
30 |
}
|
31 |
}
|
32 |
}
|
full-site-editing/blocks/usePrevious.js
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { useEffect, useRef } from '@wordpress/element';
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Custom hook to provide the previous value of state or props in a functional component
|
8 |
-
*
|
9 |
-
* see https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
10 |
-
*
|
11 |
-
* @param {any} value state or prop value for which previous value is required
|
12 |
-
* @return {any} previous value of requested state or prop value
|
13 |
-
*/
|
14 |
-
export default function usePrevious( value ) {
|
15 |
-
const ref = useRef();
|
16 |
-
|
17 |
-
useEffect( () => {
|
18 |
-
ref.current = value;
|
19 |
-
}, [ value ] );
|
20 |
-
|
21 |
-
return ref.current;
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
full-site-editing/blocks/useSiteOptions.js
DELETED
@@ -1,117 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { __, sprintf } from '@wordpress/i18n';
|
5 |
-
import { useState, useEffect } from '@wordpress/element';
|
6 |
-
import apiFetch from '@wordpress/api-fetch';
|
7 |
-
import { decodeEntities } from '@wordpress/html-entities';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Internal dependencies
|
11 |
-
*/
|
12 |
-
import usePrevious from './usePrevious';
|
13 |
-
|
14 |
-
export default function useSiteOptions(
|
15 |
-
siteOption,
|
16 |
-
inititalOption,
|
17 |
-
createErrorNotice,
|
18 |
-
isSelected,
|
19 |
-
shouldUpdateSiteOption,
|
20 |
-
setAttributes
|
21 |
-
) {
|
22 |
-
const [ siteOptions, setSiteOptions ] = useState( {
|
23 |
-
option: inititalOption,
|
24 |
-
previousOption: '',
|
25 |
-
loaded: false,
|
26 |
-
error: false,
|
27 |
-
} );
|
28 |
-
|
29 |
-
const previousIsSelected = usePrevious( isSelected );
|
30 |
-
const previousShouldUpdateSiteOption = usePrevious( shouldUpdateSiteOption );
|
31 |
-
|
32 |
-
useEffect( () => {
|
33 |
-
if ( ! siteOptions.loaded && ! siteOptions.error ) {
|
34 |
-
loadSiteOption();
|
35 |
-
} else {
|
36 |
-
updateSiteOption();
|
37 |
-
}
|
38 |
-
} );
|
39 |
-
|
40 |
-
function loadSiteOption() {
|
41 |
-
apiFetch( { path: '/wp/v2/settings' } )
|
42 |
-
.then( result =>
|
43 |
-
setSiteOptions( {
|
44 |
-
...siteOptions,
|
45 |
-
option: decodeEntities( result[ siteOption ] ),
|
46 |
-
previousOption: decodeEntities( result[ siteOption ] ),
|
47 |
-
loaded: true,
|
48 |
-
error: false,
|
49 |
-
} )
|
50 |
-
)
|
51 |
-
.catch( () => {
|
52 |
-
createErrorNotice( sprintf( __( 'Unable to load site %s' ), siteOption ) );
|
53 |
-
setSiteOptions( {
|
54 |
-
...siteOptions,
|
55 |
-
option: sprintf( __( 'Error loading site %s' ), siteOption ),
|
56 |
-
error: true,
|
57 |
-
} );
|
58 |
-
} );
|
59 |
-
}
|
60 |
-
|
61 |
-
function updateSiteOption() {
|
62 |
-
const { option, previousOption } = siteOptions;
|
63 |
-
const optionUnchanged = option && option.trim() === previousOption.trim();
|
64 |
-
const optionIsEmpty = ! option || option.trim().length === 0;
|
65 |
-
|
66 |
-
// Reset to initial value if user de-selects the block with an empty value.
|
67 |
-
if ( ! isSelected && previousIsSelected && optionIsEmpty ) {
|
68 |
-
revertOption();
|
69 |
-
}
|
70 |
-
|
71 |
-
// Don't do anything further if we shouldn't update the site option or the value is unchanged.
|
72 |
-
if ( ! shouldUpdateSiteOption || optionUnchanged ) {
|
73 |
-
return;
|
74 |
-
}
|
75 |
-
|
76 |
-
if ( ! previousShouldUpdateSiteOption && shouldUpdateSiteOption ) {
|
77 |
-
saveSiteOption( option );
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
function saveSiteOption( option ) {
|
82 |
-
setSiteOptions( { ...siteOptions, isSaving: true } );
|
83 |
-
apiFetch( { path: '/wp/v2/settings', method: 'POST', data: { [ siteOption ]: option } } )
|
84 |
-
.then( () => updatePreviousOption( option ) )
|
85 |
-
.catch( () => {
|
86 |
-
createErrorNotice( sprintf( __( 'Unable to save site %s' ), siteOption ) );
|
87 |
-
revertOption();
|
88 |
-
} );
|
89 |
-
}
|
90 |
-
|
91 |
-
function revertOption() {
|
92 |
-
setSiteOptions( {
|
93 |
-
...siteOptions,
|
94 |
-
option: siteOptions.previousOption,
|
95 |
-
isSaving: false,
|
96 |
-
} );
|
97 |
-
}
|
98 |
-
|
99 |
-
function updatePreviousOption( option ) {
|
100 |
-
setSiteOptions( {
|
101 |
-
...siteOptions,
|
102 |
-
previousOption: option,
|
103 |
-
isDirty: false,
|
104 |
-
isSaving: false,
|
105 |
-
} );
|
106 |
-
}
|
107 |
-
|
108 |
-
function handleChange( value ) {
|
109 |
-
// The following is a temporary fix. Setting this fake attribute is used to flag
|
110 |
-
// the content as dirty to editor and enable Update/Publish button. This should be
|
111 |
-
// removed once updating of site options handled in core editor
|
112 |
-
setAttributes( { updated: Date.now() } );
|
113 |
-
setSiteOptions( { ...siteOptions, option: value } );
|
114 |
-
}
|
115 |
-
|
116 |
-
return { siteOptions, handleChange };
|
117 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
full-site-editing/class-full-site-editing.php
CHANGED
@@ -50,7 +50,6 @@ class Full_Site_Editing {
|
|
50 |
add_filter( 'wp_insert_post_data', [ $this, 'remove_template_components' ], 10, 2 );
|
51 |
add_filter( 'admin_body_class', [ $this, 'toggle_editor_post_title_visibility' ] );
|
52 |
add_filter( 'block_editor_settings', [ $this, 'set_block_template' ] );
|
53 |
-
add_action( 'after_switch_theme', [ $this, 'insert_default_data' ] );
|
54 |
add_filter( 'body_class', array( $this, 'add_fse_body_class' ) );
|
55 |
|
56 |
add_filter( 'post_row_actions', [ $this, 'remove_trash_row_action_for_template_post_types' ], 10, 2 );
|
@@ -63,7 +62,7 @@ class Full_Site_Editing {
|
|
63 |
add_action( 'transition_post_status', [ $this, 'restrict_template_drafting' ], 10, 3 );
|
64 |
add_action( 'admin_menu', [ $this, 'remove_wp_admin_menu_items' ] );
|
65 |
|
66 |
-
$this->theme_slug =
|
67 |
$this->wp_template_inserter = new WP_Template_Inserter( $this->theme_slug );
|
68 |
}
|
69 |
|
@@ -96,29 +95,6 @@ class Full_Site_Editing {
|
|
96 |
$this->wp_template_inserter->insert_default_pages();
|
97 |
}
|
98 |
|
99 |
-
/**
|
100 |
-
* Returns normalized theme slug for the current theme.
|
101 |
-
*
|
102 |
-
* Normalize WP.com theme slugs that differ from those that we'll get on self hosted sites.
|
103 |
-
* For example, we will get 'modern-business-wpcom' when retrieving theme slug on self hosted sites,
|
104 |
-
* but due to WP.com setup, on Simple sites we'll get 'pub/modern-business' for the theme.
|
105 |
-
*
|
106 |
-
* @param string $theme_slug Theme slug to check support for.
|
107 |
-
*
|
108 |
-
* @return string Normalized theme slug.
|
109 |
-
*/
|
110 |
-
public function normalize_theme_slug( $theme_slug ) {
|
111 |
-
if ( 'pub/' === substr( $theme_slug, 0, 4 ) ) {
|
112 |
-
$theme_slug = substr( $theme_slug, 4 );
|
113 |
-
}
|
114 |
-
|
115 |
-
if ( '-wpcom' === substr( $theme_slug, -6, 6 ) ) {
|
116 |
-
$theme_slug = substr( $theme_slug, 0, -6 );
|
117 |
-
}
|
118 |
-
|
119 |
-
return $theme_slug;
|
120 |
-
}
|
121 |
-
|
122 |
/**
|
123 |
* Register post types.
|
124 |
*/
|
50 |
add_filter( 'wp_insert_post_data', [ $this, 'remove_template_components' ], 10, 2 );
|
51 |
add_filter( 'admin_body_class', [ $this, 'toggle_editor_post_title_visibility' ] );
|
52 |
add_filter( 'block_editor_settings', [ $this, 'set_block_template' ] );
|
|
|
53 |
add_filter( 'body_class', array( $this, 'add_fse_body_class' ) );
|
54 |
|
55 |
add_filter( 'post_row_actions', [ $this, 'remove_trash_row_action_for_template_post_types' ], 10, 2 );
|
62 |
add_action( 'transition_post_status', [ $this, 'restrict_template_drafting' ], 10, 3 );
|
63 |
add_action( 'admin_menu', [ $this, 'remove_wp_admin_menu_items' ] );
|
64 |
|
65 |
+
$this->theme_slug = normalize_theme_slug( get_stylesheet() );
|
66 |
$this->wp_template_inserter = new WP_Template_Inserter( $this->theme_slug );
|
67 |
}
|
68 |
|
95 |
$this->wp_template_inserter->insert_default_pages();
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
/**
|
99 |
* Register post types.
|
100 |
*/
|
full-site-editing/dist/full-site-editing.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react-dom', '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' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react-dom', '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' => '68443235274f666f98fde8f0576b39b9');
|
full-site-editing/dist/full-site-editing.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-left:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding-left:0;padding-right:0}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear .7s}.template__block-container.is-hovered .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container.is-selected .template-block__overlay{opacity:1;transition:opacity .2s linear}.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear .7s}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions,.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;padding:9px 10px;margin-left:-8px;border:none;border-right:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .edit-post-layout__content,.post-type-wp_template_part .edit-post-layout__content{background:#eee}.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-layout__content .edit-post-visual-editor{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-left:0;padding-right:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit{margin-right:0;margin-left:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-right:14px;margin-left:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template_part .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
|
1 |
+
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-left:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding-left:0;padding-right:0}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear}.template__block-container.is-hovered .template-block__overlay,.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions,.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;padding:9px 10px;margin-left:-8px;border:none;border-right:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .edit-post-editor-regions__content,.post-type-page .edit-post-layout__content,.post-type-wp_template_part .edit-post-editor-regions__content,.post-type-wp_template_part .edit-post-layout__content{background:#eee}.post-type-page .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-layout__content .edit-post-visual-editor{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-left:0;padding-right:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit{margin-right:0;margin-left:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-right:14px;margin-left:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template_part .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
|
full-site-editing/dist/full-site-editing.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
/*! For license information please see full-site-editing.js.LICENSE */
|
2 |
-
!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 r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));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=45)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){!function(){e.exports=this.wp.components}()},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){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t,n){var o=n(6);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(n,!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var o;!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 c=r.apply(null,o);c&&e.push(c)}else if("object"===i)for(var l in o)n.call(o,l)&&o[l]&&e.push(l)}}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(){e.exports=this.wp.hooks}()},function(e,t){!function(){e.exports=this.wp.domReady}()},function(e,t,n){var o=n(34),r=n(35),i=n(36);e.exports=function(e,t){return o(e)||r(e,t)||i()}},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.htmlEntities}()},function(e,t,n){},function(e,t){!function(){e.exports=this.wp.serverSideRender}()},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(30),r=n(31);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?r(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(32);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){!function(){e.exports=this.wp.editor}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t,n){var o=n(41),r=n(42),i=n(43);e.exports=function(e){return o(e)||r(e)||i()}},function(e,t){!function(){e.exports=this.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){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){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,n){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],o=!0,r=!1,i=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){r=!0,i=a}finally{try{o||null==l.return||l.return()}finally{if(r)throw i}}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){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t,n){},function(e,t,n){"use strict";n.r(t);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(5),b=n(3),f=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(b.withSelect)((function(e){return{isPublished:e("core/editor").isCurrentPostPublished()}}))])((function(e){var t=e.attributes,n=e.backgroundColor,r=e.fontSize,c=e.setAttributes,a=e.setBackgroundColor,u=e.setFontSize,b=e.setTextColor,f=e.textColor,m=e.isPublished,O=t.customFontSize,g=t.textAlign,j=O||r.size;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:g,onChange:function(e){c({textAlign:e})}})),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:j})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:n.color,onChange:a,label:Object(i.__)("Background Color")},{value:f.color,onChange:b,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:f.color,backgroundColor:n.color},{fontSize:j})))),Object(o.createElement)(s.a,{isPublished:m,block:"a8c/navigation-menu",attributes:t}))})),m=(n(29),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:m,category:"layout",supports:{align:["wide","full"],html:!1,reusable:!1},edit:f,save:function(){return null}});var O=n(12),g=n(6),j=n.n(g),v=n(19),h=n.n(v),y=n(20),_=n.n(y),S=n(21),E=n.n(S),k=n(22),w=n.n(k),C=n(23),x=n.n(C),P=n(11),T=n.n(P),B=n(24),I=function(e){function t(){return h()(this,t),E()(this,w()(t).apply(this,arguments))}return x()(t,e),_()(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.attributes.align;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("div",{className:T()("post-content-block",j()({},"align".concat(e),e))},Object(o.createElement)(B.PostTitle,null),Object(o.createElement)(p.InnerBlocks,{templateLock:!1})))}}]),t}(o.Component),N=Object(u.compose)([Object(u.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(b.withSelect)((function(e,t){var n=t.selectedPostId,o=t.selectedPostType;return{selectedPost:(0,e("core").getEntityRecord)("postType",o,n)}}))])(I);n(33);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:N,save:function(){return Object(o.createElement)(p.InnerBlocks.Content,null)}});var A=Object(u.createHigherOrderComponent)((function(e){return function(t){return"a8c/post-content"!==t.name?Object(o.createElement)(e,t):Object(o.createElement)(e,l()({},t,{className:"post-content__block"}))}}),"addContentSlotClassname");Object(O.addFilter)("editor.BlockListBlock","full-site-editing/blocks/post-content",A,9);var z=n(9),D=n.n(z),F=n(14),L=n.n(F),R=n(15),M=n.n(R),V=n(16);function H(e){var t=Object(o.useRef)();return Object(o.useEffect)((function(){t.current=e}),[e]),t.current}function U(e,t,n,r,c,l){var a=Object(o.useState)({option:t,previousOption:"",loaded:!1,error:!1}),s=L()(a,2),u=s[0],p=s[1],d=H(r),b=H(c);function f(){p(D()({},u,{option:u.previousOption,isSaving:!1}))}return Object(o.useEffect)((function(){u.loaded||u.error?function(){var t=u.option,o=u.previousOption,l=!o&&!t||t&&o&&t.trim()===o.trim(),a=!t||0===t.trim().length;!r&&d&&a&&f();if(!c||l)return;!b&&c&&function(t){p(D()({},u,{isSaving:!0})),M()({path:"/wp/v2/settings",method:"POST",data:j()({},e,t)}).then((function(){return function(e){p(D()({},u,{previousOption:e,isDirty:!1,isSaving:!1}))}(t)})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to save site %s"),e)),f()}))}(t)}():M()({path:"/wp/v2/settings"}).then((function(t){return p(D()({},u,{option:Object(V.decodeEntities)(t[e]),previousOption:Object(V.decodeEntities)(t[e]),loaded:!0,error:!1}))})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to load site %s"),e)),p(D()({},u,{option:Object(i.sprintf)(Object(i.__)("Error loading site %s"),e),error:!0}))}))})),{siteOptions:u,handleChange:function(e){l({updated:Date.now()}),p(D()({},u,{option:e}))}}}var W=function(e){return Object(u.createHigherOrderComponent)((function(t){return Object(u.pure)((function(n){var r=Object(b.useSelect)((function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,r=t.isAutosavingPost,i=t.isCurrentPostPublished;return(n()&&i()||o())&&!r()})),i=Object(b.useDispatch)((function(e){return e("core/notices").createErrorNotice})),c=n.isSelected,a=n.setAttributes,s=Object.keys(e).reduce((function(t,n){var o=e[n],l=U(o.optionName,o.defaultValue,i,c,r,a),s=l.siteOptions,u=l.handleChange;return t[n]={value:s.option,updateValue:u,loaded:s.loaded},t}),{});return Object(o.createElement)(t,l()({},n,s))}))}),"withSiteOptions")},q=fullSiteEditing.footerCreditOptions,G=function(e){var t=e.choice,n=q.find((function(e){return e.value===t}));if(!n)return null;var r=n.renderType,i=n.renderProps,c=n.label,l=D()({label:c},i);return"icon"===r?Object(o.createElement)(d.Icon,l):Object(o.createElement)("span",null," ",l.label," ")},Q=fullSiteEditing,Y=Q.footerCreditOptions,J=Q.defaultCreditOption;var K=Object(u.compose)([W({siteTitleOption:{optionName:"title",defaultValue:Object(i.__)("Site title loading…")},footerCreditOption:{optionName:"footer_credit",defaultValue:Object(i.__)("Footer credit loading…")}})])((function(e){var t=e.attributes.textAlign,n=void 0===t?"center":t,r=e.isSelected,i=e.setAttributes,c=e.footerCreditOption,l=c.value,a=c.updateValue,s=e.siteTitleOption.value,u=l||J;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:n,onChange:function(e){i({textAlign:e})}})),Object(o.createElement)("div",{className:T()("site-info","site-credit__block",j()({},"has-text-align-".concat(n),n))},Object(o.createElement)("span",{className:"site-name"},s),Object(o.createElement)("span",{className:"comma"},","),Object(o.createElement)("span",{className:"site-credit__selection"},r?Object(o.createElement)(d.SelectControl,{onChange:a,value:u,options:Y}):Object(o.createElement)(G,{choice:u}))))}));n(37);Object(r.registerBlockType)("a8c/site-credit",{title:Object(i.__)("WordPress.com Credit"),description:Object(i.__)("This block tells the wolrd that you're using WordPress.com."),icon:"wordpress-alt",category:"layout",supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1,removal:!1},attributes:{align:{type:"string",default:"wide"},textAlign:{type:"string",default:"center"}},edit:K,save:function(){return null}});var X=n(8);var Z=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(b.withSelect)((function(e,t){var n=t.clientId,o=e("core/block-editor"),r=o.getBlockIndex,i=o.getBlockRootClientId,c=o.getTemplateLock,l=i(n);return{blockIndex:r(n,l),isLocked:!!c(l),rootClientId:l}})),Object(b.withDispatch)((function(e,t){var n=t.blockIndex,o=t.rootClientId;return{insertDefaultBlock:function(){return e("core/block-editor").insertDefaultBlock({},o,n+1)}}})),W({siteDescription:{optionName:"description",defaultValue:Object(i.__)("Site description loading…")}})])((function(e){var t,n=e.attributes,r=e.backgroundColor,c=e.className,a=e.fontSize,s=e.insertDefaultBlock,u=e.setAttributes,b=e.setBackgroundColor,f=e.setFontSize,m=e.setTextColor,O=e.siteDescription,g=e.textColor,v=n.customFontSize,h=n.textAlign,y=v||a.size,_=O.value,S=O.updateValue;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:h,onChange:function(e){u({textAlign:e})}})),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:r.color,onChange:b,label:Object(i.__)("Background Color")},{value:g.color,onChange:m,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:g.color,backgroundColor:r.color},{fontSize:y})))),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Description"),className:T()("site-description",c,(t={"has-text-color":g.color,"has-background":r.color},j()(t,"has-text-align-".concat(h),h),j()(t,r.class,r.class),j()(t,g.class,g.class),j()(t,a.class,!v&&a.class),t)),identifier:"content",onChange:S,onReplace:s,onSplit:X.noop,placeholder:Object(i.__)("Add a Site Description"),style:{backgroundColor:r.color,color:g.color,fontSize:y?y+"px":void 0},tagName:"p",value:_}))}));n(38);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:Z,save:function(){return null}});var $=Object(u.compose)([Object(p.withColors)({textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(b.withSelect)((function(e,t){var n=t.clientId,o=e("core/block-editor"),r=o.getBlockIndex,i=o.getBlockRootClientId,c=o.getTemplateLock,l=i(n);return{blockIndex:r(n,l),isLocked:!!c(l),rootClientId:l}})),Object(b.withDispatch)((function(e,t){var n=t.blockIndex,o=t.rootClientId;return{insertDefaultBlock:function(){return e("core/block-editor").insertDefaultBlock({},o,n+1)}}})),W({siteTitle:{optionName:"title",defaultValue:Object(i.__)("Site title loading…")}})])((function(e){var t,n=e.attributes,r=e.className,c=e.fontSize,l=e.insertDefaultBlock,a=e.setAttributes,s=e.setFontSize,u=e.setTextColor,b=e.siteTitle,f=e.textColor,m=n.customFontSize,O=n.textAlign,g=m||c.size,v=b.value,h=b.updateValue;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:O,onChange:function(e){a({textAlign:e})}})),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:s,value:g})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:f.color,onChange:u,label:Object(i.__)("Text Color")}]})),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Title"),className:T()("site-title",r,(t={"has-text-color":f.color},j()(t,"has-text-align-".concat(O),O),j()(t,f.class,f.class),j()(t,c.class,!m&&c.class),t)),identifier:"content",onChange:h,onReplace:l,onSplit:X.noop,placeholder:Object(i.__)("Add a Site Title"),style:{color:f.color,fontSize:g?g+"px":void 0},tagName:"h1",value:v}))}));n(39);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:$,save:function(){return null}});var ee=n(25),te=(n(17),Object(u.compose)(Object(u.withState)({templateClientId:null}),Object(b.withSelect)((function(e,t){var n=t.attributes,o=t.templateClientId,r=e("core").getEntityRecord,i=e("core/editor"),c=i.getCurrentPostId,l=i.isEditedPostDirty,a=e("core/block-editor"),s=a.getBlock,u=a.getSelectedBlock,p=e("core/edit-post").isEditorSidebarOpened,d=n.templateId,b=c(),f=d&&r("postType","wp_template_part",d),m=Object(ee.addQueryArgs)(fullSiteEditing.editTemplateBaseUrl,{post:d,fse_parent_post:b}),O=u();return{currentPostId:b,editTemplateUrl:m,template:f,templateBlock:s(o),templateTitle:Object(X.get)(f,["title","rendered"],""),isDirty:l(),isEditorSidebarOpened:!!p(),isAnyTemplateBlockSelected:O&&"a8c/template"===O.name}})),Object(b.withDispatch)((function(e,t){var n=e("core/block-editor").receiveBlocks,o=e("core/edit-post").openGeneralSidebar,i=t.template,c=t.templateClientId,l=t.setState;return{savePost:e("core/editor").savePost,receiveTemplateBlocks:function(){if(i&&!c){var e=Object(r.parse)(Object(X.get)(i,["content","raw"],"")),t=Object(r.createBlock)("core/group",{},e);n([t]),l({templateClientId:t.clientId})}},openGeneralSidebar:o}})))((function(e){var t,n=e.attributes,r=e.editTemplateUrl,c=e.receiveTemplateBlocks,l=e.template,a=e.templateBlock,s=e.templateTitle,u=e.isDirty,b=e.savePost,f=e.isEditorSidebarOpened,m=e.openGeneralSidebar,O=e.isAnyTemplateBlockSelected;if(!l)return Object(o.createElement)(d.Placeholder,null,Object(o.createElement)(d.Spinner,null));var g=Object(o.createRef)(),v=Object(o.useState)(!1),h=L()(v,2),y=h[0],_=h[1];Object(o.useEffect)((function(){y&&!u&&g.current.click(),c()})),Object(o.useEffect)((function(){var e=document.querySelector(".edit-post-sidebar__panel-tabs ul li:last-child");if(f&&e){if(O)return m("edit-post/document"),void e.classList.add("hidden");e.classList.remove("hidden")}}),[O,f,m]);var S=n.align,E=n.className;return Object(o.createElement)("div",{className:T()("template-block",(t={},j()(t,"align".concat(S),S),j()(t,"is-navigating-to-template",y),t))},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:X.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(e){_(!0),u&&(e.preventDefault(),b())},isDefault:!0,isLarge:!0,ref:g},Object(i.sprintf)(Object(i.__)("Edit %s"),s)))))}))),ne=Object(u.createHigherOrderComponent)((function(e){return function(t){return"fse-site-logo"!==t.attributes.className?Object(o.createElement)(e,t):Object(o.createElement)(e,l()({},t,{className:"template__site-logo"}))}}),"addFSESiteLogoClassname");Object(O.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",ne),"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:te,save:function(){return null},getEditWrapperProps:function(){return{"data-align":"full"}}});var oe=Object(u.createHigherOrderComponent)((function(e){return function(t){return"a8c/template"!==t.name?Object(o.createElement)(e,t):Object(o.createElement)(e,l()({},t,{className:"template__block-container"}))}}),"addFSETemplateClassname");Object(O.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",oe,9);var re=n(13),ie=n.n(re),ce=n(26),le=n.n(ce);n(40);ie()((function(){var e,t=fullSiteEditing,n=t.closeButtonLabel,r=t.closeButtonUrl,c=t.editorPostType;if("wp_template_part"===c||"page"===c||"post"===c)var l=setInterval((function(){var t=document.querySelector(".edit-post-header__toolbar");if(t){clearInterval(l);var a=document.createElement("div");a.className="components-toolbar edit-post-fullscreen-mode-close__toolbar edit-post-fullscreen-mode-close__toolbar__override",t.prepend(a);var s=document.createElement("a");if("wp_template_part"===c){s.href=r||"edit.php?post_type=page";var u=Object(i.__)("Go Back");s.setAttribute("aria-label",n||u),s.className="components-button components-icon-button is-button is-default";var p=document.createElement("div");p.innerHTML=n||u,p.className="close-button-override-wide",s.prepend(p);var b=document.createElement("div"),f=Object(i.__)("Back");b.innerHTML=f,b.className="close-button-override-thin",s.prepend(b)}else"page"===c?(s.href="edit.php?post_type=page",e=Object(i.__)("Pages")):"post"===c&&(s.href="edit.php?post_type=post",e=Object(i.__)("Posts"),s.setAttribute("aria-label",e));"page"!==c&&"post"!==c||(s.setAttribute("aria-label",e),le.a.render(Object(o.createElement)(d.Button,{className:"components-button components-icon-button"},Object(o.createElement)(d.Dashicon,{icon:"arrow-left-alt2"}),Object(o.createElement)("div",{className:"close-button-override__label"},e)),s)),a.prepend(s)}}))}));var ae=n(27),se=n.n(ae),ue=n(28),pe=Object(b.withSelect)((function(e){var t=e("core").getEntityRecord,n=e("core/editor").getEditedPostAttribute;return{templateClasses:Object(X.map)(n("template_part_types"),(function(e){var n=Object(X.get)(t("taxonomy","wp_template_part_type",e),"name","");return Object(X.endsWith)(n,"-header")?"fse-header":Object(X.endsWith)(n,"-footer")?"fse-footer":void 0}))}}))((function(e){var t=e.templateClasses,n=setInterval((function(){var e=document.querySelector(".block-editor-writing-flow.editor-writing-flow > div");e&&(clearInterval(n),e.className=T.a.apply(void 0,["a8c-template-editor fse-template-part"].concat(se()(t))))}));return null}));"wp_template_part"===fullSiteEditing.editorPostType&&Object(ue.registerPlugin)("fse-editor-template-classes",{render:pe}),ie()((function(){"wp_template_part"===fullSiteEditing.editorPostType&&Object(b.dispatch)("core/notices").createNotice("info",Object(i.__)("Updates to this template will affect all pages on your site."),{isDismissible:!1})}));var de=Object(u.compose)(Object(b.withSelect)((function(e){var t=e("core/editor").getEditorSettings,n=e("core/block-editor").getBlocks,o=e("core/edit-post").getEditorMode,r=n().find((function(e){return"a8c/post-content"===e.name}));return{rootClientId:r?r.clientId:"",showInserter:"visual"===o()&&t().richEditingEnabled}})))((function(e){var t=e.rootClientId,n=e.showInserter;return Object(o.createElement)(p.Inserter,{rootClientId:t,disabled:!n,position:"bottom right"})}));ie()((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)(de,null),n)}}))}()}));var be=Object(b.subscribe)((function(){if("page"!==fullSiteEditing.editorPostType)return be();!1===Object(b.select)("core/block-editor").isValidTemplate()&&Object(b.dispatch)("core/block-editor").setTemplateValidity(!0)})),fe=["logo","brand","emblem","hallmark"];Object(O.addFilter)("blocks.registerBlockType","full-site-editing/editor/image-block-keywords",(function(e,t){return"core/image"!==t?e:e=Object(X.assign)({},e,{keywords:e.keywords.concat(fe)})}));n(44);Object(b.use)((function(e){return{dispatch:function(t){var n=D()({},e.dispatch(t)),o=fullSiteEditing.editorPostType;return"core/editor"===t&&n.trashPost&&"wp_template_part"===o&&(n.trashPost=function(){}),n}}})),Object(b.use)((function(e){return{dispatch:function(t){var n=D()({},e.dispatch(t)),o=fullSiteEditing.editorPostType;if("core/editor"===t&&n.editPost&&"wp_template_part"===o){var r=n.editPost;n.editPost=function(e){"draft"!==e.status&&r(e)}}return n}}}));var me=Object(b.subscribe)((function(){var e=Object(b.dispatch)("core/edit-post").removeEditorPanel;return"page"===fullSiteEditing.editorPostType&&e("featured-image"),"wp_template_part"===fullSiteEditing.editorPostType&&e("post-status"),me()}))}]));
|
1 |
/*! For license information please see full-site-editing.js.LICENSE */
|
2 |
+
!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 r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));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=45)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){!function(){e.exports=this.wp.components}()},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){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t,n){var o=n(6);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(n,!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var o;!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 c=r.apply(null,o);c&&e.push(c)}else if("object"===i)for(var l in o)n.call(o,l)&&o[l]&&e.push(l)}}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(){e.exports=this.wp.hooks}()},function(e,t,n){var o=n(34),r=n(35),i=n(36);e.exports=function(e,t){return o(e)||r(e,t)||i()}},function(e,t){!function(){e.exports=this.wp.domReady}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.htmlEntities}()},function(e,t,n){},function(e,t){!function(){e.exports=this.wp.serverSideRender}()},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(30),r=n(31);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?r(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(32);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){!function(){e.exports=this.wp.editor}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t,n){var o=n(41),r=n(42),i=n(43);e.exports=function(e){return o(e)||r(e)||i()}},function(e,t){!function(){e.exports=this.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){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){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,n){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],o=!0,r=!1,i=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){r=!0,i=a}finally{try{o||null==l.return||l.return()}finally{if(r)throw i}}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){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t,n){},function(e,t,n){"use strict";n.r(t);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(5),b=n(3),f=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(b.withSelect)((function(e){return{isPublished:e("core/editor").isCurrentPostPublished()}}))])((function(e){var t=e.attributes,n=e.backgroundColor,r=e.fontSize,c=e.setAttributes,a=e.setBackgroundColor,u=e.setFontSize,b=e.setTextColor,f=e.textColor,m=e.isPublished,O=t.customFontSize,g=t.textAlign,j=O||r.size;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:g,onChange:function(e){c({textAlign:e})}})),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:j})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:n.color,onChange:a,label:Object(i.__)("Background Color")},{value:f.color,onChange:b,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:f.color,backgroundColor:n.color},{fontSize:j})))),Object(o.createElement)(s.a,{isPublished:m,block:"a8c/navigation-menu",attributes:t}))})),m=(n(29),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:m,category:"layout",supports:{align:["wide","full","right","left"],html:!1,reusable:!1},edit:f,save:function(){return null}});var O=n(12),g=n(6),j=n.n(g),v=n(19),h=n.n(v),y=n(20),_=n.n(y),S=n(21),E=n.n(S),k=n(22),w=n.n(k),C=n(23),x=n.n(C),P=n(11),T=n.n(P),B=n(24),I=function(e){function t(){return h()(this,t),E()(this,w()(t).apply(this,arguments))}return x()(t,e),_()(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.attributes.align;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("div",{className:T()("post-content-block",j()({},"align".concat(e),e))},Object(o.createElement)(B.PostTitle,null),Object(o.createElement)(p.InnerBlocks,{templateLock:!1})))}}]),t}(o.Component),N=Object(u.compose)([Object(u.withState)({isEditing:!1,selectedPostId:void 0,selectedPostType:void 0}),Object(b.withSelect)((function(e,t){var n=t.selectedPostId,o=t.selectedPostType;return{selectedPost:(0,e("core").getEntityRecord)("postType",o,n)}}))])(I);n(33);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:N,save:function(){return Object(o.createElement)(p.InnerBlocks.Content,null)}});var A=Object(u.createHigherOrderComponent)((function(e){return function(t){return"a8c/post-content"!==t.name?Object(o.createElement)(e,t):Object(o.createElement)(e,l()({},t,{className:"post-content__block"}))}}),"addContentSlotClassname");Object(O.addFilter)("editor.BlockListBlock","full-site-editing/blocks/post-content",A,9);var z=n(9),D=n.n(z),F=n(13),L=n.n(F),R=n(15),M=n.n(R),V=n(16);function U(e){var t=Object(o.useRef)();return Object(o.useEffect)((function(){t.current=e}),[e]),t.current}function H(e,t,n,r,c,l){var a=Object(o.useState)({option:t,previousOption:"",loaded:!1,error:!1}),s=L()(a,2),u=s[0],p=s[1],d=U(r),b=U(c);function f(){p(D()({},u,{option:u.previousOption,isSaving:!1}))}return Object(o.useEffect)((function(){u.loaded||u.error?function(){var t=u.option,o=u.previousOption,l=!o&&!t||t&&o&&t.trim()===o.trim(),a=!t||0===t.trim().length;!r&&d&&a&&f();if(!c||l)return;!b&&c&&function(t){p(D()({},u,{isSaving:!0})),M()({path:"/wp/v2/settings",method:"POST",data:j()({},e,t)}).then((function(){return function(e){p(D()({},u,{previousOption:e,isDirty:!1,isSaving:!1}))}(t)})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to save site %s"),e)),f()}))}(t)}():M()({path:"/wp/v2/settings"}).then((function(t){return p(D()({},u,{option:Object(V.decodeEntities)(t[e]),previousOption:Object(V.decodeEntities)(t[e]),loaded:!0,error:!1}))})).catch((function(){n(Object(i.sprintf)(Object(i.__)("Unable to load site %s"),e)),p(D()({},u,{option:Object(i.sprintf)(Object(i.__)("Error loading site %s"),e),error:!0}))}))})),{siteOptions:u,handleChange:function(e){l({updated:Date.now()}),p(D()({},u,{option:e}))}}}var G=function(e){return Object(u.createHigherOrderComponent)((function(t){return Object(u.pure)((function(n){var r=Object(b.useSelect)((function(e){var t=e("core/editor"),n=t.isSavingPost,o=t.isPublishingPost,r=t.isAutosavingPost,i=t.isCurrentPostPublished;return(n()&&i()||o())&&!r()})),i=Object(b.useDispatch)((function(e){return e("core/notices").createErrorNotice})),c=n.isSelected,a=n.setAttributes,s=Object.keys(e).reduce((function(t,n){var o=e[n],l=H(o.optionName,o.defaultValue,i,c,r,a),s=l.siteOptions,u=l.handleChange;return t[n]={value:s.option,updateValue:u,loaded:s.loaded},t}),{});return Object(o.createElement)(t,l()({},n,s))}))}),"withSiteOptions")},W=fullSiteEditing.footerCreditOptions,q=function(e){var t=e.choice,n=W.find((function(e){return e.value===t}));if(!n)return null;var r=n.renderType,i=n.renderProps,c=n.label,l=D()({label:c},i);return"icon"===r?Object(o.createElement)(d.Icon,l):Object(o.createElement)("span",null," ",l.label," ")},Q=fullSiteEditing,Y=Q.footerCreditOptions,J=Q.defaultCreditOption;var K=Object(u.compose)([G({siteTitleOption:{optionName:"title",defaultValue:Object(i.__)("Site title loading…")},footerCreditOption:{optionName:"footer_credit",defaultValue:Object(i.__)("Footer credit loading…")}})])((function(e){var t=e.attributes.textAlign,n=void 0===t?"center":t,r=e.isSelected,i=e.setAttributes,c=e.footerCreditOption,l=c.value,a=c.updateValue,s=e.siteTitleOption.value,u=l||J;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:n,onChange:function(e){i({textAlign:e})}})),Object(o.createElement)("div",{className:T()("site-info","site-credit__block",j()({},"has-text-align-".concat(n),n))},Object(o.createElement)("span",{className:"site-name"},s),Object(o.createElement)("span",{className:"comma"},","),Object(o.createElement)("span",{className:"site-credit__selection"},r?Object(o.createElement)(d.SelectControl,{onChange:a,value:u,options:Y}):Object(o.createElement)(q,{choice:u}))))}));n(37);Object(r.registerBlockType)("a8c/site-credit",{title:Object(i.__)("WordPress.com Credit"),description:Object(i.__)("This block tells the wolrd that you're using WordPress.com."),icon:"wordpress-alt",category:"layout",supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1,removal:!1},attributes:{align:{type:"string",default:"wide"},textAlign:{type:"string",default:"center"}},edit:K,save:function(){return null}});var X=n(8);var Z=Object(u.compose)([Object(p.withColors)("backgroundColor",{textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(b.withSelect)((function(e,t){var n=t.clientId,o=e("core/block-editor"),r=o.getBlockIndex,i=o.getBlockRootClientId,c=o.getTemplateLock,l=i(n);return{blockIndex:r(n,l),isLocked:!!c(l),rootClientId:l}})),Object(b.withDispatch)((function(e,t){var n=t.blockIndex,o=t.rootClientId;return{insertDefaultBlock:function(){return e("core/block-editor").insertDefaultBlock({},o,n+1)}}})),G({siteDescription:{optionName:"description",defaultValue:Object(i.__)("Site description loading…")}})])((function(e){var t,n=e.attributes,r=e.backgroundColor,c=e.className,a=e.fontSize,s=e.insertDefaultBlock,u=e.setAttributes,b=e.setBackgroundColor,f=e.setFontSize,m=e.setTextColor,O=e.siteDescription,g=e.textColor,v=n.customFontSize,h=n.textAlign,y=v||a.size,_=O.value,S=O.updateValue;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:h,onChange:function(e){u({textAlign:e})}})),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:r.color,onChange:b,label:Object(i.__)("Background Color")},{value:g.color,onChange:m,label:Object(i.__)("Text Color")}]},Object(o.createElement)(p.ContrastChecker,l()({textColor:g.color,backgroundColor:r.color},{fontSize:y})))),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Description"),className:T()("site-description",c,(t={"has-text-color":g.color,"has-background":r.color},j()(t,"has-text-align-".concat(h),h),j()(t,r.class,r.class),j()(t,g.class,g.class),j()(t,a.class,!v&&a.class),t)),identifier:"content",onChange:S,onReplace:s,onSplit:X.noop,placeholder:Object(i.__)("Add a Site Description"),style:{backgroundColor:r.color,color:g.color,fontSize:y?y+"px":void 0},tagName:"p",value:_}))}));n(38);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:Z,save:function(){return null}});var $=Object(u.compose)([Object(p.withColors)({textColor:"color"}),Object(p.withFontSizes)("fontSize"),Object(b.withSelect)((function(e,t){var n=t.clientId,o=e("core/block-editor"),r=o.getBlockIndex,i=o.getBlockRootClientId,c=o.getTemplateLock,l=i(n);return{blockIndex:r(n,l),isLocked:!!c(l),rootClientId:l}})),Object(b.withDispatch)((function(e,t){var n=t.blockIndex,o=t.rootClientId;return{insertDefaultBlock:function(){return e("core/block-editor").insertDefaultBlock({},o,n+1)}}})),G({siteTitle:{optionName:"title",defaultValue:Object(i.__)("Site title loading…")}})])((function(e){var t,n=e.attributes,r=e.className,c=e.fontSize,l=e.insertDefaultBlock,a=e.setAttributes,s=e.setFontSize,u=e.setTextColor,b=e.siteTitle,f=e.textColor,m=n.customFontSize,O=n.textAlign,g=m||c.size,v=b.value,h=b.updateValue;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(p.BlockControls,null,Object(o.createElement)(p.AlignmentToolbar,{value:O,onChange:function(e){a({textAlign:e})}})),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:s,value:g})),Object(o.createElement)(p.PanelColorSettings,{title:Object(i.__)("Color Settings"),initialOpen:!1,colorSettings:[{value:f.color,onChange:u,label:Object(i.__)("Text Color")}]})),Object(o.createElement)(p.RichText,{allowedFormats:[],"aria-label":Object(i.__)("Site Title"),className:T()("site-title",r,(t={"has-text-color":f.color},j()(t,"has-text-align-".concat(O),O),j()(t,f.class,f.class),j()(t,c.class,!m&&c.class),t)),identifier:"content",onChange:h,onReplace:l,onSplit:X.noop,placeholder:Object(i.__)("Add a Site Title"),style:{color:f.color,fontSize:g?g+"px":void 0},tagName:"h1",value:v}))}));n(39);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:$,save:function(){return null}});var ee=n(25),te=(n(17),Object(u.compose)(Object(u.withState)({templateClientId:null}),Object(b.withSelect)((function(e,t){var n=t.attributes,o=t.templateClientId,r=e("core").getEntityRecord,i=e("core/editor"),c=i.getCurrentPostId,l=i.isEditedPostDirty,a=e("core/block-editor"),s=a.getBlock,u=a.getSelectedBlock,p=e("core/edit-post").isEditorSidebarOpened,d=n.templateId,b=c(),f=d&&r("postType","wp_template_part",d),m=Object(ee.addQueryArgs)(fullSiteEditing.editTemplateBaseUrl,{post:d,fse_parent_post:b}),O=u();return{currentPostId:b,editTemplateUrl:m,template:f,templateBlock:s(o),templateTitle:Object(X.get)(f,["title","rendered"],""),isDirty:l(),isEditorSidebarOpened:!!p(),isAnyTemplateBlockSelected:O&&"a8c/template"===O.name}})),Object(b.withDispatch)((function(e,t){var n=e("core/block-editor").receiveBlocks,o=e("core/edit-post").openGeneralSidebar,i=t.template,c=t.templateClientId,l=t.setState;return{savePost:e("core/editor").savePost,receiveTemplateBlocks:function(){if(i&&!c){var e=Object(r.parse)(Object(X.get)(i,["content","raw"],"")),t=Object(r.createBlock)("core/group",{},e);n([t]),l({templateClientId:t.clientId})}},openGeneralSidebar:o}})))((function(e){var t,n=e.attributes,r=e.editTemplateUrl,c=e.receiveTemplateBlocks,l=e.template,a=e.templateBlock,s=e.templateTitle,u=e.isDirty,b=e.savePost,f=e.isEditorSidebarOpened,m=e.openGeneralSidebar,O=e.isAnyTemplateBlockSelected;if(!l)return Object(o.createElement)(d.Placeholder,null,Object(o.createElement)(d.Spinner,null));var g=Object(o.createRef)(),v=Object(o.useState)(!1),h=L()(v,2),y=h[0],_=h[1];Object(o.useEffect)((function(){y&&!u&&g.current.click(),c()})),Object(o.useEffect)((function(){var e=document.querySelector(".edit-post-sidebar__panel-tabs ul li:last-child");if(f&&e){if(O)return m("edit-post/document"),void e.classList.add("hidden");e.classList.remove("hidden")}}),[O,f,m]);var S=n.align,E=n.className,k=function(e){e.stopPropagation(),_(!0),u&&(e.preventDefault(),b())};return Object(o.createElement)("div",{className:T()("template-block",(t={},j()(t,"align".concat(S),S),j()(t,"is-navigating-to-template",y),t))},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:X.noop}))),Object(o.createElement)(d.Placeholder,{className:"template-block__overlay",onClick:k},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:k,isDefault:!0,isLarge:!0,ref:g},Object(i.sprintf)(Object(i.__)("Edit %s"),s)))))}))),ne=Object(u.createHigherOrderComponent)((function(e){return function(t){return"fse-site-logo"!==t.attributes.className?Object(o.createElement)(e,t):Object(o.createElement)(e,l()({},t,{className:"template__site-logo"}))}}),"addFSESiteLogoClassname");Object(O.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",ne),"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:te,save:function(){return null},getEditWrapperProps:function(){return{"data-align":"full"}}});var oe=Object(u.createHigherOrderComponent)((function(e){return function(t){return"a8c/template"!==t.name?Object(o.createElement)(e,t):Object(o.createElement)(e,l()({},t,{className:"template__block-container"}))}}),"addFSETemplateClassname");Object(O.addFilter)("editor.BlockListBlock","full-site-editing/blocks/template",oe,9);var re=n(14),ie=n.n(re),ce=n(26),le=n.n(ce);n(40);function ae(e){var t=e.defaultLabel,n=e.defaultUrl,r=Object(o.useState)(t),i=L()(r,2),c=i[0],l=i[1],a=Object(o.useState)(n),s=L()(a,2),u=s[0],p=s[1];return window.wp.hooks.addAction("updateCloseButtonOverrides","a8c-fse",(function(e){l(e.label),p(e.closeUrl)})),Object(o.createElement)("a",{href:u,"aria-label":c},Object(o.createElement)(d.Button,{className:"components-button components-icon-button"},Object(o.createElement)(d.Dashicon,{icon:"arrow-left-alt2"}),Object(o.createElement)("div",{className:"close-button-override__label"},c)))}ie()((function(){var e=fullSiteEditing.editorPostType;if("wp_template_part"===e||"page"===e||"post"===e)var t=setInterval((function(){var n=document.querySelector(".edit-post-header__toolbar");if(n){clearInterval(t);var r=document.createElement("div");r.className="components-toolbar edit-post-fullscreen-mode-close__toolbar edit-post-fullscreen-mode-close__toolbar__override",n.prepend(r);var c=fullSiteEditing,l=c.closeButtonLabel,a=c.closeButtonUrl,s=window.calypsoifyGutenberg;if(s&&s.closeUrl&&(a=s.closeUrl),s&&s.closeButtonLabel&&(l=s.closeButtonLabel),"wp_template_part"===e){var u=document.createElement("a");u.href=a||"edit.php?post_type=page";var p=Object(i.__)("Go Back");u.setAttribute("aria-label",l||p),u.className="components-button components-icon-button is-button is-default";var d=document.createElement("div");d.innerHTML=l||p,d.className="close-button-override-wide",u.prepend(d);var b=document.createElement("div"),f=Object(i.__)("Back");b.innerHTML=f,b.className="close-button-override-thin",u.prepend(b),r.prepend(u)}if("page"===e||"post"===e){var m=a||"edit.php?post_type=".concat(e),O=l||"Back";"page"!==e||l?"post"!==e||l||(O=Object(i.__)("Posts")):O=Object(i.__)("Pages"),le.a.render(Object(o.createElement)(ae,{defaultLabel:O,defaultUrl:m}),r)}}}))}));var se=n(27),ue=n.n(se),pe=n(28),de=Object(b.withSelect)((function(e){var t=e("core").getEntityRecord,n=e("core/editor").getEditedPostAttribute;return{templateClasses:Object(X.map)(n("template_part_types"),(function(e){var n=Object(X.get)(t("taxonomy","wp_template_part_type",e),"name","");return Object(X.endsWith)(n,"-header")?"fse-header":Object(X.endsWith)(n,"-footer")?"fse-footer":void 0}))}}))((function(e){var t=e.templateClasses,n=setInterval((function(){var e=document.querySelector(".block-editor-writing-flow.editor-writing-flow > div");e&&(clearInterval(n),e.className=T.a.apply(void 0,["a8c-template-editor fse-template-part"].concat(ue()(t))))}));return null}));"wp_template_part"===fullSiteEditing.editorPostType&&Object(pe.registerPlugin)("fse-editor-template-classes",{render:de}),ie()((function(){"wp_template_part"===fullSiteEditing.editorPostType&&Object(b.dispatch)("core/notices").createNotice("info",Object(i.__)("Updates to this template will affect all pages on your site."),{isDismissible:!1})}));var be=Object(u.compose)(Object(b.withSelect)((function(e){var t=e("core/editor").getEditorSettings,n=e("core/block-editor").getBlocks,o=e("core/edit-post").getEditorMode,r=n().find((function(e){return"a8c/post-content"===e.name}));return{rootClientId:r?r.clientId:"",showInserter:"visual"===o()&&t().richEditingEnabled}})))((function(e){var t=e.rootClientId,n=e.showInserter;return Object(o.createElement)(p.Inserter,{rootClientId:t,disabled:!n,position:"bottom right"})}));ie()((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)(be,null),n)}}))}()}));var fe=Object(b.subscribe)((function(){if("page"!==fullSiteEditing.editorPostType)return fe();!1===Object(b.select)("core/block-editor").isValidTemplate()&&Object(b.dispatch)("core/block-editor").setTemplateValidity(!0)})),me=["logo","brand","emblem","hallmark"];Object(O.addFilter)("blocks.registerBlockType","full-site-editing/editor/image-block-keywords",(function(e,t){return"core/image"!==t?e:e=Object(X.assign)({},e,{keywords:e.keywords.concat(me)})}));n(44);Object(b.use)((function(e){return{dispatch:function(t){var n=D()({},e.dispatch(t)),o=fullSiteEditing.editorPostType;return"core/editor"===t&&n.trashPost&&"wp_template_part"===o&&(n.trashPost=function(){}),n}}})),Object(b.use)((function(e){return{dispatch:function(t){var n=D()({},e.dispatch(t)),o=fullSiteEditing.editorPostType;if("core/editor"===t&&n.editPost&&"wp_template_part"===o){var r=n.editPost;n.editPost=function(e){"draft"!==e.status&&r(e)}}return n}}}));var Oe=Object(b.subscribe)((function(){var e=Object(b.dispatch)("core/edit-post").removeEditorPanel;return"page"===fullSiteEditing.editorPostType&&e("featured-image"),"wp_template_part"===fullSiteEditing.editorPostType&&e("post-status"),Oe()}))}]));
|
full-site-editing/dist/full-site-editing.rtl.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-right:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding-right:0;padding-left:0}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear .7s}.template__block-container.is-hovered .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container.is-selected .template-block__overlay{opacity:1;transition:opacity .2s linear}.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear .7s}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;right:0;margin:0;opacity:0;padding:0;position:absolute;left:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions,.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;padding:9px 10px;margin-right:-8px;border:none;border-left:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .edit-post-layout__content,.post-type-wp_template_part .edit-post-layout__content{background:#eee}.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-layout__content .edit-post-visual-editor{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-right:0;padding-left:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit{margin-left:0;margin-right:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-left:14px;margin-right:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template_part .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
|
1 |
+
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-right:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding-right:0;padding-left:0}.template__block-container.is-hovered{cursor:pointer}.template__block-container.is-hovered .components-disabled,.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled{filter:blur(2px);transition:filter .2s linear}.template__block-container.is-hovered .template-block__overlay,.template__block-container.is-hovered .template-block__overlay .components-button,.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay,.template__block-container.is-selected .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;right:0;margin:0;opacity:0;padding:0;position:absolute;left:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template-block__overlay{border-color:rgba(66,88,99,.4)}.editor-block-list__block:first-child .template-block__overlay{border-bottom-width:1px}.editor-block-list__block:last-child .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template-block__overlay{border-width:1px}}.template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s}.template-block__overlay .components-button.hidden{display:none}.template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions,.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;padding:9px 10px;margin-right:-8px;border:none;border-left:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .edit-post-editor-regions__content,.post-type-page .edit-post-layout__content,.post-type-wp_template_part .edit-post-editor-regions__content,.post-type-wp_template_part .edit-post-layout__content{background:#eee}.post-type-page .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-page .edit-post-layout__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-layout__content .edit-post-visual-editor{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-right:0;padding-left:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit{margin-left:0;margin-right:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-left:14px;margin-right:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .editor-writing-flow__click-redirect,.post-type-wp_template_part .editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container [data-block]{margin:0}
|
full-site-editing/editor/style.scss
CHANGED
@@ -22,11 +22,15 @@
|
|
22 |
|
23 |
.post-type-page, .post-type-wp_template_part {
|
24 |
@media ( min-width: 768px ) {
|
25 |
-
.edit-post-layout__content
|
|
|
|
|
26 |
background: #eee;
|
27 |
}
|
28 |
|
29 |
-
.edit-post-layout__content .
|
|
|
|
|
30 |
box-shadow: 0 2px 2px 0 rgba( 0, 0, 0, 0.14 ), 0 3px 1px -2px rgba( 0, 0, 0, 0.12 ), 0 1px 5px 0 rgba( 0, 0, 0, 0.2 );
|
31 |
flex: none;
|
32 |
margin: 36px 32px;
|
22 |
|
23 |
.post-type-page, .post-type-wp_template_part {
|
24 |
@media ( min-width: 768px ) {
|
25 |
+
// @TODO: remove .edit-post-layout__content when Gutenberg 7.0.0 lands in production
|
26 |
+
.edit-post-layout__content,
|
27 |
+
.edit-post-editor-regions__content {
|
28 |
background: #eee;
|
29 |
}
|
30 |
|
31 |
+
// @TODO: remove .edit-post-layout__content when Gutenberg 7.0.0 lands in production
|
32 |
+
.edit-post-layout__content .edit-post-visual-editor,
|
33 |
+
.edit-post-editor-regions__content .edit-post-visual-editor {
|
34 |
box-shadow: 0 2px 2px 0 rgba( 0, 0, 0, 0.14 ), 0 3px 1px -2px rgba( 0, 0, 0, 0.12 ), 0 1px 5px 0 rgba( 0, 0, 0, 0.2 );
|
35 |
flex: none;
|
36 |
margin: 36px 32px;
|
full-site-editing/plugins/close-button-override/index.js
CHANGED
@@ -8,6 +8,7 @@ import domReady from '@wordpress/dom-ready';
|
|
8 |
import ReactDOM from 'react-dom';
|
9 |
import { __ } from '@wordpress/i18n';
|
10 |
import { Button, Dashicon } from '@wordpress/components';
|
|
|
11 |
/* eslint-disable import/no-extraneous-dependencies */
|
12 |
|
13 |
/**
|
@@ -15,9 +16,27 @@ import { Button, Dashicon } from '@wordpress/components';
|
|
15 |
*/
|
16 |
import './style.scss';
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
domReady( () => {
|
19 |
-
const {
|
20 |
-
let newLabel;
|
21 |
|
22 |
// Only alter for the page, post, and template part editors.
|
23 |
if (
|
@@ -43,10 +62,28 @@ domReady( () => {
|
|
43 |
'components-toolbar edit-post-fullscreen-mode-close__toolbar edit-post-fullscreen-mode-close__toolbar__override';
|
44 |
toolbar.prepend( componentsToolbar );
|
45 |
|
46 |
-
//
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if ( 'wp_template_part' === editorPostType ) {
|
|
|
50 |
newCloseButton.href = closeButtonUrl || 'edit.php?post_type=page';
|
51 |
const backupLabel = __( 'Go Back' );
|
52 |
newCloseButton.setAttribute( 'aria-label', closeButtonLabel || backupLabel );
|
@@ -60,27 +97,24 @@ domReady( () => {
|
|
60 |
thinContent.innerHTML = abbreviatedContent;
|
61 |
thinContent.className = 'close-button-override-thin';
|
62 |
newCloseButton.prepend( thinContent );
|
63 |
-
|
64 |
-
newCloseButton.href = 'edit.php?post_type=page';
|
65 |
-
newLabel = __( 'Pages' );
|
66 |
-
} else if ( 'post' === editorPostType ) {
|
67 |
-
newCloseButton.href = 'edit.php?post_type=post';
|
68 |
-
newLabel = __( 'Posts' );
|
69 |
-
newCloseButton.setAttribute( 'aria-label', newLabel );
|
70 |
}
|
71 |
|
|
|
72 |
if ( 'page' === editorPostType || 'post' === editorPostType ) {
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
ReactDOM.render(
|
76 |
-
<
|
77 |
-
|
78 |
-
<div className="close-button-override__label">{ newLabel }</div>
|
79 |
-
</Button>,
|
80 |
-
newCloseButton
|
81 |
);
|
82 |
}
|
83 |
-
|
84 |
-
componentsToolbar.prepend( newCloseButton );
|
85 |
} );
|
86 |
} );
|
8 |
import ReactDOM from 'react-dom';
|
9 |
import { __ } from '@wordpress/i18n';
|
10 |
import { Button, Dashicon } from '@wordpress/components';
|
11 |
+
import { useState } from '@wordpress/element';
|
12 |
/* eslint-disable import/no-extraneous-dependencies */
|
13 |
|
14 |
/**
|
16 |
*/
|
17 |
import './style.scss';
|
18 |
|
19 |
+
function BackButtonOverride( { defaultLabel, defaultUrl } ) {
|
20 |
+
const [ label, updateLabel ] = useState( defaultLabel );
|
21 |
+
const [ url, updateUrl ] = useState( defaultUrl );
|
22 |
+
window.wp.hooks.addAction( 'updateCloseButtonOverrides', 'a8c-fse', data => {
|
23 |
+
updateLabel( data.label );
|
24 |
+
updateUrl( data.closeUrl );
|
25 |
+
} );
|
26 |
+
|
27 |
+
return (
|
28 |
+
<a href={ url } aria-label={ label }>
|
29 |
+
{ /* eslint-disable-next-line wpcalypso/jsx-classname-namespace */ }
|
30 |
+
<Button className="components-button components-icon-button">
|
31 |
+
<Dashicon icon="arrow-left-alt2" />
|
32 |
+
<div className="close-button-override__label">{ label }</div>
|
33 |
+
</Button>
|
34 |
+
</a>
|
35 |
+
);
|
36 |
+
}
|
37 |
+
|
38 |
domReady( () => {
|
39 |
+
const { editorPostType } = fullSiteEditing;
|
|
|
40 |
|
41 |
// Only alter for the page, post, and template part editors.
|
42 |
if (
|
62 |
'components-toolbar edit-post-fullscreen-mode-close__toolbar edit-post-fullscreen-mode-close__toolbar__override';
|
63 |
toolbar.prepend( componentsToolbar );
|
64 |
|
65 |
+
// These should go here so that they have any updates that happened while querying for the selector.
|
66 |
+
let { closeButtonLabel, closeButtonUrl } = fullSiteEditing;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* We have to reference calypsoifyGutenberg off of the window object
|
70 |
+
* directly to handle the case where it is undefined. Otherwise, the
|
71 |
+
* variable declariation itself won't exist, causing a runtime error.
|
72 |
+
*/
|
73 |
+
const { calypsoifyGutenberg } = window;
|
74 |
+
|
75 |
+
// Use wpcom close button/url if they exist.
|
76 |
+
if ( calypsoifyGutenberg && calypsoifyGutenberg.closeUrl ) {
|
77 |
+
closeButtonUrl = calypsoifyGutenberg.closeUrl;
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( calypsoifyGutenberg && calypsoifyGutenberg.closeButtonLabel ) {
|
81 |
+
closeButtonLabel = calypsoifyGutenberg.closeButtonLabel;
|
82 |
+
}
|
83 |
+
|
84 |
+
// Create custom close button for the template part editor.
|
85 |
if ( 'wp_template_part' === editorPostType ) {
|
86 |
+
const newCloseButton = document.createElement( 'a' );
|
87 |
newCloseButton.href = closeButtonUrl || 'edit.php?post_type=page';
|
88 |
const backupLabel = __( 'Go Back' );
|
89 |
newCloseButton.setAttribute( 'aria-label', closeButtonLabel || backupLabel );
|
97 |
thinContent.innerHTML = abbreviatedContent;
|
98 |
thinContent.className = 'close-button-override-thin';
|
99 |
newCloseButton.prepend( thinContent );
|
100 |
+
componentsToolbar.prepend( newCloseButton );
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
|
103 |
+
// Create a "normal" close button for the page/post editor.
|
104 |
if ( 'page' === editorPostType || 'post' === editorPostType ) {
|
105 |
+
const defaultUrl = closeButtonUrl || `edit.php?post_type=${ editorPostType }`;
|
106 |
+
|
107 |
+
let defaultLabel = closeButtonLabel || 'Back';
|
108 |
+
if ( 'page' === editorPostType && ! closeButtonLabel ) {
|
109 |
+
defaultLabel = __( 'Pages' );
|
110 |
+
} else if ( 'post' === editorPostType && ! closeButtonLabel ) {
|
111 |
+
defaultLabel = __( 'Posts' );
|
112 |
+
}
|
113 |
|
114 |
ReactDOM.render(
|
115 |
+
<BackButtonOverride defaultLabel={ defaultLabel } defaultUrl={ defaultUrl } />,
|
116 |
+
componentsToolbar
|
|
|
|
|
|
|
117 |
);
|
118 |
}
|
|
|
|
|
119 |
} );
|
120 |
} );
|
full-site-editing/templates/class-wp-template-inserter.php
CHANGED
@@ -131,6 +131,18 @@ class WP_Template_Inserter {
|
|
131 |
}
|
132 |
|
133 |
$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
// Default to first returned header for now. Support for multiple headers will be added in future iterations.
|
136 |
if ( ! empty( $api_response['headers'] ) ) {
|
131 |
}
|
132 |
|
133 |
$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
|
134 |
+
if ( ! empty( $api_response['code'] ) && 'not_found' === $api_response['code'] ) {
|
135 |
+
do_action(
|
136 |
+
'a8c_fse_log',
|
137 |
+
'template_population_failure',
|
138 |
+
[
|
139 |
+
'context' => 'WP_Template_Inserter->fetch_template_parts',
|
140 |
+
'error' => 'Did not find remote template data for the given theme.',
|
141 |
+
'theme_slug' => $this->theme_slug,
|
142 |
+
]
|
143 |
+
);
|
144 |
+
return;
|
145 |
+
}
|
146 |
|
147 |
// Default to first returned header for now. Support for multiple headers will be added in future iterations.
|
148 |
if ( ! empty( $api_response['headers'] ) ) {
|
full-site-editing/templates/class-wp-template.php
CHANGED
@@ -50,33 +50,9 @@ class WP_Template {
|
|
50 |
if ( ! isset( $theme ) ) {
|
51 |
$theme = get_stylesheet();
|
52 |
}
|
53 |
-
$this->current_theme_name =
|
54 |
}
|
55 |
|
56 |
-
/**
|
57 |
-
* Returns normalized theme slug for the current theme.
|
58 |
-
*
|
59 |
-
* Normalize WP.com theme slugs that differ from those that we'll get on self hosted sites.
|
60 |
-
* For example, we will get 'modern-business-wpcom' when retrieving theme slug on self hosted sites,
|
61 |
-
* but due to WP.com setup, on Simple sites we'll get 'pub/modern-business' for the theme.
|
62 |
-
*
|
63 |
-
* @param string $theme_slug Theme slug to check support for.
|
64 |
-
*
|
65 |
-
* @return string Normalized theme slug.
|
66 |
-
*/
|
67 |
-
public function normalize_theme_slug( $theme_slug ) {
|
68 |
-
if ( 'pub/' === substr( $theme_slug, 0, 4 ) ) {
|
69 |
-
$theme_slug = substr( $theme_slug, 4 );
|
70 |
-
}
|
71 |
-
|
72 |
-
if ( '-wpcom' === substr( $theme_slug, -6, 6 ) ) {
|
73 |
-
$theme_slug = substr( $theme_slug, 0, -6 );
|
74 |
-
}
|
75 |
-
|
76 |
-
return $theme_slug;
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
/**
|
81 |
* Checks whether the provided template type is supported in FSE.
|
82 |
*
|
50 |
if ( ! isset( $theme ) ) {
|
51 |
$theme = get_stylesheet();
|
52 |
}
|
53 |
+
$this->current_theme_name = normalize_theme_slug( $theme );
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
/**
|
57 |
* Checks whether the provided template type is supported in FSE.
|
58 |
*
|
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.3
|
6 |
-
Stable tag: 0.
|
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,15 @@ This plugin is experimental, so we don't provide any support for it outside of w
|
|
42 |
|
43 |
== Changelog ==
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
= 0.15.1 =
|
46 |
|
47 |
* Always open the layout selector if the `?new-homepage` query argument exists.
|
3 |
Tags: block, blocks, editor, gutenberg, page
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 0.16
|
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.16
|
46 |
+
|
47 |
+
* Delegate FSE support detection to themes by leveraging the theme tags.
|
48 |
+
* Enable Global Styles for all template-first themes.
|
49 |
+
* Fix back button navigation issues.
|
50 |
+
* Keep the sidebar layout selector open by default.
|
51 |
+
* Fix editor styles with new Gutenberg version.
|
52 |
+
* Clyck anywhere on header/footer block to Navigate to editor.
|
53 |
+
|
54 |
= 0.15.1 =
|
55 |
|
56 |
* Always open the layout selector if the `?new-homepage` query argument exists.
|
starter-page-templates/dist/starter-page-templates.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-edit-post', 'wp-element', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => '492e327811dd9c56df04a9f780cde043');
|
starter-page-templates/dist/starter-page-templates.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
/*! For license information please see starter-page-templates.js.LICENSE */
|
2 |
-
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=33)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.wp.i18n}()},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){!function(){e.exports=this.wp.components}()},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 r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)&&r.length){var o=i.apply(null,r);o&&e.push(o)}else if("object"===a)for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,n){var r=n(3);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(n,!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t,n){var r=n(23),i=n(24),a=n(25);e.exports=function(e){return r(e)||i(e)||a()}},function(e,t,n){var r=n(26),i=n(27),a=n(28);e.exports=function(e,t){return r(e)||i(e,t)||a()}},function(e,t){!function(){e.exports=this.wp.data}()},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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(29),i=n(5);e.exports=function(e,t){return!t||"object"!==r(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 r=n(30);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&&r(e,t)}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(s){i=!0,a=s}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},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 r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(e){return n(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},r(t)}e.exports=r},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){!function(){e.exports=this.wp.nux}()},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(8),i=n.n(r),a=n(9),o=n.n(a),l=n(10),s=n.n(l),c=n(12),u=n.n(c),p=n(13),m=n.n(p),d=n(14),f=n.n(d),b=n(15),g=n.n(b),v=n(5),O=n.n(v),y=n(16),h=n.n(y),j=n(3),_=n.n(j),w=n(0),E=n(1),T=n(6),S=n.n(T),k=(n(31),n(2)),P=n(7),x=n(4),N=n(18),C=n(11),B=n(19),I=n(20),A=(n(32),n(17)),M=function(e){var t=e.blocks,n=void 0===t?[]:t,r=e.viewportWidth;return n&&n.length?Object(w.createElement)("div",{className:"edit-post-visual-editor"},Object(w.createElement)("div",{className:"editor-styles-wrapper"},Object(w.createElement)("div",{className:"editor-writing-flow"},Object(w.createElement)(A.BlockPreview,{blocks:n,viewportWidth:r})))):null},L=function(e){var t=e.id,n=e.value,r=e.onSelect,i=e.label,a=e.useDynamicPreview,o=void 0!==a&&a,l=e.staticPreviewImg,s=e.staticPreviewImgAlt,c=void 0===s?"":s,u=e.blocks,p=void 0===u?[]:u,m=e.isSelected,d=e.handleTemplateConfirmation;if(Object(E.isNil)(t)||Object(E.isNil)(i)||Object(E.isNil)(n))return null;if(o&&(Object(E.isNil)(p)||Object(E.isEmpty)(p)))return null;var f=o?Object(w.createElement)(x.Disabled,null,Object(w.createElement)(M,{blocks:p,viewportWidth:960})):Object(w.createElement)("img",{className:"template-selector-item__media",src:l,alt:c}),b="label-".concat(t,"-").concat(n);return Object(w.createElement)("button",{type:"button",className:S()("template-selector-item__label",{"is-selected":m}),value:n,onClick:function(){var e=window.matchMedia("(min-width: 660px)").matches;r(n),e||d(n)},"aria-labelledby":"".concat(t," ").concat(b)},Object(w.createElement)("div",{className:"template-selector-item__preview-wrap"},f),Object(w.createElement)("span",{className:"template-selector-item__template-title",id:b},i))},D={Address:Object(k._x)("123 Main St","default address","full-site-editing"),Phone:Object(k._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(k._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(k._x)("Business","default vertical name","full-site-editing")},W={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},U=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?e.replace(/{{(\w+)}}/g,(function(e,n){var r=D[n];return t[W[n]]||r||n})):""},q=Object(P.compose)(w.memo,P.withInstanceId)((function(e){var t=e.label,n=e.className,r=e.help,i=e.instanceId,a=e.templates,o=void 0===a?[]:a,l=e.blocksByTemplates,s=void 0===l?{}:l,c=e.useDynamicPreview,u=void 0!==c&&c,p=e.onTemplateSelect,m=void 0===p?E.noop:p,d=e.siteInformation,f=void 0===d?{}:d,b=e.selectedTemplate,g=e.handleTemplateConfirmation,v=void 0===g?E.noop:g;if(Object(E.isEmpty)(o)||!Object(E.isArray)(o))return null;if(!0===u&&Object(E.isEmpty)(s))return null;var O="template-selector-control-".concat(i);return Object(w.createElement)(x.BaseControl,{label:t,id:O,help:r,className:S()(n,"template-selector-control")},Object(w.createElement)("ul",{className:"template-selector-control__options","data-testid":"template-selector-control-options"},Object(E.map)(o,(function(e){var t=e.slug,n=e.title,i=e.preview,a=e.previewAlt;return Object(w.createElement)("li",{key:"".concat(O,"-").concat(t),className:"template-selector-control__template"},Object(w.createElement)(L,{id:O,value:t,label:U(n,f),help:r,onSelect:m,staticPreviewImg:i,staticPreviewImgAlt:a,blocks:s.hasOwnProperty(t)?s[t]:[],useDynamicPreview:u,isSelected:t===b,handleTemplateConfirmation:v}))}))))})),F=function(e){var t=e.title,n=e.transform;return(Object(w.createElement)("div",{className:"editor-post-title",style:{transform:n}},Object(w.createElement)("div",{className:"wp-block editor-post-title__block"},Object(w.createElement)("textarea",{className:"editor-post-title__input",value:t,onChange:function(){}}))))},R=function(e){return Object(w.createElement)(A.BlockPreview,e)},G=function(e){var t=e.blocks,n=e.viewportWidth,r=e.title,i=Object(w.useState)("hidden"),a=s()(i,2),o=a[0],l=a[1],c=Object(w.useRef)(null),u=Object(w.useReducer)((function(e){return e+1}),0),p=s()(u,2),m=p[0],d=p[1],f=function(){setTimeout((function(){if(c&&c.current){var e=c.current.querySelector(".block-editor-block-preview__content");if(e){var t=window.getComputedStyle(e);if(t&&t.transform){var n=c.current.querySelector(".editor-post-title");n&&(n.style.transform=t.transform);var r=t.transform.replace(/matrix\((.+)\)$/i,"$1").split(",");r=r&&r.length?Number(r[0]):null,r=isNaN(r)?null:r;var i=e.closest(".template-selector-preview__offset-correction");if(i&&r){var a=n?n.offsetHeight:null;i.style.top="".concat(a*r,"px")}}l("visible")}}}),300)};return Object(w.useLayoutEffect)((function(){l("hidden"),f()}),[t]),Object(w.useEffect)((function(){if(t&&t.length){var e=Object(E.debounce)((function(){f(),d()}),300);return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}}),[t]),Object(E.isEmpty)(t)||!Object(E.isArray)(t)?Object(w.createElement)("div",{className:S()("template-selector-preview","is-blank-preview")},Object(w.createElement)("div",{className:"template-selector-preview__placeholder"},Object(k.__)("Select a layout to preview.","full-site-editing"))):Object(w.createElement)("div",{className:"template-selector-preview"},Object(w.createElement)(x.Disabled,null,Object(w.createElement)("div",{ref:c,className:"edit-post-visual-editor"},Object(w.createElement)("div",{className:"editor-styles-wrapper",style:{visibility:o}},Object(w.createElement)("div",{className:"editor-writing-flow"},Object(w.createElement)(F,{title:r}),Object(w.createElement)("div",{className:"template-selector-preview__offset-correction"},Object(w.createElement)(R,{key:m,blocks:t,viewportWidth:n})))))))};window._tkq=window._tkq||[];var z,V=null,H=function(e,t){V&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:V.blogid,segment_id:e,vertical_id:t}])},$=function(e,t,n){V&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:V.blogid,segment_id:e,vertical_id:t,template:n}])},Q=n(21),Y=n.n(Q),J=n(22),K=function(e,t,n){var r=e[t=Object(J.removeQueryArgs)(t,"w","s")]||{url:t,usages:[]};return i()({},e,_()({},t,i()({},r,{usages:[].concat(o()(r.usages),o()(n))})))},X=function e(t,n){switch(t.blocksByClientId[n.clientId]=n,n.name){case"core/cover":case"core/image":var r=n.attributes.url;r&&(t.assets=K(t.assets,r,[{prop:"url",path:[n.clientId,"attributes","url"]},{prop:"id",path:[n.clientId,"attributes","id"]}]));case"core/media-text":var i=n.attributes.mediaUrl;i&&"image"===n.attributes.mediaType&&(t.assets=K(t.assets,i,[{prop:"url",path:[n.clientId,"attributes","mediaUrl"]},{prop:"id",path:[n.clientId,"attributes","mediaId"]}]));case"core/gallery":Object(E.forEach)(n.attributes.images,(function(e,r){t.assets=K(t.assets,e.url,[{prop:"url",path:[n.clientId,"attributes","images",r,"url"]},{prop:"url",path:[n.clientId,"attributes","images",r,"link"]},{prop:"id",path:[n.clientId,"attributes","images",r,"id"]},{prop:"id",path:[n.clientId,"attributes","ids",r]}])}))}return Object(E.isEmpty)(n.innerBlocks)?t:Object(E.reduce)(n.innerBlocks,e,t)},Z=function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,regeneratorRuntime.awrap(Y()({method:"POST",path:"/fse/v1/sideload/image/batch",data:{resources:Object(E.map)(e)}}).then((function(t){return Object(E.reduce)(e,(function(e,n){var r=t.shift(),a=r.id,o=r.source_url;return i()({},e,_()({},n.url,{id:a,url:o}))}),{})})));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}))},ee=function(e,t){return Object(E.forEach)(e.assets,(function(n){var r=t[n.url];r&&Object(E.forEach)(n.usages,(function(t){Object(E.set)(e.blocksByClientId,t.path,r[t.prop])}))})),e.blocks},te=function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=Object(E.reduce)(e,X,{assets:{},blocksByClientId:{},blocks:e}),!Object(E.isEmpty)(t.assets)){n.next=3;break}return n.abrupt("return",e);case 3:return n.abrupt("return",Z(t.assets).then((function(e){return ee(t,e)})));case 4:case"end":return n.stop()}}))},ne=starterPageTemplatesConfig,re=ne.theme,ie=ne.isFrontPage,ae=function(e){function t(){var e,n;u()(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=f()(this,(e=g()(t)).call.apply(e,[this].concat(i))),_()(O()(n),"state",{isTemplateModalOpen:!1,isWarningOpen:!1}),_()(O()(n),"toggleTemplateModal",(function(){n.setState({isTemplateModalOpen:!n.state.isTemplateModalOpen})})),_()(O()(n),"toggleWarningModal",(function(){n.setState({isWarningOpen:!n.state.isWarningOpen})})),_()(O()(n),"getLastTemplateUsed",(function(){var e=n.props.templates,t=n.props.lastTemplateUsedSlug;if(!t&&ie&&(t=re),!t||"blank"===t)return e[0];var r=e.find((function(e){return e.slug===t}));return r||e[0]})),n}return h()(t,e),m()(t,[{key:"render",value:function(){var e=this.getLastTemplateUsed(),t=e.slug,n=e.title,r=e.preview,i=e.previewAlt,a=this.props,o=a.templates,l=a.vertical,s=a.segment,c=a.siteInformation;return Object(w.createElement)("div",{className:"sidebar-modal-opener"},Object(w.createElement)(L,{id:"sidebar-modal-opener__last-template-used-preview",value:t,label:U(n,c),staticPreviewImg:r,staticPreviewImgAlt:i,onSelect:this.toggleWarningModal}),Object(w.createElement)(x.Button,{isPrimary:!0,onClick:this.toggleWarningModal,className:"sidebar-modal-opener__button"},Object(k.__)("Change Layout")),this.state.isTemplateModalOpen&&Object(w.createElement)(he,{shouldPrefetchAssets:!1,templates:o,vertical:l,segment:s,toggleTemplateModal:this.toggleTemplateModal,isPromptedFromSidebar:!0}),this.state.isWarningOpen&&Object(w.createElement)(x.Modal,{title:Object(k.__)("Overwrite Page Content?"),isDismissible:!1,onRequestClose:this.toggleWarningModal,className:"sidebar-modal-opener__warning-modal"},Object(w.createElement)("div",{className:"sidebar-modal-opener__warning-text"},Object(k.__)("Changing the page's layout will remove any customizations or edits you have already made.")),Object(w.createElement)("div",{className:"sidebar-modal-opener__warning-options"},Object(w.createElement)(x.Button,{isDefault:!0,onClick:this.toggleWarningModal},Object(k.__)("Cancel")),Object(w.createElement)(x.Button,{isPrimary:!0,onClick:this.toggleTemplateModal},Object(k.__)("Change Layout")))))}}]),t}(w.Component),oe=Object(P.compose)(Object(C.withSelect)((function(e){return{lastTemplateUsedSlug:e("core/editor").getEditedPostAttribute("meta")._starter_page_template}})))(ae),le="maywood",se=window.starterPageTemplatesConfig,ce=se.templates,ue=void 0===ce?[]:ce,pe=se.vertical,me=se.segment,de=se.tracksUserData,fe=se.siteInformation,be=void 0===fe?{}:fe,ge=se.screenAction,ve=se.theme,Oe=se.isFrontPage,ye=function(e){function t(e){var n;u()(this,t),n=f()(this,g()(t).call(this)),_()(O()(n),"state",{isLoading:!1,previewedTemplate:null,blocksByTemplateSlug:{},titlesByTemplateSlug:{},error:null,isOpen:!1}),_()(O()(n),"getDefaultSelectedTemplate",(function(e){var t=Object(E.get)(e.templates,[0,"slug"]),n=e._starter_page_template;if(!Oe&&!n)return t;"home"===n&&(n=ve);var r=n||ve;return Object(E.find)(e.templates,{slug:r})?r:Object(E.find)(e.templates,{slug:le})?le:t})),_()(O()(n),"setTemplate",(function(e){$(n.props.segment.id,n.props.vertical.id,e),n.props.saveTemplateChoice(e);var t=Object(E.find)(n.props.templates,{slug:e,category:"home"}),r=n.getBlocksByTemplateSlug(e),i=t?null:n.getTitleByTemplateSlug(e);r&&r.length?(n.setState({error:null,isLoading:!0}),n.maybePrefetchAssets(r).then((function(e){n.state.isOpen&&(n.props.insertTemplate(i,e),n.setState({isOpen:!1}))})).catch((function(e){n.setState({isLoading:!1,error:e})}))):n.setState({isOpen:!1})})),_()(O()(n),"maybePrefetchAssets",(function(e){return n.props.shouldPrefetchAssets?te(e):Promise.resolve(e)})),_()(O()(n),"handleConfirmation",(function(e){"string"!=typeof e&&(e=n.state.previewedTemplate),n.setTemplate(e),n.props.isPromptedFromSidebar&&n.props.toggleTemplateModal()})),_()(O()(n),"previewTemplate",(function(e){return n.setState({previewedTemplate:e})})),_()(O()(n),"closeModal",(function(e){if(e.target.matches("button.template-selector-item__label"))return!1;H(n.props.segment.id,n.props.vertical.id);var t=Object(E.get)(window,["calypsoifyGutenberg","closeUrl"]);window.top.location=t||"edit.php?post_type=page"})),_()(O()(n),"getTemplateGroups",(function(){var e=Object(E.partition)(n.props.templates,{category:"home"}),t=s()(e,2),r=t[0],i=t[1],a=Object(E.find)(n.props.templates,{slug:ve})||Object(E.find)(n.props.templates,{slug:le});if(!Oe||!a)return{homepageTemplates:Object(E.sortBy)(r,"title"),defaultTemplates:i};var l=Object(E.reject)(r,{slug:a.slug});return{homepageTemplates:[a].concat(o()(Object(E.sortBy)(l,"title"))),defaultTemplates:i}})),_()(O()(n),"renderTemplatesList",(function(e,t){return Object(w.createElement)("fieldset",{className:"page-template-modal__list"},Object(w.createElement)("legend",{className:"page-template-modal__form-title"},t),Object(w.createElement)(q,{label:Object(k.__)("Layout","full-site-editing"),templates:e,blocksByTemplates:n.state.blocksByTemplateSlug,onTemplateSelect:n.previewTemplate,useDynamicPreview:!1,siteInformation:be,selectedTemplate:n.state.previewedTemplate,handleTemplateConfirmation:n.handleConfirmation}))}));var r=!Object(E.isEmpty)(e.templates);return n.state.isOpen=r,r&&(n.state.previewedTemplate=n.getDefaultSelectedTemplate(e),n.state.titlesByTemplateSlug=Object(E.mapValues)(Object(E.keyBy)(e.templates,"slug"),"title")),n}return h()(t,e),m()(t,[{key:"componentDidMount",value:function(){var e,t;this.state.isOpen&&(e=this.props.segment.id,t=this.props.vertical.id,V&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:V.blogid,segment_id:e,vertical_id:t}]));var n=Object(E.reduce)(ue,(function(e,t){var n=t.slug,r=t.content;return e[n]=r?Object(B.parse)(U(r,be)):[],e}),{});this.setState({blocksByTemplateSlug:n})}},{key:"getBlocksByTemplateSlug",value:function(e){return Object(E.get)(this.state.blocksByTemplateSlug,[e],[])}},{key:"getTitleByTemplateSlug",value:function(e){return Object(E.get)(this.state.titlesByTemplateSlug,[e],"")}},{key:"render",value:function(){var e=this.state,t=e.previewedTemplate,n=e.isOpen,r=e.isLoading,i=this.props.isPromptedFromSidebar;if(!n)return null;var a=this.getTemplateGroups(),o=a.homepageTemplates,l=a.defaultTemplates;return Object(w.createElement)(x.Modal,{title:Object(k.__)("Select Page Layout","full-site-editing"),className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay",shouldCloseOnClickOutside:!1,isDismissable:!1,isDismissible:!1},i?Object(w.createElement)(x.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.props.toggleTemplateModal,icon:"no-alt",label:Object(k.__)("Close Layout Selector")}):Object(w.createElement)(x.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.closeModal,icon:"arrow-left-alt2",label:Object(k.__)("Go back")}),Object(w.createElement)("div",{className:"page-template-modal__inner"},r?Object(w.createElement)("div",{className:"page-template-modal__loading"},Object(w.createElement)(x.Spinner,null),Object(k.__)("Adding layout…","full-site-editing")):Object(w.createElement)(w.Fragment,null,Object(w.createElement)("form",{className:"page-template-modal__form"},Oe?Object(w.createElement)(w.Fragment,null,this.renderTemplatesList(o,Object(k.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(l,Object(k.__)("Other Page Layouts","full-site-editing"))):Object(w.createElement)(w.Fragment,null,this.renderTemplatesList(l,Object(k.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(o,Object(k.__)("Homepage Layouts","full-site-editing")))),Object(w.createElement)(G,{blocks:this.getBlocksByTemplateSlug(t),viewportWidth:960,title:this.getTitleByTemplateSlug(t)}))),Object(w.createElement)("div",{className:S()("page-template-modal__buttons",{"is-visually-hidden":Object(E.isEmpty)(t)||r})},Object(w.createElement)(x.Button,{isPrimary:!0,isLarge:!0,disabled:Object(E.isEmpty)(t)||r,onClick:this.handleConfirmation},Object(k.sprintf)(Object(k.__)("Use %s layout","full-site-editing"),this.getTitleByTemplateSlug(t)))))}}]),t}(w.Component),he=Object(P.compose)(Object(C.withSelect)((function(e){var t=function(){return e("core/editor").getEditedPostAttribute("meta")},n=t();return{getMeta:t,_starter_page_template:n._starter_page_template,postContentBlock:e("core/editor").getBlocks().find((function(e){return"a8c/post-content"===e.name}))}})),Object(C.withDispatch)((function(e,t){e("core/nux").disableTips();var n=e("core/editor");return{saveTemplateChoice:function(e){var r=t.getMeta();n.editPost({meta:i()({},r,{_starter_page_template:e})})},insertTemplate:function(r,i){r&&n.editPost({title:r});var a=t.postContentBlock;e("core/block-editor").replaceInnerBlocks(a?a.clientId:"",i,!1)}}})))(ye);de&&(V=z=de,window._tkq.push(["identifyUser",z.userid,z.username])),"add"===ge&&Object(N.registerPlugin)("page-templates",{render:function(){return Object(w.createElement)(he,{shouldPrefetchAssets:!1,templates:ue,vertical:pe,segment:me})}}),Object(N.registerPlugin)("page-templates-sidebar",{render:function(){return Object(w.createElement)(I.PluginDocumentSettingPanel,{name:"Template Modal Opener",title:Object(k.__)("Page Layout"),className:"page-template-modal__sidebar",icon:"admin-page"},Object(w.createElement)(oe,{templates:ue,vertical:pe,segment:me,siteInformation:be}))}})}]));
|
1 |
/*! For license information please see starter-page-templates.js.LICENSE */
|
2 |
+
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},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=33)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.wp.i18n}()},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){!function(){e.exports=this.wp.components}()},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 r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var o=a.apply(null,r);o&&e.push(o)}else if("object"===i)for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,n){var r=n(3);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(n,!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t,n){var r=n(23),a=n(24),i=n(25);e.exports=function(e){return r(e)||a(e)||i()}},function(e,t,n){var r=n(26),a=n(27),i=n(28);e.exports=function(e,t){return r(e)||a(e,t)||i()}},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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(29),a=n(5);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?a(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 r=n(30);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&&r(e,t)}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(s){a=!0,i=s}finally{try{r||null==l.return||l.return()}finally{if(a)throw i}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},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 r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(e){return n(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},r(t)}e.exports=r},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){!function(){e.exports=this.wp.nux}()},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(9),a=n.n(r),i=n(10),o=n.n(i),l=n(11),s=n.n(l),c=n(12),u=n.n(c),p=n(13),m=n.n(p),d=n(14),f=n.n(d),b=n(15),g=n.n(b),v=n(5),O=n.n(v),y=n(16),h=n.n(y),j=n(3),_=n.n(j),w=n(0),E=n(1),T=n(6),S=n.n(T),k=(n(31),n(2)),P=n(8),x=n(4),N=n(18),C=n(7),B=n(19),I=n(20),M=(n(32),n(17)),A=function(e){var t=e.blocks,n=void 0===t?[]:t,r=e.viewportWidth;return n&&n.length?Object(w.createElement)("div",{className:"edit-post-visual-editor"},Object(w.createElement)("div",{className:"editor-styles-wrapper"},Object(w.createElement)("div",{className:"editor-writing-flow"},Object(w.createElement)(M.BlockPreview,{blocks:n,viewportWidth:r})))):null},L=function(e){var t=e.id,n=e.value,r=e.onSelect,a=e.label,i=e.useDynamicPreview,o=void 0!==i&&i,l=e.staticPreviewImg,s=e.staticPreviewImgAlt,c=void 0===s?"":s,u=e.blocks,p=void 0===u?[]:u,m=e.isSelected,d=e.handleTemplateConfirmation;if(Object(E.isNil)(t)||Object(E.isNil)(a)||Object(E.isNil)(n))return null;if(o&&(Object(E.isNil)(p)||Object(E.isEmpty)(p)))return null;var f=o?Object(w.createElement)(x.Disabled,null,Object(w.createElement)(A,{blocks:p,viewportWidth:960})):Object(w.createElement)("img",{className:"template-selector-item__media",src:l,alt:c}),b="label-".concat(t,"-").concat(n);return Object(w.createElement)("button",{type:"button",className:S()("template-selector-item__label",{"is-selected":m}),value:n,onClick:function(){var e=window.matchMedia("(min-width: 660px)").matches;r(n),e||d(n)},"aria-labelledby":"".concat(t," ").concat(b)},Object(w.createElement)("div",{className:"template-selector-item__preview-wrap"},f),Object(w.createElement)("span",{className:"template-selector-item__template-title",id:b},a))},D={Address:Object(k._x)("123 Main St","default address","full-site-editing"),Phone:Object(k._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(k._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(k._x)("Business","default vertical name","full-site-editing")},W={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},U=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?e.replace(/{{(\w+)}}/g,(function(e,n){var r=D[n];return t[W[n]]||r||n})):""},q=Object(P.compose)(w.memo,P.withInstanceId)((function(e){var t=e.label,n=e.className,r=e.help,a=e.instanceId,i=e.templates,o=void 0===i?[]:i,l=e.blocksByTemplates,s=void 0===l?{}:l,c=e.useDynamicPreview,u=void 0!==c&&c,p=e.onTemplateSelect,m=void 0===p?E.noop:p,d=e.siteInformation,f=void 0===d?{}:d,b=e.selectedTemplate,g=e.handleTemplateConfirmation,v=void 0===g?E.noop:g;if(Object(E.isEmpty)(o)||!Object(E.isArray)(o))return null;if(!0===u&&Object(E.isEmpty)(s))return null;var O="template-selector-control-".concat(a);return Object(w.createElement)(x.BaseControl,{label:t,id:O,help:r,className:S()(n,"template-selector-control")},Object(w.createElement)("ul",{className:"template-selector-control__options","data-testid":"template-selector-control-options"},Object(E.map)(o,(function(e){var t=e.slug,n=e.title,a=e.preview,i=e.previewAlt;return Object(w.createElement)("li",{key:"".concat(O,"-").concat(t),className:"template-selector-control__template"},Object(w.createElement)(L,{id:O,value:t,label:U(n,f),help:r,onSelect:m,staticPreviewImg:a,staticPreviewImgAlt:i,blocks:s.hasOwnProperty(t)?s[t]:[],useDynamicPreview:u,isSelected:t===b,handleTemplateConfirmation:v}))}))))})),F=function(e){var t=e.title,n=e.transform;return(Object(w.createElement)("div",{className:"editor-post-title",style:{transform:n}},Object(w.createElement)("div",{className:"wp-block editor-post-title__block"},Object(w.createElement)("textarea",{className:"editor-post-title__input",value:t,onChange:function(){}}))))},R=function(e){return Object(w.createElement)(M.BlockPreview,e)},G=function(e){var t=e.blocks,n=e.viewportWidth,r=e.title,a=Object(w.useState)("hidden"),i=s()(a,2),o=i[0],l=i[1],c=Object(w.useRef)(null),u=Object(w.useReducer)((function(e){return e+1}),0),p=s()(u,2),m=p[0],d=p[1],f=function(){setTimeout((function(){if(c&&c.current){var e=c.current.querySelector(".block-editor-block-preview__content");if(e){var t=window.getComputedStyle(e);if(t&&t.transform){var n=c.current.querySelector(".editor-post-title");n&&(n.style.transform=t.transform);var r=t.transform.replace(/matrix\((.+)\)$/i,"$1").split(",");r=r&&r.length?Number(r[0]):null,r=isNaN(r)?null:r;var a=e.closest(".template-selector-preview__offset-correction");if(a&&r){var i=n?n.offsetHeight:null;a.style.top="".concat(i*r,"px")}}l("visible")}}}),300)};return Object(w.useLayoutEffect)((function(){l("hidden"),f()}),[t]),Object(w.useEffect)((function(){if(t&&t.length){var e=Object(E.debounce)((function(){f(),d()}),300);return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}}),[t]),Object(E.isEmpty)(t)||!Object(E.isArray)(t)?Object(w.createElement)("div",{className:S()("template-selector-preview","is-blank-preview")},Object(w.createElement)("div",{className:"template-selector-preview__placeholder"},Object(k.__)("Select a layout to preview.","full-site-editing"))):Object(w.createElement)("div",{className:"template-selector-preview"},Object(w.createElement)(x.Disabled,null,Object(w.createElement)("div",{ref:c,className:"edit-post-visual-editor"},Object(w.createElement)("div",{className:"editor-styles-wrapper",style:{visibility:o}},Object(w.createElement)("div",{className:"editor-writing-flow"},Object(w.createElement)(F,{title:r}),Object(w.createElement)("div",{className:"template-selector-preview__offset-correction"},Object(w.createElement)(R,{key:m,blocks:t,viewportWidth:n})))))))};window._tkq=window._tkq||[];var z,V=null,H=function(e,t){V&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:V.blogid,segment_id:e,vertical_id:t}])},$=function(e,t,n){V&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:V.blogid,segment_id:e,vertical_id:t,template:n}])},Q=n(21),Y=n.n(Q),J=n(22),K=function(e,t,n){var r=e[t=Object(J.removeQueryArgs)(t,"w","s")]||{url:t,usages:[]};return a()({},e,_()({},t,a()({},r,{usages:[].concat(o()(r.usages),o()(n))})))},X=function e(t,n){switch(t.blocksByClientId[n.clientId]=n,n.name){case"core/cover":case"core/image":var r=n.attributes.url;r&&(t.assets=K(t.assets,r,[{prop:"url",path:[n.clientId,"attributes","url"]},{prop:"id",path:[n.clientId,"attributes","id"]}]));case"core/media-text":var a=n.attributes.mediaUrl;a&&"image"===n.attributes.mediaType&&(t.assets=K(t.assets,a,[{prop:"url",path:[n.clientId,"attributes","mediaUrl"]},{prop:"id",path:[n.clientId,"attributes","mediaId"]}]));case"core/gallery":Object(E.forEach)(n.attributes.images,(function(e,r){t.assets=K(t.assets,e.url,[{prop:"url",path:[n.clientId,"attributes","images",r,"url"]},{prop:"url",path:[n.clientId,"attributes","images",r,"link"]},{prop:"id",path:[n.clientId,"attributes","images",r,"id"]},{prop:"id",path:[n.clientId,"attributes","ids",r]}])}))}return Object(E.isEmpty)(n.innerBlocks)?t:Object(E.reduce)(n.innerBlocks,e,t)},Z=function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,regeneratorRuntime.awrap(Y()({method:"POST",path:"/fse/v1/sideload/image/batch",data:{resources:Object(E.map)(e)}}).then((function(t){return Object(E.reduce)(e,(function(e,n){var r=t.shift(),i=r.id,o=r.source_url;return a()({},e,_()({},n.url,{id:i,url:o}))}),{})})));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}))},ee=function(e,t){return Object(E.forEach)(e.assets,(function(n){var r=t[n.url];r&&Object(E.forEach)(n.usages,(function(t){Object(E.set)(e.blocksByClientId,t.path,r[t.prop])}))})),e.blocks},te=function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=Object(E.reduce)(e,X,{assets:{},blocksByClientId:{},blocks:e}),!Object(E.isEmpty)(t.assets)){n.next=3;break}return n.abrupt("return",e);case 3:return n.abrupt("return",Z(t.assets).then((function(e){return ee(t,e)})));case 4:case"end":return n.stop()}}))},ne=starterPageTemplatesConfig,re=ne.theme,ae=ne.isFrontPage,ie=function(e){function t(){var e,n;u()(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return n=f()(this,(e=g()(t)).call.apply(e,[this].concat(a))),_()(O()(n),"state",{isTemplateModalOpen:!1,isWarningOpen:!1}),_()(O()(n),"toggleTemplateModal",(function(){n.setState({isTemplateModalOpen:!n.state.isTemplateModalOpen})})),_()(O()(n),"toggleWarningModal",(function(){n.setState({isWarningOpen:!n.state.isWarningOpen})})),_()(O()(n),"getLastTemplateUsed",(function(){var e=n.props.templates,t=n.props.lastTemplateUsedSlug;if(!t&&ae&&(t=re),!t||"blank"===t)return e[0];var r=e.find((function(e){return e.slug===t}));return r||e[0]})),n}return h()(t,e),m()(t,[{key:"render",value:function(){var e=this.getLastTemplateUsed(),t=e.slug,n=e.title,r=e.preview,a=e.previewAlt,i=this.props,o=i.templates,l=i.vertical,s=i.segment,c=i.siteInformation;return Object(w.createElement)("div",{className:"sidebar-modal-opener"},Object(w.createElement)(L,{id:"sidebar-modal-opener__last-template-used-preview",value:t,label:U(n,c),staticPreviewImg:r,staticPreviewImgAlt:a,onSelect:this.toggleWarningModal}),Object(w.createElement)(x.Button,{isPrimary:!0,onClick:this.toggleWarningModal,className:"sidebar-modal-opener__button"},Object(k.__)("Change Layout")),this.state.isTemplateModalOpen&&Object(w.createElement)(he,{shouldPrefetchAssets:!1,templates:o,vertical:l,segment:s,toggleTemplateModal:this.toggleTemplateModal,isPromptedFromSidebar:!0}),this.state.isWarningOpen&&Object(w.createElement)(x.Modal,{title:Object(k.__)("Overwrite Page Content?"),isDismissible:!1,onRequestClose:this.toggleWarningModal,className:"sidebar-modal-opener__warning-modal"},Object(w.createElement)("div",{className:"sidebar-modal-opener__warning-text"},Object(k.__)("Changing the page's layout will remove any customizations or edits you have already made.")),Object(w.createElement)("div",{className:"sidebar-modal-opener__warning-options"},Object(w.createElement)(x.Button,{isDefault:!0,onClick:this.toggleWarningModal},Object(k.__)("Cancel")),Object(w.createElement)(x.Button,{isPrimary:!0,onClick:this.toggleTemplateModal},Object(k.__)("Change Layout")))))}}]),t}(w.Component),oe=Object(P.compose)(Object(C.withSelect)((function(e){return{lastTemplateUsedSlug:e("core/editor").getEditedPostAttribute("meta")._starter_page_template}})))(ie),le="maywood",se=window.starterPageTemplatesConfig,ce=se.templates,ue=void 0===ce?[]:ce,pe=se.vertical,me=se.segment,de=se.tracksUserData,fe=se.siteInformation,be=void 0===fe?{}:fe,ge=se.screenAction,ve=se.theme,Oe=se.isFrontPage,ye=function(e){function t(e){var n;u()(this,t),n=f()(this,g()(t).call(this)),_()(O()(n),"state",{isLoading:!1,previewedTemplate:null,blocksByTemplateSlug:{},titlesByTemplateSlug:{},error:null,isOpen:!1}),_()(O()(n),"getDefaultSelectedTemplate",(function(e){var t=Object(E.get)(e.templates,[0,"slug"]),n=e._starter_page_template;if(!Oe&&!n)return t;"home"===n&&(n=ve);var r=n||ve;return Object(E.find)(e.templates,{slug:r})?r:Object(E.find)(e.templates,{slug:le})?le:t})),_()(O()(n),"setTemplate",(function(e){$(n.props.segment.id,n.props.vertical.id,e),n.props.saveTemplateChoice(e);var t=Object(E.find)(n.props.templates,{slug:e,category:"home"}),r=n.getBlocksByTemplateSlug(e),a=t?null:n.getTitleByTemplateSlug(e);r&&r.length?(n.setState({error:null,isLoading:!0}),n.maybePrefetchAssets(r).then((function(e){n.state.isOpen&&(n.props.insertTemplate(a,e),n.setState({isOpen:!1}))})).catch((function(e){n.setState({isLoading:!1,error:e})}))):n.setState({isOpen:!1})})),_()(O()(n),"maybePrefetchAssets",(function(e){return n.props.shouldPrefetchAssets?te(e):Promise.resolve(e)})),_()(O()(n),"handleConfirmation",(function(e){"string"!=typeof e&&(e=n.state.previewedTemplate),n.setTemplate(e),n.props.isPromptedFromSidebar&&n.props.toggleTemplateModal()})),_()(O()(n),"previewTemplate",(function(e){return n.setState({previewedTemplate:e})})),_()(O()(n),"closeModal",(function(e){if(e.target.matches("button.template-selector-item__label"))return!1;H(n.props.segment.id,n.props.vertical.id);var t=Object(E.get)(window,["calypsoifyGutenberg","closeUrl"]);window.top.location=t||"edit.php?post_type=page"})),_()(O()(n),"getTemplateGroups",(function(){var e=Object(E.partition)(n.props.templates,{category:"home"}),t=s()(e,2),r=t[0],a=t[1],i=Object(E.find)(n.props.templates,{slug:ve})||Object(E.find)(n.props.templates,{slug:le});if(!Oe||!i)return{homepageTemplates:Object(E.sortBy)(r,"title"),defaultTemplates:a};var l=Object(E.reject)(r,{slug:i.slug});return{homepageTemplates:[i].concat(o()(Object(E.sortBy)(l,"title"))),defaultTemplates:a}})),_()(O()(n),"renderTemplatesList",(function(e,t){return Object(w.createElement)("fieldset",{className:"page-template-modal__list"},Object(w.createElement)("legend",{className:"page-template-modal__form-title"},t),Object(w.createElement)(q,{label:Object(k.__)("Layout","full-site-editing"),templates:e,blocksByTemplates:n.state.blocksByTemplateSlug,onTemplateSelect:n.previewTemplate,useDynamicPreview:!1,siteInformation:be,selectedTemplate:n.state.previewedTemplate,handleTemplateConfirmation:n.handleConfirmation}))}));var r=!Object(E.isEmpty)(e.templates);return n.state.isOpen=r,r&&(n.state.previewedTemplate=n.getDefaultSelectedTemplate(e),n.state.titlesByTemplateSlug=Object(E.mapValues)(Object(E.keyBy)(e.templates,"slug"),"title")),n}return h()(t,e),m()(t,[{key:"componentDidMount",value:function(){var e,t;this.state.isOpen&&(e=this.props.segment.id,t=this.props.vertical.id,V&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:V.blogid,segment_id:e,vertical_id:t}]));var n=Object(E.reduce)(ue,(function(e,t){var n=t.slug,r=t.content;return e[n]=r?Object(B.parse)(U(r,be)):[],e}),{});this.setState({blocksByTemplateSlug:n})}},{key:"getBlocksByTemplateSlug",value:function(e){return Object(E.get)(this.state.blocksByTemplateSlug,[e],[])}},{key:"getTitleByTemplateSlug",value:function(e){return Object(E.get)(this.state.titlesByTemplateSlug,[e],"")}},{key:"render",value:function(){var e=this.state,t=e.previewedTemplate,n=e.isOpen,r=e.isLoading,a=this.props.isPromptedFromSidebar;if(!n)return null;var i=this.getTemplateGroups(),o=i.homepageTemplates,l=i.defaultTemplates;return Object(w.createElement)(x.Modal,{title:Object(k.__)("Select Page Layout","full-site-editing"),className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay",shouldCloseOnClickOutside:!1,isDismissable:!1,isDismissible:!1},a?Object(w.createElement)(x.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.props.toggleTemplateModal,icon:"no-alt",label:Object(k.__)("Close Layout Selector")}):Object(w.createElement)(x.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.closeModal,icon:"arrow-left-alt2",label:Object(k.__)("Go back")}),Object(w.createElement)("div",{className:"page-template-modal__inner"},r?Object(w.createElement)("div",{className:"page-template-modal__loading"},Object(w.createElement)(x.Spinner,null),Object(k.__)("Adding layout…","full-site-editing")):Object(w.createElement)(w.Fragment,null,Object(w.createElement)("form",{className:"page-template-modal__form"},Oe?Object(w.createElement)(w.Fragment,null,this.renderTemplatesList(o,Object(k.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(l,Object(k.__)("Other Page Layouts","full-site-editing"))):Object(w.createElement)(w.Fragment,null,this.renderTemplatesList(l,Object(k.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(o,Object(k.__)("Homepage Layouts","full-site-editing")))),Object(w.createElement)(G,{blocks:this.getBlocksByTemplateSlug(t),viewportWidth:960,title:this.getTitleByTemplateSlug(t)}))),Object(w.createElement)("div",{className:S()("page-template-modal__buttons",{"is-visually-hidden":Object(E.isEmpty)(t)||r})},Object(w.createElement)(x.Button,{isPrimary:!0,isLarge:!0,disabled:Object(E.isEmpty)(t)||r,onClick:this.handleConfirmation},Object(k.sprintf)(Object(k.__)("Use %s layout","full-site-editing"),this.getTitleByTemplateSlug(t)))))}}]),t}(w.Component),he=Object(P.compose)(Object(C.withSelect)((function(e){var t=function(){return e("core/editor").getEditedPostAttribute("meta")},n=t();return{getMeta:t,_starter_page_template:n._starter_page_template,postContentBlock:e("core/editor").getBlocks().find((function(e){return"a8c/post-content"===e.name}))}})),Object(C.withDispatch)((function(e,t){e("core/nux").disableTips();var n=e("core/editor");return{saveTemplateChoice:function(e){var r=t.getMeta();n.editPost({meta:a()({},r,{_starter_page_template:e})})},insertTemplate:function(r,a){r&&n.editPost({title:r});var i=t.postContentBlock;e("core/block-editor").replaceInnerBlocks(i?i.clientId:"",a,!1)}}})))(ye);de&&(V=z=de,window._tkq.push(["identifyUser",z.userid,z.username])),"add"===ge&&Object(N.registerPlugin)("page-templates",{render:function(){return Object(w.createElement)(he,{shouldPrefetchAssets:!1,templates:ue,vertical:pe,segment:me})}}),Object(N.registerPlugin)("page-templates-sidebar",{render:function(){return Object(w.createElement)(I.PluginDocumentSettingPanel,{name:"Template Modal Opener",title:Object(k.__)("Page Layout"),className:"page-template-modal__sidebar",icon:"admin-page"},Object(w.createElement)(oe,{templates:ue,vertical:pe,segment:me,siteInformation:be}))}});var je=Object(C.subscribe)((function(){Object(C.select)("core/edit-post").isEditorPanelOpened("page-templates-sidebar/Template Modal Opener")||Object(C.dispatch)("core/edit-post").toggleEditorPanelOpened("page-templates-sidebar/Template Modal Opener"),je()}))}]));
|
starter-page-templates/page-template-modal/index.js
CHANGED
@@ -9,7 +9,13 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
9 |
import { compose } from '@wordpress/compose';
|
10 |
import { Button, Modal, Spinner, IconButton } from '@wordpress/components';
|
11 |
import { registerPlugin } from '@wordpress/plugins';
|
12 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
import { Component } from '@wordpress/element';
|
14 |
import { parse as parseBlocks } from '@wordpress/blocks';
|
15 |
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
|
@@ -415,3 +421,17 @@ registerPlugin( 'page-templates-sidebar', {
|
|
415 |
);
|
416 |
},
|
417 |
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
import { compose } from '@wordpress/compose';
|
10 |
import { Button, Modal, Spinner, IconButton } from '@wordpress/components';
|
11 |
import { registerPlugin } from '@wordpress/plugins';
|
12 |
+
import {
|
13 |
+
withDispatch,
|
14 |
+
withSelect,
|
15 |
+
select as wpSelect,
|
16 |
+
dispatch as wpDispatch,
|
17 |
+
subscribe,
|
18 |
+
} from '@wordpress/data';
|
19 |
import { Component } from '@wordpress/element';
|
20 |
import { parse as parseBlocks } from '@wordpress/blocks';
|
21 |
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
|
421 |
);
|
422 |
},
|
423 |
} );
|
424 |
+
|
425 |
+
// Make sidebar plugin open by default.
|
426 |
+
const unsubscribe = subscribe( () => {
|
427 |
+
if (
|
428 |
+
! wpSelect( 'core/edit-post' ).isEditorPanelOpened(
|
429 |
+
'page-templates-sidebar/Template Modal Opener'
|
430 |
+
)
|
431 |
+
) {
|
432 |
+
wpDispatch( 'core/edit-post' ).toggleEditorPanelOpened(
|
433 |
+
'page-templates-sidebar/Template Modal Opener'
|
434 |
+
);
|
435 |
+
}
|
436 |
+
unsubscribe();
|
437 |
+
} );
|