Show caret on readonly mode

#1

Thanks for this amazing editor !

I want to prevent Android/IOS system keyboards from displaying while using the editor on mobile (i want to use my own visual keyboard).

The only way i found is to use the editor in a readonly mode and i have some questions :

  • Is it possible to have the editing caret displayed in readonly mode?
  • Is it possible to manage selection in readonly mode ?
  • Is it possible to apply marks (bold, italic…) on a selection in readonly mode ?

Do you have other ideas about how to not show the mobile os keyboard ?

Thanks again.

#2

(This sounds like a rather bad idea for various reasons—accessibility, generally violating expected behavior, missing features in your custom solution, etc)

readonly mode sets contenteditable to false, which causes browsers to not show a cursor.

The editor does that to certain degree—it will notice range selections on the content and update its state.selection accordingly.

Yes, that should work.

#3

Thanks for the fast reply,

On a readonly mode, do you think that i can display a blinking cursor and move it programatically using marks/nodes/…etc ? (just to give the impression that the user is editing)

#4

You should be able to use a widget decoration to do that.

#5

Thanks @marijn , I managed to show a visual cursor on the readonly editor using widget decoration.

My question now is how can I insert text from my visual keyboard at a given position on the editor, how can i remove text at a given position as well ?

#6

Look into the Transaction (and its superclass Transform) interface.

#7

@marijn handleClick plugin’s prop is not firing on mobile, any ideas ?

Thanks.