-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsupported block fallback #2063
Merged
Merged
Changes from 72 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
b9f4e59
Receive unsupported block fallback message.
etoledom e19794b
Impement demo web-view to show unsupported block content.
etoledom aee264d
Implementing `replaceBlock` listener.
etoledom 75c6441
Implement iOS bridge side of new `replaceBlock` Listener
etoledom d49be0c
Implement `replaceBlock` on Example Project
etoledom b0b2aa4
Fix lint issues
etoledom 7360901
Update gutenberg ref
etoledom 059425a
Bundle
etoledom 52d7f05
Update gutenberg ref
etoledom 0d9fea7
Sending block name to native on unsupported block fallback message
etoledom 21144c1
[iOS] Unsupported fallback bridge improvements
etoledom 9a074fa
Update gutenberg ref
etoledom 58a7a86
Revert "Bundle"
etoledom f597aba
Update gutenberg ref
etoledom 1444350
Merge remote-tracking branch 'origin/develop' into unsupported-fallba…
etoledom 1785364
Bundle
etoledom d4cf849
Added android support for unsupported block
marecar3 9c3ce08
Remove ios condition
marecar3 b4a2930
Update gutenberg ref
etoledom 9888787
Adding common scripts to inject in Gutenberg Web single block mode
etoledom 2af0327
Open Gutenberg Web Fallback on iOS Example App
etoledom 4b11299
Adding extra CSS rule for SelfHosted sites
etoledom 5908934
Creating GutenbergWebDelegate
etoledom 10abccb
[iOS] Changes to improve integration with parent app
etoledom 4ebb245
Fix lint errors
etoledom 0b8d17e
[iOS] Fix build of example app
etoledom d5ce912
[Gutenberg Web iOS] Adding transition animation when web content is r…
etoledom 6140480
Revert "Bundle"
etoledom 40240af
Bundle
etoledom e037023
[Unsupported Block Fallback] Improved compatibility with WP v5.0~v5.4
etoledom ccf4e48
Injecting new script to prevent autosaves to remote
etoledom 20bc893
Change strategy to insert block.
etoledom b0b8ae2
Fix prevent autosave for WPOrg sites
etoledom 6d0f990
Remove time-out from insert-block script
etoledom 0c587b0
Revert "Bundle"
etoledom d4a5a1d
Update gutenberg ref
etoledom 60550dd
Update gutenberg ref
etoledom 79fac9e
Merge remote-tracking branch 'origin/develop' into unsupported-fallba…
etoledom 887981c
Update gutenberg ref
etoledom b089e83
Fix lint issues
etoledom bdd44b3
fix argument names
marecar3 a03f7c8
[Gutenberg WebView] Adding CSS override to hide PostTitle on new Gute…
etoledom fb0760a
Update gutenberg ref
etoledom 080c7dc
Merge remote-tracking branch 'origin/develop' into unsupported-fallba…
etoledom b1ad6a5
Commit Podfile.lock diff
etoledom d7c2eeb
Merge branch 'develop' into unsupported-fallback-spike
marecar3 c8f4e58
Update gutenberg ref
etoledom 386695e
Merge remote-tracking branch 'origin/develop' into unsupported-fallba…
etoledom 4181834
Merge branch 'develop' into unsupported-fallback-spike
marecar3 106302e
Merge branch 'develop' into unsupported-fallback-spike
marecar3 1b2865d
Move GutenbergWebViewActivity in gutenberg bridge so that we can shar…
marecar3 d76005b
Make webview visible to child classes
marecar3 610d818
Fix colors in android demo application
marecar3 fff0dc3
Add rn-get-random-values library
marecar3 7ade351
Merge branch 'unsupported-fallback-spike' of https://github.com/wordp…
marecar3 1d25b15
Merge branch 'develop' into unsupported-fallback-spike
marecar3 63308f3
small fix
marecar3 66bd63d
Merge branch 'unsupported-fallback-spike' of https://github.com/wordp…
marecar3 48ed5a2
Use version of react-native-get-random-values from forked repo
marecar3 2e07f4a
Add RNGetRandomValuesPackage in WPGlueCode
marecar3 72ac478
Fix Lint issues
etoledom 873120c
Commit diff on Podfile.lock
etoledom a19b79f
Clean up inital HTML
etoledom c7bf175
fix lint error
marecar3 676c970
Removed unsupported block
marecar3 873d431
Merge branch 'unsupported-fallback-spike' of https://github.com/wordp…
marecar3 0e1ed18
Merge branch 'develop' into unsupported-fallback-spike
marecar3 550c643
Remove empty line
marecar3 4718779
remove react-native-get-random-values
marecar3 656c0c5
remove rn-get-random-values from package.json
marecar3 4ec1da9
Remove rn-get-random-values from index.js file
marecar3 5540ad0
remove rn-get-random-values from Pods
marecar3 81d5293
Update gb reference
marecar3 f3876a9
Merge branch 'develop' into unsupported-fallback-spike
marecar3 336e61a
Put unsupported block editor on dev builds
guarani b27baf7
Merge branch 'develop' into unsupported-fallback-spike
guarani 1837d46
Reverted unnecessary change to .vscode/settings.json
guarani 08192b7
Fixed bad merge conflict resolution error
guarani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
window.blockEditorSelect = window.wp.data.select( 'core/block-editor' ) || | ||
window.wp.data.select( 'core/editor' ); // For WP v5.0 and v5.1 | ||
|
||
window.blockEditorDispatch = window.wp.data.dispatch( 'core/block-editor' ) || | ||
window.wp.data.dispatch( 'core/editor' ); // For WP v5.0 and v5.1 | ||
|
||
window.getHTMLPostContent = () => { | ||
const blocks = window.blockEditorSelect.getBlocks(); | ||
const HTML = window.wp.blocks.serialize( blocks ); | ||
// Check if platform is iOS | ||
if ( window.webkit ) { | ||
window.webkit.messageHandlers.htmlPostContent.postMessage( HTML ); | ||
// Otherwise it\'s Android | ||
} else { | ||
window.wpwebkit.postMessage( HTML ); | ||
} | ||
}; | ||
|
||
window.insertBlock = ( blockHTML ) => { | ||
// Setup the editor with the inserted block | ||
const post = window.wp.data.select( 'core/editor' ).getCurrentPost(); | ||
window.wp.data.dispatch( 'core/editor' ).setupEditor( post, { content: blockHTML } ); | ||
|
||
// Select the first block | ||
const clientId = window.blockEditorSelect.getBlocks()[ 0 ].clientId; | ||
window.blockEditorDispatch.selectBlock( clientId ); | ||
}; |
75 changes: 75 additions & 0 deletions
75
common/gutenberg-web-single-block/editor-style-overrides.css
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* Remove Post Title */ | ||
#post-title-0 { | ||
display: none; | ||
} | ||
|
||
/* Remove default block appender at the end of the post */ | ||
.block-list-appender { | ||
display: none; | ||
} | ||
|
||
.edit-post-visual-editor__post-title-wrapper { | ||
display: none; | ||
} | ||
|
||
/* Remove default block appender at the end of the post (WP v5.0~v5.1) */ | ||
.editor-default-block-appender { | ||
display: none; | ||
} | ||
|
||
/* | ||
Hiddes the top bar header by setting its height to 0 | ||
We can\'t remove it since the block toolbar is a child of it. | ||
*/ | ||
.edit-post-header { | ||
height: 0px; | ||
padding: 0px; | ||
overflow: hidden; | ||
} | ||
|
||
/* Move the block toolbar to the top */ | ||
.edit-post-header-toolbar__block-toolbar { | ||
top: 0px; | ||
} | ||
|
||
.interface-interface-skeleton { | ||
top: 0px; | ||
} | ||
|
||
/* | ||
Moves the whole editor to the top. | ||
There was an extra top margin after removing the WP Admin bar. | ||
*/ | ||
.block-editor-editor-skeleton { | ||
top: 0px; | ||
} | ||
|
||
/* Remove metaboxes from Self-Hosted sites */ | ||
.edit-post-layout__metaboxes { | ||
display: none; | ||
} | ||
|
||
/* Remove tabs from sidebar panel, leaving the \'x\' button */ | ||
.edit-post-sidebar__panel-tabs { | ||
display: none; | ||
} | ||
|
||
/* Remove \'(no-title)\' string from sidebar header */ | ||
.edit-post-sidebar-header__title { | ||
display: none; | ||
} | ||
|
||
/* Move \'x\' close button to the end on sidebar header */ | ||
.edit-post-sidebar-header__small { | ||
justify-content: flex-end; | ||
} | ||
|
||
/* Remove all buttons from the component menu group inside \'...\' button in block toolbar */ | ||
.components-menu-group > div > button:not(:first-child) { | ||
display: none; | ||
} | ||
|
||
/* Remove \'delete block\' button inside \'...\' button in block toolbar */ | ||
.components-dropdown-menu__menu > div:not(:first-child) { | ||
display: none; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const injectCss = ` | ||
window.injectCss = (css) => { | ||
const style = document.createElement('style'); | ||
style.innerHTML = css; | ||
style.type = 'text/css'; | ||
document.head.appendChild(style); | ||
} | ||
`; | ||
|
||
const script = document.createElement( 'script' ); | ||
script.innerText = injectCss; | ||
script.type = 'text/javascript'; | ||
document.head.appendChild( script ); | ||
// We need to return a string or null, otherwise executing this script will error. | ||
// eslint-disable-next-line no-unused-expressions | ||
'CSS injection function ready'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
window.insertBlock( `%@` ); |
31 changes: 31 additions & 0 deletions
31
common/gutenberg-web-single-block/local-storage-overrides.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"core/edit-post": { | ||
"preferences": { | ||
"isGeneralSidebarDismissed": true, | ||
"features": { | ||
"fixedToolbar": false, | ||
"showInserterHelpPanel": false, | ||
"fullscreenMode": true, | ||
"welcomeGuide": false | ||
}, | ||
"editorMode": "visual", | ||
"pinnedPluginItems": { | ||
|
||
}, | ||
"hiddenBlockTypes": [ | ||
|
||
], | ||
"preferredStyleVariations": { | ||
|
||
} | ||
} | ||
}, | ||
"core/nux": { | ||
"preferences": { | ||
"areTipsEnabled": false, | ||
"dismissedTips": { | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
window.setTimeout( () => { | ||
// Delaying autosaves we avoid creating drafts to remote | ||
const settings = window.wp.data.select( 'core/editor' ).getEditorSettings(); | ||
settings.autosaveInterval = 60 * 60 * 24 * 7; //Let's wait a week for it to autosave. | ||
window.wp.data.dispatch( 'core/editor' ).updateEditorSettings( settings ); | ||
}, 0 ); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#wpbody { | ||
padding-top: 0px; | ||
} | ||
|
||
#wp-toolbar { | ||
display: none; | ||
} | ||
|
||
#wpadminbar { | ||
display: none; | ||
} |
Submodule gutenberg
updated
90 files
This file contains 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
This file contains 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
This file contains 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
8 changes: 8 additions & 0 deletions
8
ios/gutenberg.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>PreviewsEnabled</key> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what |
||
<false/> | ||
</dict> | ||
</plist> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Gutenberg | ||
|
||
class WebViewController: GutenbergWebSingleBlockViewController { | ||
|
||
} |
This file contains 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
Oops, something went wrong.
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.
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.
Could the
common
folder be moved intoreact-native-gutenberg-bridge
?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.
Sounds good to me. What do you think @marecar3 ?
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.
@etoledom, I'm not sure if we're planning on making this change or leaving it as-is.
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 know it's a bit late but is it still possible to move it under
react-native-gutenberg-bridge
? or what steps should be taken to move it?In the monorepo setup the whole
react-native-gutenberg-bridge
folder will be moved under gutenberg repo as a package and ifcommon
is already inside it, that would be easier.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.
That's fair 👍
I was planning a PR specifically to do this change. For iOS is easy but will need help from @marecar3 for Android