From af0febb887468bc6eac4f69eb7fb0c885c4c6e42 Mon Sep 17 00:00:00 2001 From: Hendrik Luehrsen Date: Tue, 3 Jan 2023 16:38:58 +0100 Subject: [PATCH] Add the preview iframe fix (#52) * Add the preview iframe fix * Add the wp-activate handles Co-authored-by: Christopher Kanitz --- schemas/theme.json | 31 +++++++++++++++++++++++++++++-- theme/footer-wp-activate.php | 20 ++++++++++++++++++++ theme/header-wp-activate.php | 27 +++++++++++++++++++++++++++ theme/src/css/vars.css | 10 ++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100755 theme/footer-wp-activate.php create mode 100755 theme/header-wp-activate.php diff --git a/schemas/theme.json b/schemas/theme.json index 21a95104..94c462cd 100644 --- a/schemas/theme.json +++ b/schemas/theme.json @@ -497,7 +497,8 @@ "auto", "block", "fallback", - "swap" + "swap", + "optional" ] }, "src": { @@ -1237,7 +1238,33 @@ "type": "object", "properties": { "button": { - "$ref": "#/definitions/stylesPropertiesComplete" + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/stylesProperties" + }, + { + "properties": { + "border": {}, + "color": {}, + "filter": {}, + "outline": {}, + "shadow": {}, + "spacing": {}, + "typography": {}, + ":hover": { + "$ref": "#/definitions/stylesPropertiesComplete" + }, + ":focus": { + "$ref": "#/definitions/stylesPropertiesComplete" + }, + ":active": { + "$ref": "#/definitions/stylesPropertiesComplete" + } + }, + "additionalProperties": false + } + ] }, "link": { "type": "object", diff --git a/theme/footer-wp-activate.php b/theme/footer-wp-activate.php new file mode 100755 index 00000000..8efc6e50 --- /dev/null +++ b/theme/footer-wp-activate.php @@ -0,0 +1,20 @@ + section. This file exists to + * be as barebones as possible, because during multisite user activation, the theme + * is loaded without any plugins. This means that the theme cannot use any functions + * from plugins. + * + * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials + * + * @package lhpbpt + */ + +namespace WpMunich\lhpbpt; + +wp_footer(); ?> + + + diff --git a/theme/header-wp-activate.php b/theme/header-wp-activate.php new file mode 100755 index 00000000..fe53a72c --- /dev/null +++ b/theme/header-wp-activate.php @@ -0,0 +1,27 @@ + section. This file exists to + * be as barebones as possible, because during multisite user activation, the theme + * is loaded without any plugins. This means that the theme cannot use any functions + * from plugins. + * + * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials + * + * @package lhpbpt + */ + +namespace WpMunich\lhpbpt; + +?> + +> + + + + + + + +> diff --git a/theme/src/css/vars.css b/theme/src/css/vars.css index 3b289e77..68316125 100644 --- a/theme/src/css/vars.css +++ b/theme/src/css/vars.css @@ -8,3 +8,13 @@ @import "vars/_typography.css"; @import "vars/_colors.css"; @import "vars/_content-width.css"; + +/** + * Hack to make sure this file is actually loaded in the + * block-editor-block-preview__content-iframe + * + * @see https://github.com/WordPress/gutenberg/blob/88dc79e4219170be3d86dff5823e6baef23f7331/packages/block-editor/src/components/iframe/index.js#L41 + */ +.wp-block-foobar { + --foo: bar; +}