From c26f85568fe76b2e4d52cb730cbe7de97ea46e26 Mon Sep 17 00:00:00 2001 From: pentargency Date: Fri, 24 Feb 2023 20:04:40 -0800 Subject: [PATCH] implement ccd0's suggestions for improving QR split button pr --- src/Posting/QR.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index a58223f8f..e8d00cf57 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -359,9 +359,9 @@ QR = splitPost: -> count = QR.nodes.com.value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length text = QR.nodes.com.value - return if count < QR.max_comment + return if count < QR.max_comment or QR.selected.isLocked lastPostLength = 0 - QR.posts[QR.posts.length - 1].setComment(""); + QR.selected.setComment(""); for line in text.split("\n") currentLength = line.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length + 1 # 1 for newline @@ -370,7 +370,7 @@ QR = post.setComment(line) lastPostLength = currentLength else - currentPost = QR.posts[QR.posts.length - 1] + currentPost = QR.selected newComment = [currentPost.com, line].filter((el) -> el != null).join("\n") currentPost.setComment(newComment) lastPostLength += currentLength