implement ccd0's suggestions for improving QR split button pr
This commit is contained in:
parent
4a542a57c9
commit
c26f85568f
@ -359,9 +359,9 @@ QR =
|
|||||||
splitPost: ->
|
splitPost: ->
|
||||||
count = QR.nodes.com.value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length
|
count = QR.nodes.com.value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length
|
||||||
text = QR.nodes.com.value
|
text = QR.nodes.com.value
|
||||||
return if count < QR.max_comment
|
return if count < QR.max_comment or QR.selected.isLocked
|
||||||
lastPostLength = 0
|
lastPostLength = 0
|
||||||
QR.posts[QR.posts.length - 1].setComment("");
|
QR.selected.setComment("");
|
||||||
|
|
||||||
for line in text.split("\n")
|
for line in text.split("\n")
|
||||||
currentLength = line.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length + 1 # 1 for newline
|
currentLength = line.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length + 1 # 1 for newline
|
||||||
@ -370,7 +370,7 @@ QR =
|
|||||||
post.setComment(line)
|
post.setComment(line)
|
||||||
lastPostLength = currentLength
|
lastPostLength = currentLength
|
||||||
else
|
else
|
||||||
currentPost = QR.posts[QR.posts.length - 1]
|
currentPost = QR.selected
|
||||||
newComment = [currentPost.com, line].filter((el) -> el != null).join("\n")
|
newComment = [currentPost.com, line].filter((el) -> el != null).join("\n")
|
||||||
currentPost.setComment(newComment)
|
currentPost.setComment(newComment)
|
||||||
lastPostLength += currentLength
|
lastPostLength += currentLength
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user