diff --git a/components/action-dropdown.js b/components/action-dropdown.js index b922967d1..497f150d0 100644 --- a/components/action-dropdown.js +++ b/components/action-dropdown.js @@ -8,7 +8,7 @@ export default function ActionDropdown ({ children }) { } return ( - + e.preventDefault()}> diff --git a/components/reply.js b/components/reply.js index 89a862b63..54db9b9d3 100644 --- a/components/reply.js +++ b/components/reply.js @@ -45,12 +45,14 @@ export default forwardRef(function Reply ({ item, onSuccess, replyOpen, children if (!reply) { setReply(true) } + const selection = window.getSelection() + const textToQuote = selection.isCollapsed ? item.text : selection.toString() let updatedValue if (formInnerRef.current && formInnerRef.current.values && !formInnerRef.current.values.text) { - updatedValue = quote(item.text) + updatedValue = quote(textToQuote) } else if (formInnerRef.current?.values?.text) { // append quote reply text if the input already has content - updatedValue = `${replyInput.current.value}\n${quote(item.text)}` + updatedValue = `${replyInput.current.value}\n${quote(textToQuote)}` } if (updatedValue) { replyInput.current.value = updatedValue