-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task: Expand hidden title robustness (#97)
* style: Format code * feat: Apply opinionated default content styles In the WordPress admin context, the block list receives "post content" attributes that dictate the layout and alignment styles applied to the blocks within the list. Currently, we cannot retrieve the post content attributes via the REST API, as it does not include the current post context. Instead, we apply the "constrained" layout to improve the mobile editing experience. However, this approach may ultimately introduce subtle styling bugs--namely, classic vs block themes and editing posts/pages that use non-traditional template layouts (e.g., full-width content). * fix: Inject editor styles Ensure various editor styles are injected. These styles are determined by editor and theme settings. Unfortunately, we do not have all the necessary context in the REST API to ensure all the styles are present. Therefore, these changes also include some manual style additions that are notably absent. This manual approach is brittle. Ideally, the web editor relies upon the same REST API endpoints as the mobile app rather than relying upon server rendering context. This would push both platforms to ensure all of the necessary settings are exposed. * refactor: Pass renamed hideTitle setting as prop Renamed for consistency with other settings. Passed as a prop to avoid redundant bridge communication and unnecessary re-renders. Added option to the text editor. * docs: Document TextEditor * refactor: Remove unused settings fetch * docs: Document VisualEditor * fix: Apply missing post title alignment styles Apply similar constraints as found on the post content. * fix: Address remote editor errors Reinstate the layout component to simplify remote editor support. * fix: Repair root level alignment conditional The `themeStyles` setting is not utilized in the web editor and may be unnecessary in this context. * feat: Ensure reasonable defaults when theme styles are absent This might be used when classic themes are active or in development environments lack site/theme context. * refactor: Hoist editor ready logic Align with the web editor. Begin a path towards avoiding portions of the editor UI appearing at different times.
- Loading branch information
Showing
11 changed files
with
186 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Manually added styles that are missing from the editor settings, likely | ||
// because the styles are injected by the WP Admin context, which is not present | ||
// in the REST API endpoint. | ||
|
||
// Constraints for the post title. | ||
.editor-visual-editor__post-title-wrapper | ||
> :where(:not(.alignleft):not(.alignright):not(.alignfull)) { | ||
max-width: var(--wp--style--global--content-size); | ||
margin-left: auto !important; | ||
margin-right: auto !important; | ||
} | ||
|
||
.editor-visual-editor__post-title-wrapper > .alignwide { | ||
max-width: 1340px; | ||
} | ||
|
||
.editor-visual-editor__post-title-wrapper > .alignfull { | ||
max-width: none; | ||
} | ||
|
||
// Remove margin from the first and last child of a layout flow container. | ||
:root :where(.is-layout-flow) > :first-child { | ||
margin-block-start: 0; | ||
} | ||
|
||
:root :where(.is-layout-flow) > :last-child { | ||
margin-block-end: 0; | ||
} | ||
|
||
:root :where(.is-layout-flow) > * { | ||
margin-block-start: 1.2rem; | ||
margin-block-end: 0; | ||
} | ||
|
||
:root :where(.is-layout-constrained) > :first-child { | ||
margin-block-start: 0; | ||
} | ||
|
||
:root :where(.is-layout-constrained) > :last-child { | ||
margin-block-end: 0; | ||
} | ||
|
||
:root :where(.is-layout-constrained) > * { | ||
margin-block-start: 1.2rem; | ||
margin-block-end: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.