Small refactor.
This commit is contained in:
parent
7506274a84
commit
ad3e363bf2
@ -1349,11 +1349,9 @@
|
|||||||
}
|
}
|
||||||
ta = $('textarea', qr.el);
|
ta = $('textarea', qr.el);
|
||||||
caretPos = ta.selectionStart;
|
caretPos = ta.selectionStart;
|
||||||
ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd, ta.value.length);
|
qr.selected.el.lastChild.textContent = qr.selected.com = ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd, ta.value.length);
|
||||||
ta.focus();
|
ta.focus();
|
||||||
ta.selectionEnd = ta.selectionStart = caretPos + text.length;
|
return ta.selectionEnd = ta.selectionStart = caretPos + text.length;
|
||||||
qr.selected.com = ta.value;
|
|
||||||
return qr.selected.el.lastChild.textContent = ta.value;
|
|
||||||
},
|
},
|
||||||
fileDrop: function(e) {
|
fileDrop: function(e) {
|
||||||
if (/TEXTAREA|INPUT/.test(e.target.nodeName)) return;
|
if (/TEXTAREA|INPUT/.test(e.target.nodeName)) return;
|
||||||
|
|||||||
@ -983,15 +983,15 @@ qr =
|
|||||||
ta = $ 'textarea', qr.el
|
ta = $ 'textarea', qr.el
|
||||||
caretPos = ta.selectionStart
|
caretPos = ta.selectionStart
|
||||||
# Replace selection for text.
|
# Replace selection for text.
|
||||||
ta.value = ta.value[0...caretPos] + text + ta.value[ta.selectionEnd...ta.value.length]
|
# onchange event isn't triggered, save value.
|
||||||
|
qr.selected.el.lastChild.textContent =
|
||||||
|
qr.selected.com =
|
||||||
|
ta.value =
|
||||||
|
ta.value[0...caretPos] + text + ta.value[ta.selectionEnd...ta.value.length]
|
||||||
ta.focus()
|
ta.focus()
|
||||||
# Move the caret to the end of the new quote.
|
# Move the caret to the end of the new quote.
|
||||||
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
||||||
|
|
||||||
# onchange event isn't triggered, save value.
|
|
||||||
qr.selected.com = ta.value
|
|
||||||
qr.selected.el.lastChild.textContent = ta.value
|
|
||||||
|
|
||||||
fileDrop: (e) ->
|
fileDrop: (e) ->
|
||||||
return if /TEXTAREA|INPUT/.test e.target.nodeName
|
return if /TEXTAREA|INPUT/.test e.target.nodeName
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user