diff --git a/functions.php b/functions.php index 83717ffa..31fa5138 100644 --- a/functions.php +++ b/functions.php @@ -149,6 +149,15 @@ function twentynineteen_scripts() { } add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' ); +/** + * Enqueue supplemental block editor styles + */ +function twentynineteen_editor_frame_styles() { + wp_enqueue_style( 'twentynineteen-editor-frame-styles', get_theme_file_uri( '/style-editor-frame.css' ), false, '1.0', 'all' ); +} + +add_action( 'enqueue_block_editor_assets', 'twentynineteen_editor_frame_styles' ); + /** * SVG Icons class. */ diff --git a/package.json b/package.json index 4119ea6d..c74b3600 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,15 @@ }, "rtlcssConfig": { "options": { - "autoRename": false, - "autoRenameStrict": false, - "blacklist":{}, - "clean": true, - "greedy": false, - "processUrls": false, - "stringMap":[] + "autoRename": false, + "autoRenameStrict": false, + "blacklist": {}, + "clean": true, + "greedy": false, + "processUrls": false, + "stringMap": [] }, - "plugins": [ ], + "plugins": [], "map": false }, "browserslist": [ @@ -34,6 +34,7 @@ "scripts": { "build:style": "node-sass style.scss style.css --output-style expanded && postcss -r style.css", "build:style-editor": "node-sass style-editor.scss style-editor.css --output-style expanded && postcss -r style-editor.css", + "build:style-editor-frame": "node-sass style-editor-frame.scss style-editor-frame.css --output-style expanded && postcss -r style-editor-frame.css", "build:rtl": "rtlcss style.css style-rtl.css", "build:print": "node-sass print.scss print.css --output-style expanded && postcss -r print.css", "build": "run-p \"build:*\"", diff --git a/style-editor-frame.css b/style-editor-frame.css new file mode 100644 index 00000000..197b8c2f --- /dev/null +++ b/style-editor-frame.css @@ -0,0 +1,60 @@ +/*! +Twenty Nineteen Editor Frame Styles + +NOTE: This file customizes items that are out of the normal scope of style-editor.css due to the auto-prefixing functionality associated with add_editor_style(). When that file is able to edit the post title and a container similar to .edit-post-layout, these styles should be migrated into style-editor.css. +*/ +/** === Includes === */ +/* If we add the border using a regular CSS border, it won't look good on non-retina devices, + * since its edges can look jagged due to lack of antialiasing. In this case, we are several + * layers of box-shadow to add the border visually, which will render the border smoother. */ +/** === Title === */ +body.gutenberg-editor-page .gutenberg .editor-post-title__block:before { + background: #767676; + content: "\020"; + display: block; + height: 2px; + margin: 1rem 0; + width: 1em; +} + +body.gutenberg-editor-page .gutenberg .editor-post-title__block:before { + width: 2.8125em; + margin-top: 0; + margin-bottom: 0; + margin-left: 1em; + position: relative; + top: 0.5em; +} + +body.gutenberg-editor-page .gutenberg .editor-post-title__block .editor-post-title__input { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; + font-size: 2.8125em; +} + +/** === Default Appender === */ +body.gutenberg-editor-page .gutenberg .editor-default-block-appender__content { + font-family: "Hoefler Text", "Baskerville Old Face", Garamond, "Times New Roman", serif; + font-size: 22px; +} + +/** === Off-Center Content === */ +@media only screen and (min-width: 768px) { + body.gutenberg-editor-page .gutenberg .edit-post-layout .editor-writing-flow { + max-width: 80%; + margin: 0 10%; + } + body.gutenberg-editor-page .gutenberg .edit-post-layout .editor-post-title__block, + body.gutenberg-editor-page .gutenberg .edit-post-layout .editor-default-block-appender, + body.gutenberg-editor-page .gutenberg .edit-post-layout .editor-block-list__block { + margin-left: 0; + margin-right: 0; + } + body.gutenberg-editor-page .gutenberg .edit-post-layout .editor-block-list__block[data-align="full"] { + width: calc( 125% + 88px + 28px); + position: relative; + left: calc( -12.5% - 46px - 14px); + } + body.gutenberg-editor-page .gutenberg .edit-post-layout .editor-block-list__block[data-align="right"] { + max-width: 125%; + } +} diff --git a/style-editor-frame.scss b/style-editor-frame.scss new file mode 100644 index 00000000..94e8962b --- /dev/null +++ b/style-editor-frame.scss @@ -0,0 +1,67 @@ +/*! +Twenty Nineteen Editor Frame Styles + +NOTE: This file customizes items that are out of the normal scope of style-editor.css due to the auto-prefixing functionality associated with add_editor_style(). When that file is able to edit the post title and a container similar to .edit-post-layout, these styles should be migrated into style-editor.css. +*/ + +/** === Includes === */ + +@import "sass/variables-site/variables-site"; +@import "sass/variables-site/colors"; +@import "sass/mixins/mixins-master"; + +/** === Title === */ + +body.gutenberg-editor-page .gutenberg .editor-post-title__block { + @include post-section-dash; + + &:before { + width: $font__size-xxl; + margin-top: 0; + margin-bottom: 0; + margin-left: 1em; + position: relative; + top: 0.5em; + } + + .editor-post-title__input { + font-family: $font__heading; + font-size: $font__size-xxl; + } +} + +/** === Default Appender === */ + +body.gutenberg-editor-page .gutenberg .editor-default-block-appender__content { + font-family: $font__body; + font-size: $font__size_base; +} + +/** === Off-Center Content === */ + +body.gutenberg-editor-page .gutenberg .edit-post-layout { + + @include media(tablet) { + .editor-writing-flow { + max-width: 80%; + margin: 0 10%; + } + + .editor-post-title__block, + .editor-default-block-appender, + .editor-block-list__block { + margin-left: 0; + margin-right: 0; + } + + .editor-block-list__block[data-align="full"] { + width: calc( 125% + 88px + 28px ); + position: relative; + left: calc( -12.5% - 46px - 14px ); + } + + .editor-block-list__block[data-align="right"] { + max-width: 125%; + } + } +} \ No newline at end of file diff --git a/style-editor.css b/style-editor.css index 96fc4bbd..3b0bcaca 100644 --- a/style-editor.css +++ b/style-editor.css @@ -139,24 +139,6 @@ figcaption { font-size: 2.25em; font-weight: bold; line-height: 1.4; - width: calc(100vw - (2 * 1rem)); - max-width: calc(100vw - (2 * 1rem)); -} - -@media only screen and (min-width: 768px) { - .wp-block-cover-image h2, - .wp-block-cover-image .wp-block-cover-image-text { - width: calc(8 * (100vw / 12)); - max-width: calc(8 * (100vw / 12)); - } -} - -@media only screen and (min-width: 1168px) { - .wp-block-cover-image h2, - .wp-block-cover-image .wp-block-cover-image-text { - width: calc(6 * (100vw / 12)); - max-width: calc(6 * (100vw / 12)); - } } .wp-block-cover-image.has-left-content { @@ -185,11 +167,15 @@ body[data-type="core/cover-image"][data-align="right"] .wp-block-cover-image-tex max-width: 305px; } -body[data-type="core/cover-image"][data-align="wide"] h2, -body[data-type="core/cover-image"][data-align="wide"] .wp-block-cover-image-text, -body[data-type="core/cover-image"][data-align="full"] h2, -body[data-type="core/cover-image"][data-align="full"] .wp-block-cover-image-text { - padding: 0; +@media only screen and (min-width: 1168px) { + body[data-type="core/cover-image"][data-align="wide"] h2, + body[data-type="core/cover-image"][data-align="wide"] .wp-block-cover-image-text, + body[data-type="core/cover-image"][data-align="full"] h2, + body[data-type="core/cover-image"][data-align="full"] .wp-block-cover-image-text { + padding: 0; + width: calc(6 * (100vw / 12)); + max-width: calc(6 * (100vw / 12)); + } } /** === Gallery === */ diff --git a/style-editor.scss b/style-editor.scss index 10d9a60f..65f7240b 100644 --- a/style-editor.scss +++ b/style-editor.scss @@ -132,19 +132,6 @@ figcaption { font-size: $font__size-xl; font-weight: bold; line-height: 1.4; - - width: calc(100vw - (2 * #{ $size__spacing-unit})); - max-width: calc(100vw - (2 * #{ $size__spacing-unit})); - - @include media(tablet) { - width: calc(8 * (100vw / 12)); - max-width: calc(8 * (100vw / 12)); - } - - @include media(desktop) { - width: calc(6 * (100vw / 12)); - max-width: calc(6 * (100vw / 12)); - } } &.has-left-content { @@ -179,9 +166,13 @@ body[data-type="core/cover-image"][data-align="right"] { body[data-type="core/cover-image"][data-align="wide"], body[data-type="core/cover-image"][data-align="full"] { - h2, - .wp-block-cover-image-text { - padding: 0; + @include media(desktop) { + h2, + .wp-block-cover-image-text { + padding: 0; + width: calc(6 * (100vw / 12)); + max-width: calc(6 * (100vw / 12)); + } } }