Open dnknn opened 2 years ago
Hmm... did you actually accidentally pasted a text instead of scrolling? The pasting will happen only if you click, without a single move of the mouse, so it should be rare.
I need to test it more myself, but if this is something people would use, I don't see why not. Also, no need to add code snippets :), I know my stuff very well :).
Hmm... did you actually accidentally pasted a text instead of scrolling?
It is the accident of worrying about misoperation, and I don't know that I have pasted the text.
textarea
, it is best to be careful when editing, right?For a simple single-line edit box, we don't need to think too much and don't need too much careful. At the same time, the common scenarios of middle-click paste are enabled. For example, sometimes you don't want to use the keyboard(Ctrl+V) or right-click contextmenu, but directly paste the keyword with the middle-click of the mouse in the search box of the page, and then click the search button to open the search results!
First look at the screenshot - UI options
middle click
to ScrollAnywhere.Use middle click to "paste" content of the clipboard
only paste with single-line input boxes
In other words, it is recommended to add a new sub-option. When this sub-option is enabled, the paste behavior will determine the element type of the input/edit box.
Why is such an extra suboption needed? Because in multi-line input/edit boxes like
textarea
, I want middle-click scrolling, but don't want to trigger accidental paste behavior. In a multi-line edit box, it is easy to accidentally trigger paste without knowing it. But in a simple single-line edit box, even if the paste is accidentally triggered, it can be easily found. Also because of this feature suggestion, it is easy to be implemented. So came up with the idea, for some people, to get the best balance between scrolling and pasting behavior of the middle-click.single-line input boxes:
input[type=text]
input[type=search]
input[type=number]
...multi-line input boxes:
textarea
[contenteditable=true]
/isContentEditable
Mouse events can determine the element type, so we can easily implement,
That is to say, Paste behavior is only triggered when not
(TARGET.matches('textarea') || TARGET.isContentEditable)
So, is it possible to add a suboption for this feature?❓