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

Can't apply bold and italic on the slate example on Android 9 #3036

Closed
ghost opened this issue Sep 27, 2019 · 15 comments
Closed

Can't apply bold and italic on the slate example on Android 9 #3036

ghost opened this issue Sep 27, 2019 · 15 comments

Comments

@ghost
Copy link

ghost commented Sep 27, 2019

Do you want to request a feature or report a bug?

Bug

What's the current behavior?

When I select text and try to make it bold or italic, the text remains normal.

What's the expected behavior?

The text I applied bold formatting to should become bold.

@ghost
Copy link
Author

ghost commented Sep 27, 2019

I just found #2851, is this issue the same as that? @thesunny

@thesunny
Copy link
Collaborator

Hmm... sounds different.

In the other issues, I'm referring specifically to text insertion. Selecting text and then bolding it is not part of that issue.

@Nantris
Copy link
Contributor

Nantris commented Oct 5, 2019

@krithika0 - I'm not on the latest, but on previous versions I'd have to collapse my keyboard before my new selection was reflected in Slate's state. This would lead to me having words selected, but the mark being applied to wherever my previously collapsed selection was, making it seem the operation didn't occur. Can you see if that fixes the issue for you? If so, that will be helpful info for getting the final bugs hammered out.

@ghost
Copy link
Author

ghost commented Oct 7, 2019

Thanks for the reply @slapbox. I tried to make the selection, apply the mark, and then collapse the keyboard, but the mark is still not getting applied.

@ghost
Copy link
Author

ghost commented Oct 8, 2019

Hi @thesunny @slapbox I tried again with slate 0.44.4 and slate-react 0.21.10 and applying marks worked perfectly fine! But typing was very buggy.

Something must've gone wrong between that version and this one.

@thesunny
Copy link
Collaborator

thesunny commented Oct 8, 2019

This appears like it was resolved so closing.

@thesunny thesunny closed this as completed Oct 8, 2019
@ghost
Copy link
Author

ghost commented Oct 10, 2019

It wasn't resolved, could you reopen the issue please?
I was initially on slate 0.47.8 and slate-react 0.22.9 -- on which I couldn't apply bold and italic marks, but I could type. (on Android 9)
I used slate 0.44.4 and slate-react 0.21.10 and I could apply bold and italic marks, but I couldn't type at all. (on Android 9)
I can't downgrade to slate 0.44.4 and slate-react 0.21.10 because I want to be able to type on my Android.

Version Can I type? Can I apply bold and italic marks?
slate 0.44.4 and slate-react 0.21.10 No Yes
slate 0.47.8 and slate-react 0.22.9 Yes No

I want to be able to type and apply bold and italic marks as well.

@Nantris
Copy link
Contributor

Nantris commented Oct 11, 2019

@krithika0 right now it's a matter of choosing which limited editing experience fits your use best until people have time to contribute more to fixing the things that still don't work. There's substantial work to do and it's not going to be done overnight or all by one person. It's a series of small tasks. That said, @thesunny got us to the current level of mobile support as close to singlehandedly as it gets. I'll be investigating some of the most important issues for my project in a few weeks.

If you're interested in trying to take on this small task, I can try to help you find the relevant part of the code to investigate. To debug the issue, you'll want to clone the slate repo to your computer, run npm install or yarn, and then connect an Android device via USB and enable remote debugging in Chrome. From there you can poke around in the internals of Slate and try to figure out what's going wrong.

The hardest part is knowing what files to look at and how to setup the debugging environment; so if you investigate this, you'll have support for the most challenging aspects. Just discovering precisely what's going wrong, even if you can't fix it, would improve the odds of this getting fixed dramatically.

@thesunny
Copy link
Collaborator

thesunny commented Oct 11, 2019

@krithika0 Augh, no this is my bad, I misread your comment. I thought you had upgraded and the problem fixed but I see that you downgraded to fix the problem. I believe there is a PR that fixes this now from @gracicot #3023 but it hasn't been merged yet.

@thesunny thesunny reopened this Oct 11, 2019
@gracicot
Copy link
Contributor

Yes this is indeed the case. Slate cannot apply marks on the right words because on Android it doesn't know the position of the cursor all the time yet

@Nantris
Copy link
Contributor

Nantris commented Oct 11, 2019

@gracicot what version are you using, and does the cursor position properly update when you collapse the keyboard? It does look like #3023 will fix the issue, but just trying to collect as much data as I can on the remaining issues in an informal fashion.

@gracicot
Copy link
Contributor

@slapbox I'm using the latest master with the patch applied, and yes the position updates properly when the keyboard is collapsed

@SilverDY
Copy link

Hmm... It works fine with enabled "desktop site" in Chrome. I have a screen record

@Nantris
Copy link
Contributor

Nantris commented Oct 30, 2019

Jesus Christ... Just when you think Google can't make things any crazier or more fragmented.

@ianstormtaylor
Copy link
Owner

Hey, there are lots of open Android-related issues that are out of date with the latest 0.50 release because the codebase was completely rearchitected. We'll need to figure out how to have proper support for Android going forward based on beforeinput events somehow. I'm tracking this in #3112, so I'm going to close this in favor of that one.

If it cannot be implemented simply in core with beforeinput we'll likely need to have a separate plugin for android support be created, because it's too much of a departure from all of the other simpler logic in core and very hard for me to test or respond to issues. Using a separate plugin should be possible now as the newest version simplifies a lot of the internals.

Thank you for understanding.

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

No branches or pull requests

5 participants