Closed holtwick closed 5 years ago
@holtwick I had the same problem in my library remirror which is pretty close to being a React port of this library https://github.com/ifiokjr/remirror/issues/17.
You can see the relevant code here, although the whole extension is important.
The fix
Basically, when composition starts I set the metadata for the placeholder plugin to indicate the placeholder should no longer show and when composition ends I remove the metadata.
This way the state can be updated in the plugin.state.apply
method and the empty-node decoration
can be updated according to the state.
The fix should be pretty identical in tiptap
since a lot of my code is either the same or very similar. You can play around with an example showcasing the fix via this link https://docs.remirror.org/editors/ui-twitter
PS. Working with contenteditable on Android is quite a frustrating experience. I've decided that right now I'm not focusing too much on bug fixes but I'm collating them all in one place. Perhaps some of the bugs remirror is facing are also bugs in tiptap
.
Any fixes I do come up with I'll make sure to provide code samples for or, when time permits 🤞, pull requests in the future.
@holtwick a lot has changed in the latest updates of prosemirror-view
. Is there still this bug?
@philippkuehn I can confirm that the Placeholder plugin is working correctly on Android now. That is super awesome. Thanks for keeping track!
Also thanks to @ifiokjr for the proposal of how to fix it otherwise. I just didn't had have the time to try it since.
Also the other issues I experienced and tracked via https://github.com/holtwick/collect/issues/54 seem to be fixed now. The overall editor experience is much better now.
If you want to give it a try, this is where I use it https://m.collect-app.com/
When typing on Android in the Placeholder example, the placeholder does not hide immediately. It does after completing a composition of a word. https://tiptap.scrumpy.io/placeholder
I struggled a lot with this behavior in the past as well and I remember it is related to the events
compositionstart
and related: https://developer.mozilla.org/en-US/docs/Web/Events/compositionstartBut maybe there is already a simple solution around somewhere?