Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/Posting/QR.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ QR =
{root} = post.nodes
postRange = new Range()
postRange.selectNode root
text = if post.board.ID is g.BOARD.ID then ">>#{post}\n" else ">>>/#{post.board}/#{post}\n"
quoteBacklink = if post.board.ID is g.BOARD.ID then ">>#{post}\n" else ">>>/#{post.board}/#{post}\n"
quoteText = ""
for i in [0...sel.rangeCount]
range = sel.getRangeAt i
# Trim range to be fully inside post
Expand Down Expand Up @@ -323,12 +324,20 @@ QR =
for node in $$ '.embedder', frag
$.rm node.previousSibling if node.previousSibling?.nodeValue is ' '
$.rm node
text += ">#{frag.textContent.trim()}\n"
quoteText = ">#{frag.textContent.trim()}\n"

QR.openPost()
{com, thread} = QR.nodes
thread.value = Get.threadFromNode @ unless com.value

text = quoteBacklink
if quoteText != ""
alreadyQuoted = com.value.includes quoteBacklink
if !Conf['Avoid Duplicated Quotes'] or !alreadyQuoted
text = quoteBacklink + quoteText
else
text = quoteText

wasOnlyQuotes = QR.selected.isOnlyQuotes()

caretPos = com.selectionStart
Expand Down
4 changes: 4 additions & 0 deletions src/config/Config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@ Config =
true
'Add option in header menu to thread conversations.'
]
'Avoid Duplicated Quotes': [
false
'Avoid adding duplicate instances of a given post number when quoting with selected text'
]

imageExpansion:
'Fit width': [
Expand Down