mirror of https://github.com/torappinfo/uweb
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
433 B
JavaScript
14 lines
433 B
JavaScript
var textarea;
|
|
function deleteLine(ta){
|
|
let startPos = ta.selectionStart;
|
|
let endPos = ta.selectionEnd;
|
|
let text = ta.value;
|
|
let lStart = startPos-1;
|
|
while(lStart>=0 && text.charAt(lStart)!='\n') lStart--;
|
|
let lEnd = endPos;
|
|
let len = text.length;
|
|
while(lEnd<len && text.charAt(lEnd)!='\n') lEnd++;
|
|
ta.value = text.substring(0,lStart+1) + text.substring(lEnd+1);
|
|
ta.selectionStart = ta.selectionEnd = lStart +1;
|
|
}
|