Skip to content
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

Add support for Story block rendering on mobile gutenberg #2611

Merged
merged 113 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
73c9f84
updated jetpack submodule commit hash
mzorz Sep 3, 2020
82d121e
Revert "updated jetpack submodule commit hash"
mzorz Sep 3, 2020
81677c0
Merge branch 'develop' of https://github.com/wordpress-mobile/gutenbe…
mzorz Sep 3, 2020
ddb9042
update jetpack to latest, containing the story block
mzorz Sep 4, 2020
71cd744
declaring the jetpack/story block supported in mobile
mzorz Sep 4, 2020
c7cbc03
added story block basic rendering, processing mediaFiles attribute
mzorz Sep 4, 2020
c82e06d
added StoryEditingButton for use in the story block in jetpack
mzorz Sep 9, 2020
13e3d83
updated gutenberg/jetpack commit hash for requestStoryCreatorLoad bri…
mzorz Sep 10, 2020
60088f8
udpated gutenberg commit hash with new WPANdroid bridge interface OnS…
mzorz Sep 10, 2020
4def44f
udpated commit hash for gutenberg and jetpack: making requestStoryCre…
mzorz Sep 11, 2020
00a0cc0
fixed merge conflict
mzorz Sep 15, 2020
0dcfe93
updated jetpac and gutenberg libs hashes to point to new StoryUpdateP…
mzorz Sep 21, 2020
1697f9f
updated commit hash for gutenebrg and jetpack; updated save progress …
mzorz Sep 24, 2020
7e0dc26
updated commit hashes for gutenberg and jetpack with stories block up…
mzorz Sep 25, 2020
888d6c8
updated commit hash for gutenberg and jetpack to use new onStorySaveR…
mzorz Sep 25, 2020
4cae822
updated hash for gutenebrg and jetpack with stories block updates
mzorz Sep 28, 2020
85bf8ac
updated gutenberg and jetpack commit hashes with mediaModelCreated br…
mzorz Sep 28, 2020
a7bc72c
updated commit hash for gutenebrg and jetpack libs, updating mediaID …
mzorz Sep 29, 2020
21b823b
updated commit hash for gutenebrg and jetpack, just removed commented…
mzorz Sep 29, 2020
7f9313f
updated gutenberg commit hash
mzorz Sep 30, 2020
430fd3c
updated jetpack commit hash
mzorz Sep 30, 2020
fd31777
updated commit hash for gutenberg with fix for mobile demo app
mzorz Oct 1, 2020
e39c4ea
updated jetpack commit hash:
mzorz Oct 1, 2020
d7f1140
fixed lint prettier warning
mzorz Oct 1, 2020
a3b108e
updated jetpack branch
mzorz Oct 1, 2020
22c192d
updated jetpack commit hash
mzorz Oct 1, 2020
b268544
updated commit hash for gutenberg
mzorz Oct 1, 2020
f422a64
Merge branch 'develop' into try/jetpack-stories-block
mzorz Oct 1, 2020
33f2add
updated gutenberg and jetpack commit hashes
mzorz Oct 1, 2020
f78b24f
fixed merge conflicts
mzorz Oct 1, 2020
b1de4df
updated commit hash
mzorz Oct 1, 2020
c456f91
fixed merge conflicts and updated gutenberg and jetpack submodules
mzorz Oct 9, 2020
0f8916f
moved jetpack/story block examples to initial-html for demo loader
mzorz Oct 9, 2020
8409426
fixed merge conflicts and updated gutenberg and jetpack submodules
mzorz Oct 9, 2020
bd29f74
fixed merge conflict
mzorz Oct 9, 2020
7c7430c
fix getCategories mock
mzorz Oct 9, 2020
6360f4c
fixed prettier error
mzorz Oct 9, 2020
8eb4501
Merge branch 'try/jetpack-stories-block' into try/jetpack-stories-blo…
mzorz Oct 9, 2020
e4031f4
only set initialData with demo initialHtml example if initialData not…
mzorz Oct 10, 2020
aa1b58b
only set initialData with demo initialHtml example if initialData not…
mzorz Oct 10, 2020
aa296b8
Merge branch 'try/jetpack-stories-block' into try/jetpack-stories-blo…
mzorz Oct 10, 2020
445bdec
Merge branch 'try/jetpack-stories-block-on-done' into try/jetpack-sto…
mzorz Oct 10, 2020
5e87399
updated commit hashes for guetnberg and jetpack
mzorz Oct 10, 2020
c631969
upated gutenberg commit hash
mzorz Oct 10, 2020
e8aea4a
updated jetpack and gutenberg commit hashes with new method renames
mzorz Oct 10, 2020
be942f0
updated gutenberg commit hash, fixed prettier error
mzorz Oct 11, 2020
e4b907c
updated gutenberg commit hash
mzorz Oct 11, 2020
90f84ac
updated gutenberg and jetpack commit hash for story error handling lo…
mzorz Oct 11, 2020
246d3a7
added bridge methods for cancel and retry uploads on mediaFiles colle…
mzorz Oct 12, 2020
4a09adc
deep copy of mediaFiles when assigning new mediaUrl or mediaId
mzorz Oct 12, 2020
8f30bdf
updated commit hash; implemented requestMediaFilesSaveCancelDialog br…
mzorz Oct 12, 2020
433e2cb
updated gutenberg and jetpack commit hashes for bridge method rename …
mzorz Oct 13, 2020
875112c
updated jetpack commit hash - just removed commented out code
mzorz Oct 14, 2020
a76e417
updated gutenberg commit hash
mzorz Oct 14, 2020
3130e24
updated gutenberg and jetpack commit hashes
mzorz Oct 14, 2020
57f2618
Merge pull request #2706 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 14, 2020
19dc04b
updated commit hash for merged PRs in gutenberg and jetapck submodules
mzorz Oct 14, 2020
6c287df
fixed merge conflict, updated jetpack and gutenberg commit hashes
mzorz Oct 14, 2020
03d3abe
Merge pull request #2663 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 14, 2020
de365b1
updated jetpack and gutenberg commit hashes and fixed merge conflicts…
mzorz Oct 14, 2020
afedc7e
updated commit hash for gutenberg and jetpack
mzorz Oct 16, 2020
56f2eda
updated gutenberg and jetpack
mzorz Oct 16, 2020
c238c6d
unmade change to package-lock.json
mzorz Oct 16, 2020
8511312
mocked the story web editor impl for gutenberg-mobile tests
mzorz Oct 16, 2020
1ca2893
Revert "mocked the story web editor impl for gutenberg-mobile tests"
mzorz Oct 16, 2020
ddb2681
mocked the story web editor impl for gutenberg-mobile tests
mzorz Oct 15, 2020
b7d8c8c
ran prettier on file
mzorz Oct 16, 2020
40de7b2
merged gutenberg master branch
mzorz Oct 16, 2020
e7aa037
bump ci
mzorz Oct 16, 2020
1e63767
Revert "bump ci"
mzorz Oct 16, 2020
6274268
fixed merge conflicts
mzorz Oct 16, 2020
080a970
Update gutenberg ref
etoledom Oct 20, 2020
ed36dfc
updated jetpack commit hash
mzorz Oct 20, 2020
ba4df52
updated gutenberg commit hash
mzorz Oct 21, 2020
fdbb451
Merge pull request #2708 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 22, 2020
21e9229
updated gutenberg and jetpack commit hashes with latest squashed comm…
mzorz Oct 22, 2020
4259361
updated gutenberg and jetpack commit hashes
mzorz Oct 27, 2020
945e7aa
updated gutenberg commit hash
mzorz Oct 27, 2020
f94126b
updated commit hash with props rename for mediaFilesCollectionBlock p…
mzorz Oct 28, 2020
0c8e155
updated gutetnberg commit hash
mzorz Oct 28, 2020
a361b1d
moved mediaFilesCollectionBlock feature/capability flag code from gut…
mzorz Oct 28, 2020
f6b14e4
Merge pull request #2762 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Oct 30, 2020
1ad0cff
move the setupJetpackEditor() call fr om to action
mzorz Oct 30, 2020
67d6fc3
updated gutenberg commit hash
mzorz Oct 30, 2020
5453504
updated gutenberg commit hash
mzorz Oct 30, 2020
835a286
mocked useSelect, useDispatch in test
mzorz Oct 30, 2020
f2f39f9
updated branch with base, fixed merge conflict on gutenberg by updati…
mzorz Nov 2, 2020
2305176
updated jetpack commit hash, updated jetpack stories branch with late…
mzorz Nov 2, 2020
0d988a2
prettified
mzorz Nov 2, 2020
b92394b
Merge branch 'try/jetpack-stories-block' into try/jetpack-stories-blo…
mzorz Nov 2, 2020
f312735
moved select/dispatch call logic within setTimeout to ensure its run …
mzorz Nov 2, 2020
e5f8084
removed commented test code
mzorz Nov 2, 2020
9bf27e0
removed non-applicable comment heading
mzorz Nov 2, 2020
25d82e7
prettified
mzorz Nov 2, 2020
6eb17d5
added comment describing the value of having a setTimeout() call here
mzorz Nov 3, 2020
f1fcac2
ran prettier
mzorz Nov 3, 2020
96a7f64
Merge pull request #2770 from wordpress-mobile/try/jetpack-stories-bl…
mzorz Nov 3, 2020
fec4f0c
updadted gutenberg hash
mzorz Nov 3, 2020
4d378dc
removed unused param
mzorz Nov 3, 2020
87cbeb8
Merge pull request #2766 from wordpress-mobile/try/jetpack-blocks-reg…
mzorz Nov 4, 2020
63845b1
updated gutenberg commit hash
mzorz Nov 4, 2020
cc6c788
updated gutenberg with base branch, updated commit hash
mzorz Nov 4, 2020
d87f7cb
updated jetpack with master branch, updated jetpack commit hash
mzorz Nov 4, 2020
fcc128d
Merge branch 'develop' into try/jetpack-stories-block
mzorz Nov 4, 2020
43013f1
updated gutenberg
mzorz Nov 4, 2020
3bf1355
updated with latest jetpack commit hash
mzorz Nov 5, 2020
08757d2
updated gutenberg and jetpack commit hashes
mzorz Nov 5, 2020
680dc5e
Update gutenberg ref
etoledom Nov 6, 2020
c4efb55
Merge branch 'develop' into try/jetpack-stories-block
mzorz Nov 6, 2020
4725701
updated gutenberg commit hash to latest, merged with master
mzorz Nov 6, 2020
82ac170
updated gutenberg commit hash
mzorz Nov 6, 2020
7fc9cfc
fixed merge conflicts, updated gutenberg commit hash
mzorz Nov 9, 2020
0d4e47c
updated jetpack and gutenberg repos commit hash
mzorz Nov 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 61 files
+2 −0 .github/CODEOWNERS
+2 −2 .github/workflows/create-block.yml
+8 −8 .github/workflows/end2end-test.yml
+2 −2 .github/workflows/performance.yml
+2 −2 .github/workflows/static-checks.yml
+1 −1 .github/workflows/storybook-pages.yml
+6 −6 .github/workflows/unit-test.yml
+1 −1 .nvmrc
+183 −0 docs/designers-developers/developers/block-api/block-supports.md
+1 −0 package.json
+1 −0 packages/base-styles/_colors.native.scss
+18 −0 packages/base-styles/_mixins.scss
+1 −0 packages/base-styles/_variables.scss
+104 −0 packages/block-editor/src/components/block-media-update-progress/README.md
+299 −0 packages/block-editor/src/components/block-media-update-progress/index.native.js
+9 −0 packages/block-editor/src/components/block-media-update-progress/styles.native.scss
+500 −0 packages/block-editor/src/components/block-media-update-progress/test/index.native.js
+1 −0 packages/block-editor/src/components/index.native.js
+1 −1 packages/block-library/src/gallery/gallery-image.js
+10 −7 packages/block-library/src/navigation-link/edit.js
+2 −1 packages/components/src/angle-picker-control/angle-circle.js
+6 −2 packages/components/src/date-time/date.js
+137 −157 packages/components/src/date-time/index.js
+9 −18 packages/components/src/guide/finish-button.js
+2 −2 packages/components/src/guide/test/finish-button.js
+1 −1 packages/components/src/index.js
+5 −2 packages/components/src/sandbox/index.js
+3 −2 packages/core-data/src/index.js
+4 −3 packages/core-data/src/resolvers.js
+174 −28 packages/core-data/src/test/integration.js
+1 −3 packages/data-controls/src/index.js
+149 −5 packages/e2e-tests/specs/experiments/template-part.test.js
+5 −1 packages/edit-post/src/editor.native.js
+1 −14 packages/edit-post/src/style.scss
+1 −0 packages/edit-site/src/style.scss
+19 −15 packages/edit-widgets/src/blocks/widget-area/edit/index.js
+9 −5 packages/editor/src/components/post-schedule/index.js
+1 −1 packages/editor/src/editor-styles.scss
+3 −1 packages/eslint-plugin/configs/custom.js
+6 −1 packages/eslint-plugin/rules/__tests__/no-global-active-element.js
+70 −0 packages/eslint-plugin/rules/__tests__/no-global-event-listener.js
+6 −1 packages/eslint-plugin/rules/__tests__/no-global-get-selection.js
+2 −1 packages/eslint-plugin/rules/no-global-active-element.js
+35 −0 packages/eslint-plugin/rules/no-global-event-listener.js
+2 −1 packages/eslint-plugin/rules/no-global-get-selection.js
+4 −0 packages/i18n/CHANGELOG.md
+1 −1 packages/react-native-bridge/android/build.gradle
+26 −0 ...-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java
+29 −0 ...droid/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java
+86 −8 ...ages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/DeferredEventEmitter.java
+3 −0 packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt
+93 −5 packages/react-native-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java
+115 −5 packages/react-native-bridge/index.js
+42 −4 packages/react-native-bridge/ios/Gutenberg.swift
+28 −5 packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift
+6 −0 packages/react-native-bridge/ios/RNReactNativeGutenbergBridge.m
+38 −0 packages/react-native-bridge/ios/RNReactNativeGutenbergBridge.swift
+30 −1 packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainApplication.java
+21 −1 packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift
+1 −1 storybook/stories/playground/editor-styles.scss
+1 −0 test/native/setup.js
2 changes: 1 addition & 1 deletion jetpack
Submodule jetpack updated 48 files
+1 −0 .github/codeclimate-base.yml
+15 −0 .github/files/phpcompatibility-dev-phpcs.xml
+19 −0 .github/matchers/phpcs-problem-matcher.json
+62 −0 .github/workflows/phpcompatibility-dev.yml
+31 −0 .phpcs.config.xml
+5 −28 .phpcs.xml.dist
+8 −8 _inc/lib/class.core-rest-api-endpoints.php
+1 −1 _inc/lib/class.media.php
+1 −1 _inc/lib/debugger/class-jetpack-cxn-test-base.php
+5 −1 bin/prepare-commit-msg.js
+4 −0 changelog.txt
+1 −1 class.jetpack-gutenberg.php
+1 −1 class.jetpack-modules-list-table.php
+1 −1 class.jetpack-post-images.php
+1 −1 class.json-api-endpoints.php
+1 −1 composer.json
+1 −1 dangerfile.js
+1 −1 docs/coding-guidelines.md
+6 −1 extensions/blocks/contact-info/edit.native.js
+240 −0 extensions/blocks/story/edit.native.js
+97 −0 extensions/blocks/story/editor.native.scss
+10 −0 extensions/blocks/story/icon-customize.native.js
+3 −2 extensions/blocks/story/index.js
+30 −0 extensions/blocks/story/story-editing-button.native.js
+1 −0 extensions/editor.native.js
+15 −11 extensions/shared/external-media/index.js
+1 −1 extensions/shared/icons.scss
+2 −2 jetpack.php
+0 −4 json-endpoints/class.wpcom-json-api-get-site-endpoint.php
+1 −9 json-endpoints/class.wpcom-json-api-update-site-homepage-endpoint.php
+40 −13 modules/contact-form/admin.php
+1 −1 modules/contact-form/grunion-contact-form.php
+20 −11 modules/contact-form/js/grunion-admin.js
+1 −1 modules/widgets/rsslinks-widget.php
+7 −7 package.json
+1 −1 packages/device-detection/src/class-device-detection.php
+13 −16 packages/status/tests/php/test-status.php
+4 −0 readme.txt
+0 −4 sal/class.json-api-site-base.php
+54 −21 tests/php/general/test_class.jetpack-xmlrpc-server.php
+67 −20 tests/php/general/test_class.jetpack.php
+2 −2 tests/php/lib/class-wp-test-jetpack-rest-testcase.php
+169 −53 tests/php/modules/sso/test_class.jetpack-sso-helpers.php
+161 −65 tests/php/sync/test_class.jetpack-sync-callables.php
+16 −6 tests/php/sync/test_class.jetpack-sync-integration.php
+28 −8 tests/php/sync/test_class.jetpack-sync-posts.php
+3 −0 tests/php/sync/test_class.jetpack-sync-sender.php
+356 −354 yarn.lock
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ import correctTextFontWeight from './text-font-weight-correct';
import setupJetpackEditor from './jetpack-editor-setup';
import initialHtml from './initial-html';

