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 post title to Gutenberg Mobile #450

Merged
merged 40 commits into from
Jan 24, 2019

Conversation

diegoreymendez
Copy link
Contributor

@diegoreymendez diegoreymendez commented Dec 26, 2018

Description:

Implements the editor title in RN for Gutenberg, also removes the native title.

This PR also adds the Noto font family to the repository.

Focus points:

For @hypest and anyone else wanting to chime in:

  1. Please review if the way in which I'm storing the title in AppContainer.js makes sense. I'm not sure how it would work to have that in redux so I just went for a simple initial solution.
  2. My idea in this PR is to offer a working solution so we have a good baseline to work on. While I do want to make this perfect, I also suggest that we try to be a bit optimistic with this and work incrementally on things that are not too urgent / serious. Just a though since the PRs for this feature are already quite complicated.

Related PRs:

gutenberg: WordPress/gutenberg#13199
WPiOS: wordpress-mobile/WordPress-iOS#10794
WPAndroid: wordpress-mobile/WordPress-Android#9027

Testing:

Test 1:

  1. Run the app.
  2. Edit the title and make sure the state is properly maintained.
  3. Tap save.

Check the iOS console log that the title is properly retrieved. (not sure if there's a similar log in Android)

Test 2:

  1. Run the app.
  2. Delete the title and make sure the placeholder is shown.

@pinarol
Copy link
Contributor

pinarol commented Jan 15, 2019

@diegoreymendez Just wanted to check, did you update the JS bundles intentionally for this PR or are they some side effect of merges? If the second one is true I'd say we can just reset those changes. They seem to conflict anyway.

@pinarol
Copy link
Contributor

pinarol commented Jan 15, 2019

Currently selected block seems to stay selected even if we focus to title. We can also handle this on a separate PR If you want, it's also related with propagating changes to the store. (dispatching clearSelectedBlock to the store should do it)
title1

@@ -17,7 +17,7 @@ Hello World
<!-- /wp:title -->

<!-- wp:heading {"level": 2} -->
<h2>Welcome to Gutenberg</h2>
<h2>What is Gutenberg?</h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a change needed for the PR? Asking since it introduces a trivial chance in a test as well and, not sure it's important for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well only because the post looks weird with "Welcome to Gutenberg" written twice. Once in the title and the other in this header down in the content.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, cool, I see.

@diegoreymendez
Copy link
Contributor Author

@pinarol -

Just wanted to check, did you update the JS bundles intentionally for this PR or are they some side effect of merges? If the second one is true I'd say we can just reset those changes. They seem to conflict anyway.

I updated them on purpose so that testing this PR integrated into WPiOS is easier. I can regenerate them before merging the PR if all looks fine.

Currently selected block seems to stay selected even if we focus to title

That's interestingly broken. I'll look into this.

@diegoreymendez
Copy link
Contributor Author

@pinarol - All of the issues with title focus should be resolved now. I believe I've covered all of the existing feedback from your end, but let me know if I missed anything.

Thanks for the help. This is ready to review again.

Copy link
Contributor

@pinarol pinarol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with steps on WPiOS PR, works all good! 🎉

I just have a small comment in gutenberg side, it will make it possible to access the title as @Tug described here

but feel free to create an issue for it and handle that separately, at this time it is enough if we just don't forget about it.

… bridge code, and use it the glue code called from the parent wp-android app.
const html = serialize( this.props.getBlocks() );
RNReactNativeGutenbergBridge.provideToNative_Html( html, this.lastHtml !== html );
const hasChanges = this.state.title !== this.lastTitle || this.lastHtml !== html;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that hasChanges is returned to the Android (wp-android) side as false, even if i changed the content of the post in the editor. The first time the native side calls the method to retrieve the content from RN, true is returned, and then the next calls to retrieve the content return false.

Copy link
Contributor Author

@diegoreymendez diegoreymendez Jan 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a regression or is this a problem with the original logic (before my changes) too?

The reason I'm asking is that the condition and logic haven't changed much in terms of what happens when you edit the content, and if this issue was part of the original logic, fixing it is outside of the purpose of this PR.

…ng content from the React side.

This was necessary since the call to retrieve content and title are separate on Android.
…rg-mobile into issue/372-add-title-to-gutenberg-mobile

* 'develop' of https://github.com/wordpress-mobile/gutenberg-mobile:
  Make sure to use `setContent` when initializating the GlueCode
  Dock the keyboard hide button to the right side of the screen (#480)
  RNAztecView: Removing branch spec from podspec
  Moving RNTAztecView.podspec to the gutenberg-mobile root dir.
  Aztec iOS: Force send height information to JS after pasting text

# Conflicts:
#	gutenberg
#	react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java
@diegoreymendez
Copy link
Contributor Author

Merging, but I'll be going through these PRs tomorrow to list any pending work.

Thanks for the feedback everyone.

@diegoreymendez diegoreymendez merged commit 1559268 into develop Jan 24, 2019
@diegoreymendez diegoreymendez deleted the issue/372-add-title-to-gutenberg-mobile branch January 24, 2019 21:38
@koke koke mentioned this pull request Jan 25, 2019
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants