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

[FIX] Rich Text loop when autocompleting text on iOS #1702

Merged
merged 13 commits into from
Jan 7, 2020
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 76 files
+1 −1 .github/CODEOWNERS
+28 −0 bin/api-docs/are-readmes-unstaged.js
+44 −0 bin/api-docs/packages.js
+35 −0 bin/api-docs/update-readmes.js
+106 −5 bin/commander.js
+0 −70 bin/update-readmes.js
+5 −3 docs/designers-developers/developers/themes/theme-support.md
+22 −22 docs/designers-developers/developers/tutorials/block-tutorial/applying-styles-with-stylesheets.md
+79 −79 docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md
+72 −68 docs/designers-developers/developers/tutorials/block-tutorial/creating-dynamic-blocks.md
+50 −51 docs/designers-developers/developers/tutorials/block-tutorial/introducing-attributes-and-editable-fields.md
+3 −3 docs/designers-developers/developers/tutorials/block-tutorial/readme.md
+39 −31 docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md
+3 −2 docs/designers-developers/developers/tutorials/javascript/versions-and-building.md
+27 −0 docs/tool/are-data-files-unstaged.js
+26 −0 docs/tool/packages.js
+10 −25 docs/tool/update-data.js
+0 −22 lib/client-assets.php
+9 −4 package-lock.json
+5 −3 package.json
+1 −0 packages/block-editor/src/components/block-list/block.js
+3 −0 packages/block-editor/src/components/block-mover/index.js
+4 −3 packages/block-editor/src/components/block-pattern-picker/style.scss
+2 −3 packages/block-editor/src/components/media-placeholder/index.js
+0 −6 packages/block-editor/src/components/media-placeholder/style.scss
+2 −2 packages/block-editor/src/components/media-replace-flow/index.js
+77 −1 packages/block-editor/src/components/writing-flow/index.js
+91 −0 packages/block-library/src/cover/deprecated.js
+3 −15 packages/block-library/src/cover/editor.scss
+1 −1 packages/block-library/src/cover/save.js
+9 −1 packages/block-library/src/embed/test/__snapshots__/index.js.snap
+20 −5 packages/block-library/src/navigation/edit.js
+53 −8 packages/block-library/src/navigation/index.php
+0 −1 packages/block-library/src/table/edit.js
+15 −12 packages/block-library/src/table/editor.scss
+1 −0 packages/components/package.json
+1 −1 packages/components/src/button/style.scss
+0 −4 packages/components/src/circular-option-picker/style.scss
+2 −0 packages/components/src/font-size-picker/README.md
+45 −27 packages/components/src/font-size-picker/index.js
+3 −5 packages/components/src/form-file-upload/index.js
+0 −5 packages/components/src/form-file-upload/style.scss
+3 −3 packages/components/src/form-file-upload/test/index.js
+1 −2 packages/components/src/guide/style.scss
+5 −1 packages/components/src/modal/style.scss
+10 −1 packages/components/src/placeholder/index.js
+43 −8 packages/components/src/placeholder/style.scss
+4 −0 packages/components/src/placeholder/test/index.js
+0 −1 packages/components/src/style.scss
+22 −8 packages/data/src/plugins/persistence/index.js
+48 −3 packages/dom/src/tabbable.js
+6 −7 packages/e2e-test-utils/src/create-new-post.js
+9 −0 packages/e2e-tests/fixtures/blocks/core__cover__deprecated-4.html
+37 −0 packages/e2e-tests/fixtures/blocks/core__cover__deprecated-4.json
+43 −0 packages/e2e-tests/fixtures/blocks/core__cover__deprecated-4.parsed.json
+5 −0 packages/e2e-tests/fixtures/blocks/core__cover__deprecated-4.serialized.html
+1 −1 packages/e2e-tests/specs/editor/blocks/preformatted.test.js
+1 −1 packages/e2e-tests/specs/editor/various/editor-modes.test.js
+1 −1 packages/e2e-tests/specs/editor/various/font-size-picker.test.js
+44 −66 packages/e2e-tests/specs/editor/various/keyboard-navigable-blocks.test.js
+2 −2 packages/e2e-tests/specs/editor/various/nux.test.js
+0 −1 packages/edit-post/package.json
+4 −4 packages/edit-post/src/components/welcome-guide/index.js
+4 −2 packages/edit-post/src/components/welcome-guide/style.scss
+0 −1 packages/edit-post/src/index.js
+2 −2 packages/edit-post/src/plugins/welcome-guide-menu-item/index.js
+1 −0 packages/edit-post/src/store/defaults.js
+0 −1 packages/editor/package.json
+2 −2 packages/editor/src/components/post-title/index.js
+0 −1 packages/editor/src/index.js
+2 −2 packages/env/lib/create-docker-compose-config.js
+5 −0 packages/html-entities/src/test/entities.js
+4 −0 packages/nux/CHANGELOG.md
+1 −0 packages/nux/package.json
+9 −0 packages/nux/src/index.js
+15 −1 packages/rich-text/src/component/index.native.js
3 changes: 2 additions & 1 deletion react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ extension RCTAztecView: UITextViewDelegate {
}

func textViewDidEndEditing(_ textView: UITextView) {
onBlur?([:])
let text = packForRN(cleanHTML(), withName: "text")
onBlur?(text)
}
}
10 changes: 9 additions & 1 deletion react-native-aztec/src/AztecView.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ class AztecView extends React.Component {
...TextViewPropTypes, // include the default view properties
}

componentDidMount() {
TextInputState.registerInput(ReactNative.findNodeHandle(this))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain a bit how this registerInput/unregisterInput works and how do they contribute to the solution?

Copy link
Contributor Author

@dratwas dratwas Dec 20, 2019

Choose a reason for hiding this comment

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

TBH I don't think that they are needed in that solution but I added it because I realized that we don't do that at this moment. They add or remove fieldID to/from Set of inputs in TextInputState
https://github.com/facebook/react-native/blob/master/Libraries/Components/TextInput/TextInputState.js#L85-L95

W/o this the false will be always returned when isTextInput is called with Aztec field ID
https://github.com/facebook/react-native/blob/master/Libraries/Components/TextInput/TextInputState.js#L93-L95

Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds really nice but I am a bit afraid about consequences. We don't know who is calling isTextInput and what could be done differently if it turns true this time. So I'd avoid adding it unless we have enough context. I am just trying to be extra cautious since this has been a pretty fragile component so far.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I understand your worries so I will remove it then :)

}

componentWillUnmount() {
TextInputState.unregisterInput(ReactNative.findNodeHandle(this))
}

dispatch(command, params) {
params = params || [];
UIManager.dispatchViewManagerCommand(
Expand Down Expand Up @@ -141,7 +149,7 @@ class AztecView extends React.Component {

_onPress = (event) => {
if ( ! this.isFocused() ) {
this.focus(event); // Call to move the focus in RN way (TextInputState)
dratwas marked this conversation as resolved.
Show resolved Hide resolved
this.focus(); // Call to move the focus in RN way (TextInputState)
this._onFocus(event); // Check if there are listeners set on the focus event
}
}
Expand Down