feat(android): add native block inserter#461
Draft
jkmassel wants to merge 2 commits intojkmassel/block-picker-flagfrom
Draft
feat(android): add native block inserter#461jkmassel wants to merge 2 commits intojkmassel/block-picker-flagfrom
jkmassel wants to merge 2 commits intojkmassel/block-picker-flagfrom
Conversation
0c4794d to
eece41e
Compare
6b881ff to
05b3fd4
Compare
This was referenced Apr 22, 2026
Adds a native bottom-sheet block inserter to Android, bringing it to parity with the iOS SwiftUI sheet. Android takes the headless-into- library route — `GutenbergView` renders a programmatic `BottomSheetDialog` internally, so no Compose leaks into the Gutenberg library. Wires up a new `@JavascriptInterface showBlockInserter(String)` method that decodes the payload added in the payload-model PR, shows the dialog, and reflects selection + dismiss back to JS via `window.blockInserter.insertBlock` / `onClose`. Bad payloads surface a Toast so a broken tap isn't silent. The dialog is a stub — flat list of section headers and tappable block rows. Icons, patterns, search, and richer layout will replace it in a follow-up PR. Enabled via `EditorConfiguration.setEnableNativeBlockInserter(true)` (added in the feature-flag PR).
Moves the two synthetic section fallbacks ("Most used", "Suggested")
and the parse-failure Toast out of the Kotlin source and into
`Gutenberg/src/main/res/values/strings.xml`. Adds `resourcePrefix =
"gbk_"` so AGP flags any future unprefixed library resource at lint
time, preventing collision with host-app resource ids.
a11c583 to
32e096e
Compare
05b3fd4 to
6d17fbe
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third of three stacked PRs for the native block inserter. Adds the Android-side handler for the
showBlockInserterJavaScript bridge call set up in #463, gated by theenableNativeBlockInserterflag added in #464.GutenbergViewrenders a programmaticBottomSheetDialoginternally — headless-into-library, so no Compose leaks into the Gutenberg library.The dialog is a stub — flat list of section headers and tappable block rows. Icons, patterns, search, and richer layout will replace it in a follow-up PR.
Flow
bridge.jsshowBlockInserter→ Android@JavascriptInterface→BlockInserterPayload.fromJson→BlockInserterDialog(sections + blocks). Tapping a block fireswindow.blockInserter.insertBlock(id). Any dismiss — selection or swipe — fireswindow.blockInserter.onClose()so the JS picker state always resets. Bad payloads surface a Toast (fromR.string.gbk_block_inserter_failure) so a broken tap isn't silent.Test plan
make test-js— 135/135./gradlew :Gutenberg:test detekt :Gutenberg:lintDebug :app:compileDebugKotlin— BUILD SUCCESSFULRelated
Third of three stacked PRs:
enableNativeBlockInserterfeature flagGutenbergViewwiringMirrors the iOS implementation under
ios/Sources/GutenbergKit/Sources/Views/BlockInserter/.