Re: CommandEvent for user intentions

I wrote a longer reply in the contentEditable=minimal thread, which touches
some aspects of command events. Actually, before some stable point about
cE=minimal is reached I feel that it may be hard to design command events
in a way that both are interoperable. Command events should be an extension
to cE=minimal making it possible to create advanced solutions on top of it.
Therefore, it may be beneficial to discuss both of them in one thread.

But for now, here are some additional thoughts which I haven't included in
the email about cE=minimal.

1. It should be possible to modify selection and DOM in a command event
listener, but leave the action to the browser. Browser should perform the
action on the updated selection and DOM. Example - I want to transform "* "
to a list when user types additional character. So I would listen to
keyboard event, check if two previous characters are "* ", replace them
with a list and place selection inside <li>. But I want browser to perform
character insertion so I don't have to handle undo manager, scrolling to
show caret, etc. There are of course other ways to achieve the same, but
this seems to be the cleanest.
2. It's not totally necessary, but it would be nice if command event would
also carry an information about its future result. For example command
fired for up-arrow key could carry a range with the proposed position of
caret. So if I don't agree with browser implementation, because for example
it enters a non-editable region, I can check that and handle this specific
case by myself. Since there's no easy JavaScript solution for handling
up/down arrow keys such information would allow us to focus only on these
specific behaviours we don't like.

Piotrek Koszuliński
CKEditor JavaScript Lead Developer

Received on Thursday, 22 May 2014 15:24:02 UTC