Skip to content

Commit

Permalink
Add an option to hide title (#94)
Browse files Browse the repository at this point in the history
* Extract EditorConfiguration

* Add isTitleHidden option

* Remove isEditorLoaded

* 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.

* Remove unused import

* Build

* fix: Pad editor when theme styles are disabled

Avoid content flush against the device edge.

* task: Capture build output

---------

Co-authored-by: David Calhoun <[email protected]>
  • Loading branch information
kean and dcalhoun authored Feb 18, 2025
1 parent 1026117 commit 5a645ef
Show file tree
Hide file tree
Showing 23 changed files with 375 additions and 276 deletions.
8 changes: 1 addition & 7 deletions ios/Demo-iOS/Sources/EditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private struct _EditorView: UIViewControllerRepresentable {
var editorURL: URL?

func makeUIViewController(context: Context) -> EditorViewController {
let viewController = EditorViewController(service: .init(client: Client()))
let viewController = EditorViewController()
viewController.editorURL = editorURL
if #available(iOS 16.4, *) {
viewController.webView.isInspectable = true
Expand All @@ -85,12 +85,6 @@ private struct _EditorView: UIViewControllerRepresentable {
}
}

struct Client: EditorNetworkingClient {
func send(_ request: EditorNetworkRequest) async throws -> EditorNetworkResponse {
throw URLError(.unknown)
}
}

#Preview {
NavigationStack {
EditorView()
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ios/Sources/GutenbergKit/Gutenberg/assets/layout-Bwq4g3Qx.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5a645ef

Please sign in to comment.