addAction( 'native.pre-render', 'gutenberg-mobile', ( props ) => {
addAction( 'native.pre-render', 'gutenberg-mobile', () => {
require( './strings-overrides' );
correctTextFontWeight();
} );

addAction( 'native.render', 'gutenberg-mobile', ( props ) => {
setupJetpackEditor(
props.jetpackState || { blogId: 1, isJetpackActive: true }
);
Expand Down
12 changes: 12 additions & 0 deletions src/initial-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,16 @@ export default `
<div class="wp-block-jetpack-address"><div class="jetpack-address__address jetpack-address__address1">Random Street</div></div>
<!-- /wp:jetpack/address --></div>
<!-- /wp:jetpack/contact-info -->

<!-- wp:jetpack/story {"mediaFiles":[{"alt":"","caption":"","id":320,"link":"https://cldup.com/n48GTQmw7s.jpg","mime":"image/jpeg","type":"image","url":"https://cldup.com/n48GTQmw7s.jpg"},{"alt":"","caption":"","id":321,"link":"https://cldup.com/u2kdydrlQv.jpg","mime":"image/jpeg","type":"image","url":"https://cldup.com/u2kdydrlQv.jpg"},{"alt":"","caption":"","id":319,"link":"https://cldup.com/fi7gqyUrbL.jpg","mime":"image/jpeg","type":"image","url":"https://cldup.com/fi7gqyUrbL.jpg"}]} -->
<div class="wp-block-jetpack-story wp-story"></div>
<!-- /wp:jetpack/story -->

<!-- wp:jetpack/story -->
<div class="wp-block-jetpack-story wp-story"></div>
<!-- /wp:jetpack/story -->

<!-- wp:jetpack/story {"mediaFiles":[]}} -->
<div class="wp-block-jetpack-story wp-story"></div>
<!-- /wp:jetpack/story -->
`;
27 changes: 27 additions & 0 deletions src/jetpack-editor-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
* Internal dependencies
*/
import { JETPACK_DATA_PATH } from '../jetpack/extensions/shared/get-jetpack-data';
/**
* WordPress dependencies
*/
import { dispatch, select } from '@wordpress/data';

// When adding new blocks to this list please also consider updating ./block-support/supported-blocks.json
const supportedJetpackBlocks = {
'contact-info': {
available: true,
},
story: {
available: true,
},
};

const setJetpackData = ( {
Expand Down Expand Up @@ -37,6 +44,26 @@ export default ( jetpackState ) => {

const jetpackData = setJetpackData( jetpackState );

// Note on the use of setTimeout() here:
// We observed the settings may not be ready exactly when the native.render hooks get run but rather
// right after that execution cycle (because state hasn't changed yet). Hence, we're only checking for
// the actual settings to be loaded by using setTimeout without a delay parameter. This ensures the
// settings are loaded onto the store and we can use the core/block-editor selector by the time we do
// the actual check.

// eslint-disable-next-line @wordpress/react-no-unsafe-timeout
setTimeout( () => {
const mediaFilesCollectionBlock = select(
'core/block-editor'
).getSettings( 'capabilities' ).mediaFilesCollectionBlock;

if ( mediaFilesCollectionBlock !== true ) {
dispatch( 'core/edit-post' ).hideBlockTypes( [ 'jetpack/story' ] );
} else {
dispatch( 'core/edit-post' ).showBlockTypes( [ 'jetpack/story' ] );
}
} );

if ( __DEV__ ) {
require( '../jetpack/extensions/editor' );
}
Expand Down
5 changes: 4 additions & 1 deletion src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe( 'Test Jetpack blocks', () => {
const mockRegisterBlockCollection = jest.fn();
jest.mock( '@wordpress/blocks', () => {
return {
getCategories: () => [],
getCategories: () => [ { slug: 'media' } ],
setCategories: jest.fn(),
registerBlockCollection: mockRegisterBlockCollection,
};
Expand All @@ -12,6 +12,9 @@ describe( 'Test Jetpack blocks', () => {
'../../jetpack/extensions/blocks/contact-info/editor.js',
() => jest.fn()
);
jest.mock( '../../jetpack/extensions/blocks/story/editor.js', () =>
jest.fn()
);

const setupJetpackEditor = require( '../jetpack-editor-setup' ).default;
setupJetpackEditor( { blogId: 1, isJetpackActive: true } );
Expand Down