Skip to content

Commit

Permalink
Base Styles: Add the editor input reset with increased specificity (#…
Browse files Browse the repository at this point in the history
…49831)

* Base Styles: Add the editor input reset with increased specificity

* Swap comment style
  • Loading branch information
Mamaduka authored Apr 17, 2023
1 parent 4422131 commit 7c95582
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 42 deletions.
25 changes: 25 additions & 0 deletions packages/base-styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,31 @@
}
}

// The editor input reset with increased specificity to avoid theme styles bleeding in.
@mixin editor-input-reset() {
font-family: $editor-html-font !important;
color: $gray-900 !important;
background: $white !important;
padding: $grid-unit-15 !important;
border: $border-width solid $gray-900 !important;
box-shadow: none !important;
border-radius: $radius-block-ui !important;

// Fonts smaller than 16px causes mobile safari to zoom.
font-size: $mobile-text-min-font-size !important;
@include break-small {
font-size: $default-font-size !important;
}

&:focus {
border-color: var(--wp-admin-theme-color) !important;
box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;

// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent !important;
}
}

/**
* Reset the WP Admin page styles for Gutenberg-like pages.
*/
Expand Down
23 changes: 2 additions & 21 deletions packages/block-library/src/html/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,8 @@
// The editing view for the HTML block is equivalent to block UI.
// Therefore we increase specificity to avoid theme styles bleeding in.
.block-editor-plain-text {
font-family: $editor-html-font !important;
color: $gray-900 !important;
background: $white !important;
padding: $grid-unit-15 !important;
border: $border-width solid $gray-900 !important;
box-shadow: none !important;
border-radius: $radius-block-ui !important;
box-sizing: border-box;
max-height: 250px;

/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: $mobile-text-min-font-size !important;
@include break-small {
font-size: $default-font-size !important;
}

&:focus {
border-color: var(--wp-admin-theme-color) !important;
box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;

// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent !important;
}
@include editor-input-reset();
}
}
22 changes: 1 addition & 21 deletions packages/block-library/src/shortcode/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,8 @@
// The editing view for the Shortcode block is equivalent to block UI.
// Therefore we increase specificity to avoid theme styles bleeding in.
.blocks-shortcode__textarea {
font-family: $editor-html-font !important;
color: $gray-900 !important;
background: $white !important;
padding: $grid-unit-15 !important;
border: $border-width solid $gray-900 !important;
box-shadow: none !important;
border-radius: $radius-block-ui !important;
box-sizing: border-box;
max-height: 250px;
resize: none;

/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: $mobile-text-min-font-size !important;
@include break-small {
font-size: $default-font-size !important;
}

&:focus {
border-color: var(--wp-admin-theme-color) !important;
box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;

// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent !important;
}
@include editor-input-reset();
}

0 comments on commit 7c95582

Please sign in to comment.