Skip to content

refactor: vendor the default editor styles stylesheet - #600

Merged
dcalhoun merged 2 commits into
trunkfrom
task/vendor-default-editor-styles
Aug 24, 2026
Merged

refactor: vendor the default editor styles stylesheet#600
dcalhoun merged 2 commits into
trunkfrom
task/vendor-default-editor-styles

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Aug 22, 2026

Copy link
Copy Markdown
Member

What?

Copies default-editor-styles.scss out of @wordpress/block-editor and into src/utils/, and imports it locally in editor-settings.js.

Fixes #590. Fixes CMM-2330.

Why?

Gutenberg #81793 removed the stylesheet from the package. It still ships in our pinned @wordpress/block-editor@15.14.0, so nothing is broken today — but the next bump that includes the removal breaks the build, and our usage shouldn't hold up the upstream cleanup.

The styles matter for us: getDefaultEditorSettings() supplies defaultEditorStyles when a site can't provide its own editor settings, a supported path in the mobile apps.

How?

The vendored copy is byte-identical to the upstream file at 28c348a (the commit before removal), with a header comment pointing back at the source, the removal PR, and core's equivalent in wp-includes/block-editor.php. Same approach as default-theme-styles.scss and wp-common-styles.scss.

Testing Instructions

Regression check; no user-facing change expected.

  1. Load the editor against a site without the Gutenberg plugin (no editor-settings endpoint supplying styles).
  2. Confirm body text renders at 18px, paragraphs at 1.8 line height, and the post title larger and bold — unchanged from trunk.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YZ5JzgG1CKQwmSN2P3B4R6

Gutenberg #81793 removed `default-editor-styles.scss` from the
`@wordpress/block-editor` package. The stylesheet still ships in the
pinned version, so nothing breaks today, but the next package bump
including the removal would break the build.

Copy the stylesheet into the repo and import it locally, matching the
approach already used for `default-theme-styles.scss` and
`wp-common-styles.scss`. The compiled output is unchanged from the
package's `build-style` version.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ5JzgG1CKQwmSN2P3B4R6
@dcalhoun dcalhoun added [Type] Task Issues or PRs that have been broken down into an individual action to take Gutenberg labels Aug 22, 2026
@wpmobilebot

wpmobilebot commented Aug 22, 2026

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/600")

Built from de038d8

The previous post title selector was incorrect, and the unused styles
were not as fitting for smaller screens.
@dcalhoun
dcalhoun marked this pull request as ready for review August 22, 2026 19:44
@dcalhoun
dcalhoun requested a review from nbradbury August 22, 2026 19:45
@nbradbury

Copy link
Copy Markdown
Contributor

@dcalhoun I deactivated the Gutenberg plugin on my test site, and when I tried the iOS demo app with that site it never loaded - I was stuck with a progress spinner in the middle of the screen. However, the next time I tried it loaded just fine. I asked Claude to investigate and here's what it reported:

Step 1’s wording, “a site without the Gutenberg plugin”: on iOS a 404 from the settings endpoint throws out of fetchDependencies() rather than falling back (only URLErrors are caught, EditorService.swift:150), so the editor fails to load instead of using defaults. The path you actually want a tester on is theme styles off, or the demo app’s Standalone Editor.

@dcalhoun

Copy link
Copy Markdown
Member Author

@nbradbury thanks for reviewing. I don't believe the hang you experienced relates to the changes in the PR. Also, I'm unsure Claude's reported cause holds.

When a site lacks the Gutenberg plugin, then it lacks the /wp-block-editor/v1/settings REST API endpoint. In that context, GBK never requests the endpoint because the theme styles capability is negotiated up front from route discovery. So, a 404 should not occur.

There is one context where a 404 can occur for the GBK Demo app due to its rudimentary implementation.

  1. Activate Gutenberg
  2. Open the site's Editor Configuration in the GBK Demo app
  3. Note Support Theme Styles should be ON
  4. Deactivate Gutnberg
  5. Open the editor

A 404 error occurs. This is because a stale capability is captured by the Demo app. However, the UX I observe is an error message:

Capability mismatch after plugin deactivation

image

That said, the hang you experienced is real. It's worthy of a separate issue if we can reproduce it. A few questions...

  • When the hang occurred, did you observe an error message in Xcode's console?
  • If not, are you able to reproduce the issue and observe one?
  • Was your local build loading the dev server (via the GUTENBERG_EDITOR_URL env var) or a local build (make build)? An absent dev server or stale local build could cause issues (although, it'd be odd that it only occurred once).
  • Was the test site newly added or one that Demo app already utilized with Gutenberg/theme styles?
  • Are you able to reproduce the hang on Android?

It may be worth merging these changes as unrelated to the hang. WDYT?

@nbradbury

Copy link
Copy Markdown
Contributor

When the hang occurred, did you observe an error message in Xcode's console?
If not, are you able to reproduce the issue and observe one?

Unfortunately, I couldn't reproduce the problem, and I was running the iOS simulator by itself rather than in Xcode. I could not reproduce the problem on Android, either.

Was the test site newly added or one that Demo app already utilized with Gutenberg/theme styles?

It was a site previously added to the demo app that I then disabled the Gutenberg plugin. In trying to reproduce this I re-enabled the plugin, ran the demo app with that site, then again disabled the plugin. No problems occurred 🤷

Was your local build loading the dev server

Yes.

It may be worth merging these changes as unrelated to the hang. WDYT?

Claude agrees with you so I'll approve this :)

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@dcalhoun
dcalhoun merged commit 613263b into trunk Aug 24, 2026
25 checks passed
@dcalhoun
dcalhoun deleted the task/vendor-default-editor-styles branch August 24, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg [Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embed a local copy of the default editor styles stylesheet

3 participants