-
Notifications
You must be signed in to change notification settings - Fork 3
Add native block inserter #162
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: trunk
Are you sure you want to change the base?
Conversation
b2f92e3
to
1dac78c
Compare
@@ -5,7 +5,7 @@ import PackageDescription | |||
|
|||
let package = Package( | |||
name: "GutenbergKit", | |||
platforms: [.iOS(.v15), .macOS(.v14)], | |||
platforms: [.iOS(.v16), .macOS(.v14)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used some iOS 16 APIs. The apps require iOS 16, so we are good.
@@ -39,6 +41,11 @@ struct ContentView: View { | |||
} | |||
} | |||
} | |||
.fullScreenCover(isPresented: $isShowingDefaultEditor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to show modally as in the app.
/// Enable native block inserter UI. | ||
public var enableNativeBlockInserter = false | ||
/// Auto-focus the editor when it loads. | ||
public var autoFocusOnLoad = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that I enabled it by default. It auto-focuses the editor as you open it.
@@ -43,6 +43,22 @@ $min-touch-target-size: 46px; | |||
color: wordpress.$white; | |||
} | |||
|
|||
// Style the add block button with rounded black background | |||
.gutenberg-kit-editor-toolbar .gutenberg-kit-add-block-button { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the library to make it a bit less dramatic. The new button harmonizes better with the rest of the controls. There is no functional reason for it to be black. It's already in a toolbar as the first item – you ca't miss it.
// Continuously update the saved insertion point whenever selection changes | ||
useEffect( () => { | ||
// Only update if we have a selected block OR if we're clearing selection but already have a saved point | ||
if ( selectedBlockClientId !== null ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was generated. I didn't review it and I need help verifying it. I think the insertion ends up being off by one.
What?
Implements a native iOS block inserter UI to replace the web-based block inserter in the editor.
Why?
< see the respective P2 post >
How?
BlockInserterView
) that provides a searchable,categorized view of available blocks with first-class media support and native API integration
SearchEngine
) that supports fuzzy matching and scoring for blockdiscovery
Testing Instructions
Important
enableNativeBlockInserter
(enabled in demo)Integration PR in wpios: wordpress-mobile/WordPress-iOS#24708
enableNativeBlockInserter: true
in the editorconfiguration
Missing
gbk-local
URL scheme to allow the WKWebView to access the uploaded files from disk, and added basic image/gallery/block/insertion. I didn't add the code to trigger the actual upload – couldn't figure it out.core/list-item
– do not show them?Screenshot
Demo
demo.mov