Skip to content

fix: Replace unsupported editor architecture#50

Merged
dcalhoun merged 4 commits intotrunkfrom
fix/replace-unsupported-editor-architecture
Dec 18, 2024
Merged

fix: Replace unsupported editor architecture#50
dcalhoun merged 4 commits intotrunkfrom
fix/replace-unsupported-editor-architecture

Conversation

@dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented Dec 17, 2024

What?

Replace our current editor architecture with the approach recommended in the Gutenberg Framework documentation.

Why?

Fixes https://github.com/Automattic/dotcom-forge/issues/10026.

After merging #24, several regressions were introduced. Namely, the block toolbar would unexpectedly empty when moving the mouse cursor after typing into a rich text field.

Additionally, the Patterns and Media tabs in the block inserter have not worked since the previous change, as it no longer had access to private APIs enabling their operation.

How?

Replace our usage of EditorProvider with BlockEditor provider, as well as reintroduce the necessary supporting code for managing the post content state.

Testing Instructions

1 - Formatting options remain present within the block toolbar

  1. Start the development server.
  2. Open the editor in your desktop browser.
  3. Insert a Paragraph block.
  4. Type a couple of words into the block.
  5. Move your mouse cursor.
  6. Verify the block toolbar remains populated with rich text formatting
    options—e.g., bold, italic, etc.

2 - The Patterns/Media tab populate with content from the current site

  1. Start the development server.
  2. Open the editor within the WordPress mobile app.
  3. Open the block inserter.
  4. Tap the Patterns/Media tab.
  5. Verify the tab is populated with content from the current site.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.

@dcalhoun dcalhoun added the [Type] Bug An existing feature does not function as intended label Dec 17, 2024
@dcalhoun dcalhoun force-pushed the fix/replace-unsupported-editor-architecture branch 3 times, most recently from ececf57 to 4bc5a4a Compare December 17, 2024 02:38
This largely reverts
#24, which resulted
in several regressions. Namely, oddities in the block toolbar emptying
and empty Patterns/Media tabs in the block inserter.

The previous changes was implemented to workaround an experimental API
that is no longer exported after
WordPress/gutenberg#64892. That remains an
issue, but the new workaround is to patch Gutenberg itself to export
this necessary API with `patch-package`.
@dcalhoun dcalhoun force-pushed the fix/replace-unsupported-editor-architecture branch from 4bc5a4a to e02f4e6 Compare December 17, 2024 02:42
@dcalhoun dcalhoun marked this pull request as ready for review December 17, 2024 02:48
While the reason for why the `blob:` requests trigger is unknown, they
originate when utilizing the block inserter's Patterns tab. The requests
seemingly originate from the embedded editor previews rendered for each
pattern.
@dcalhoun dcalhoun force-pushed the fix/replace-unsupported-editor-architecture branch from 31428a9 to a7db21b Compare December 17, 2024 15:20
@dcalhoun dcalhoun requested a review from kean December 17, 2024 15:22
@kean
Copy link
Contributor

kean commented Dec 18, 2024

Open the editor within the WordPress mobile app.

I testing it in a demo app and found a couple of minor layout issues with the empty state for these tabs:
Screenshot 2024-12-17 at 7 56 34 PM Screenshot 2024-12-17 at 7 56 31 PM

I then remembered that you can change the editor URL programmatically in jpios, which is what I did:

self.editorViewController.editorURL = URL(string: "http://localhost:5173/")

It would be awesome to add support for GUTENBERG_EDITOR_URL, which is faster as it doesn't require you to recompile the code.

The jpios version also had the same layout issue:

Screenshot 2024-12-17 at 8 02 57 PM

The code changes look good.

@kean
Copy link
Contributor

kean commented Dec 18, 2024

It would be awesome to add support for GUTENBERG_EDITOR_URL, which is faster as it doesn't require you to recompile the code.

Never mind – it does. I have no memory of adding this code 😅

@dcalhoun
Copy link
Member Author

I testing it in a demo app and found a couple of minor layout issues with the empty state for these tabs:

Thanks, I plan to address this in https://github.com/Automattic/dotcom-forge/issues/8678.

It would be awesome to add support for GUTENBERG_EDITOR_URL, which is faster as it doesn't require you to recompile the code.

Never mind – it does. I have no memory of adding this code 😅

😄

@dcalhoun dcalhoun merged commit 1e4cce2 into trunk Dec 18, 2024
@dcalhoun dcalhoun deleted the fix/replace-unsupported-editor-architecture branch December 18, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants