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 Android 8 and 9 compatibility using Mutations #2853

Merged
merged 73 commits into from
Jun 12, 2019

Conversation

thesunny
Copy link
Collaborator

@thesunny thesunny commented Jun 4, 2019

Is this adding or improving a feature or fixing a bug?

Improving a feature

What's the new behavior?

It's Android 8 and 9 support that works better than the existing version.

How does this change work?

It replaces the event based Android 8 and 9 support and replaces it with MutationObserver based support.

Have you checked that...?

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn prettier.)
  • The relevant examples still work. (Run examples with yarn watch.)

Does this fix any issues or need any specific reviewers?

Fixes: #
Reviewers: @

@ianstormtaylor
Copy link
Owner

Hey @thesunny, glad to hear it's working so well for Android!

Feel free to merge whenever you are ready. It's hard to me to review because I haven't read up on mutation observers or any of the other pieces, but since it's kept separate for now it sounds good to continue going with it. There are things that seem strange to me like the 20ms timeout for setTimeout, but since I don't have the context I can't really turn them down. And we can just hopefully clean things up over time.

If there was a way to use mutation observers for all of Slate's updating logic I'd love that!

@asdillon
Copy link

@thesunny Thank you very much for this work. We just ran into this issue.

Co-Authored-By: Nick Anderson <tetramputechture@gmail.com>
@thesunny thesunny merged commit 7d4062c into ianstormtaylor:master Jun 12, 2019
@sammylupt
Copy link

This is great, thank you so much!

When do you plan to release a new tagged version of Slate with this fix?

@hergaiety
Copy link

Looking forward to this, thanks for all the hard work!

@goggalore
Copy link

Works great! Thank you for the hard work. Been working off of master and this addresses many of the big problems with mobile keyboards such as cursor positioning, backspacing, entering, etc. Even fixed an issue I was having where file inputs wouldn't open the file browser.

However, is anyone else noticing a huge amount of duplicate key warnings being console logged in dev mode with this update? Maybe this is due to working off master, though, and not this PR specifically.

Also, it seems like the renderMark property passed to editor isn't executed when a mark is toggled (only on mobile). This behavior can be seen in Chrome mobile on the rich text editor example. This is more of an additional fix request though, as this PR already addresses so, so many issues.

Great work though! Excited to see it in the next official release.

@dovydaskukalis
Copy link

Not sure it's only me or not but onChange event is never called unless I set autoFocus to true or call editor methods like toggleMark. Tested on Android 9.

@AlesJiranek AlesJiranek mentioned this pull request Jul 9, 2019
justinweiss pushed a commit to aha-app/slate that referenced this pull request Jul 15, 2019
* Add debug-mutations

* Fix linting

* Add debug-mutations to o core plugins

* Fix debug output

* Add comment about debug statement

* Add comment explaining the building of debug output object

* Add framework for mutations and mutation observer

* Working splitBlock and mergeBlock

* many things working but not autocorrect

* All later tests pass

* Before adding isComposing to composition-manager

* Fixit

* fix enter enter backspace backspace

* Pass all tests except space-back-space-back

* Passes all tests I think but doesn't continuous backspace or select delete

* Passes all tests and delete selection work

* Fix for merge

* Passes all tests including typing hello world on new line and enter

* Before switching to a function

* Fix enter after last char

* Fix it wasn't me. no. bug

* Remove timeout delay on compositionEnd and everthing works except it wasnt me. no.

* Passes all tests but need to add tests for delete all and select delete

* Pass all tests

* Fix  remove selection

* Added flush onCompositionEnd just in case

* Fix bugs for Android 8 split join and fix side effects on Android 9 to that fix

* Add comments to composition manager

* Clean up code

* Fix bug with delete range

* Add comments

* Fix focus lost bug on change examples

* Improve comments

* Rename clear to clearAction and a comment

* Rename lastEl to last.rootEl

* Remove isListening

* Rename vars

* Fix bug where changing to new example during a composition messes up update

* Add comment to switching examples in composition fix

* Improve comments

* Refactor

* Refactor removeNode

* Remove unused event callbacks

* Refactor connect

* Cleanup mutation plugin

* Remove unnecessary comments

* Remove readme

* Refactor ReactPlugin

* Refactor plugins and injection locations

* Remove dom-observer

* Remove is-input-data helpers

* Move fixSelectionInZeroWidthBlock

* Fix some linting and also a composition manager bug

* Fix linting and remove placeholder on Android

* Refactor

* Update composition-manager description

* Fix comment on composition manager

Co-Authored-By: Nick Anderson <tetramputechture@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants