CodeMirror and text selection problems on Android

I would like to try CodeMirror on Android, because features like line numbers and syntax highlight in the text edit window are tempting features. And the recent search and highlight plugin is advertised to work there for tiddler edit mode as well (albeit CodeMirror has its own search).

With default TiddlyWiki editor, I can manage selections normally: I press on a word and hold, it is selected (visually it gets a blue background) and I can drag its head and tail to modify the selection, then copy/cut it.

CodeMirror editor seems to do it very differently: pressing on a word and holding does not select it. I still get the popup menu, but there’s only a Select All option. Also, I can select the current word by double tapping on it, but the selection has another color and no draggable head and tail, it looks like it happens internally inside CodeMirror.

Is this a limitation of CodeMirror TiddlyWiki plugin on mobile? An upstream CodeMirror bug on mobile? Are there any workarounds or other ways to select and copy text in a flexible manner? Is it possible to switch back to native Android text selection (didn’t see any setting like that)?

To make selection available on Android (and iOS), you can change $:/config/codemirror/inputStyle to contenteditable, then reload the wiki.

Thank you, this works. Where is this documented in TiddlyWiki documentation?

Actually this isn’t documented. I know the setting after seeing this in Codemirror 5’s manual:

inputStyle: string

Selects the way CodeMirror handles input and focus. The core library defines the "textarea" and "contenteditable" input models. On mobile browsers, the default is "contenteditable". On desktop browsers, the default is "textarea". Support for IME and screen readers is better in the "contenteditable" model. The intention is to make it the default on modern desktop browsers in the future.

1 Like

Perhaps this setting should be exposed in the plugin config tiddler then. With a brief description (your explanation above does it just fine).