Re: [editing] How do we switch the caret between overtype and insert mode? (#55)

> Indeed, it works just about everywhere and it works in contenteditable.

Then I’m sure we should not discard it.

If we decide we don’t want to use a global namespace for that, we just stick with string identifiers: e. g. `setInputMode("overtype")`. It’s not really that bad, it wouldn’t be the first API to use strings: DOM event IDs have been strings for decades, despite that the same DOM uses numeric constants elsewhere. Eventually, we may end up in need of a namespace for other parts of the spec, so it’s a difficult decision to make in such an isolated context; if there are other benefits of a global namespace, I’m personally more comfortable with constants. But even if not, nobody ever died of strings. It’s still more neutral and potentially extensible than specific methods, like `toggleOverwrite(boolean)` in CodeMirror.

In case of strings, `setInputMode()` should probably do nothing for strings it can’t recognise, the same way `execCommand` does nothing for non-existing commands (I don’t think developers will need the ability to set and implement custom input modes like they do with custom events in `addEventListener`; I do think we may have to define additional modes in later versions of the spec, so by extensibility I understand the latter, and not the former).

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/55#issuecomment-107998685

Received on Tuesday, 2 June 2015 15:56:38 UTC