-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[beforeinput] Add InputType 'deleteByKill', 'insertFromYank' and 'transpose' #20
Comments
What is the usecase for this? Typing errors? |
From @choniong on August 24, 2016 19:37 Did some search and cannot find more info about it...(I don't actually use it) I think it's not worth adding new InputTypes since nobody uses it (I assume?), but as they are modifying DOM we should at least have some notes about the expected events, e.g.:
|
I think this has to depend on, whether someone uses it (as you say) and whether this functionality can be interpreted in some way to make a change of semantic significance that applies to a different range than the default handling. For example, how does ctrl+t behave around element boundaries? Does it only ever make changes within a single text node? |
From @choniong on August 24, 2016 20:28
It won't pass editing boundary nor paragraph boundary.
It could pass Apple's reference NSResponder - transpose:. |
I see. Then this may be somewhat more complicated. Element boundaries have at times a meaning within the editor that the browser isn't aware of. Say for example, that a particular editor puts span-elements around all words or syllables if the word is longer than ten letters for the purpose of tracking their position or alike. As long as the spans are not styled, the end user doesn't notice this. If now the user intents to "transpose" two characters, but the JS doesn't ever know that this was the intention of the end user and instead only gets to know that the end user has asked for changing some things in and out of two span-elements that happen to end/start in-between the two letters in question, this could lead to all kinds of misunderstandings. Does this makes ense? So I would say this has to get its own intention. Same with yank/kill. It doesn't take that much for us to define them, and if Apple finds out that really no-one uses them, they can remove them from Mac OS X and we can remove them from a future version of the spec. |
From @choniong on August 24, 2016 21:15
OK, so for example the default behavior for
JS might want to detect
OK, so how about:
|
That's possible. I was thinking of a case such as:
The spans above are something used by the JS editor and what the meaning of
That sounds good to me. |
@choniong: I have not yet added the |
Yes you are right (sorry for the confusion, I don't actually use Kill/Yank):
And |
This is as I had understood it earlier, but I wonder if this is simply a bug or if I misunderstood something. Is it correct that deleting backward, one can only delete to the start of the line, whereas forward one can only delete to the end of the paragraph? This seems asymmetric. |
Ok, so this looks fairly similar to the clipboard. If we want to be super consistent, then that means that preventDefaulting any of these delete actions will not not cancel moving things to the kill buffer. The only difference is that we don't currently have events for moving things to the kill buffer, right? But I guess it'll be OK for now as we can cancel things when they are being inserted ("yanked"). At some stage the event order with putting things in the kill buffer and the beforeinput event needs to be defined. For now we may not have to do anything more to the text. I should add notes to explain that preventing cut doesn't prevent cut and possibly that the above mentioned may add things to the kill buffer on some platforms and that also this isn't prevent when preventDefaulting. |
Seems true to me:
And I cannot find hotkeys for deleting to the end of the line or the start of the paragraph on mac OS or Emacs (I would expect
Also looks true to me, I guess both canceling Kill or not is fine, JS can always implement Kill/Yank easily. |
This manual [1] seems to indicate that when enabling soft-wrapping in Emacs, [1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Visual-Line-Mode.html#Visual-Line-Mode |
@choniong Is it possible at all that the ctrl-k shortcut on mac is linked incorrectly? Does this apply to all browsers, or just Chrome/Webkit? |
Sorry for the late reply. From my testing on Firefox for Mac
On Chrome/Webkit and mac OS native apps (TextEdit, Notes)
I'm guessing Firefox is incorrect, but it shouldn't matter since the browser should just fire what it does. If our goal is to list all
|
For However, given that also the native app behavior is different, I agree that we need to go with that.
Unless we can think of a good reason why this should only exist for going backward, I would prefer having it be symmetrical. On the other hand, if no browser supports it, it may just confuse JavaScript developers if they work on creating functionality for a specific inputtype, only to discover later that it's not being used at all. AT least we need to make sure that sites such as caniuse list which inputtypes are not used.
By "entire line backward" you mean delete the line the caret is on both backward and forward? Or is it the equivalent of an entire line going backward?
I've added this one. |
Yes I agree we should have both forward and backward, and maybe have an example/notes section listing known hotkeys.
It's deleting both backward and forward, e.g. On Firefox
I added But actually we don't have direction for |
That makes sense.
We don't. I wonder if it because there is a general idea that the default deletion is backward. But if this is the case, it should likely be noted somewhere. |
How about using "deleteBlockBackward" or similar instead of "deleteParagraphBackward" to make clear that it also works in things other than |
Delete Line backward could also have meant that
becomes
That's why I was asking. |
Sorry actually please ignore the example Just to confirm we are in the same page, my proposal is:
e.g. In a narrow box
Press
|
Ok, I have tested it myself now.
Yes, let's use the terms |
From @choniong on August 24, 2016 15:58
On MacOS the hotkey
ctrl-t
will transpose the two character besides cursor (Chrome and Safari), e.g.Should we:
InputType
, orinsertText
with the target range?Copied from original issue: w3c/editing#148
The text was updated successfully, but these errors were encountered: