Feature #41294
closedPartial quoting feature for Issues and Forums
0%
Description
Background/Purpose¶
Currently, Redmine allows quoting entire messages in issues and forums. However, it is inconvenient when users want to quote only a portion of a long message
This patch introduces the ability to quote only selected parts of messages, improving usability when handling long texts.
Features¶
Quoting selected text¶
- When the user selects the text they want to quote and clicks the quote button, only the selected portion will be inserted into the comment field as a quote. If no text is selected, the entire message will be quoted, just like the current behavior.
- If multiple parts of the message are selected (currently supported only in Firefox as of 2024), only the first selected part is quoted.
Preserving original message format in CommonMark Markdown only¶
- The original message format will be preserved during quoting only if the text format is set to CommonMark Markdown. For other text formats, the message will be quoted as plain text without retaining its original formatting.
- Some formats will not be fully supported:
- Table formatting will be quoted as plain text.
- Redmine-specific link formatting will be quoted as standard Markdown links. For example,
#12
becomes[#12](/issues/12)
Implementation¶
This feature is implemented as follows.
- When the quote button is pressed, the HTML of the selected text is retrieved and converted into CommonMark Markdown.
- The conversion from HTML to CommonMark Markdown is done using the turndown library (MIT license).
- Use only JavaScript APIs that are widely supported by browsers wherever possible.
- Since turndown does not offer a minified version of its source code, I compressed it using uglify v3.19.3.
uglify --compress --mangle --output=app/assets/javascripts/turndown-7.2.0.min.js -- turndown.js
Testing¶
This patch was tested on the Redmine trunk using the following browsers:
- Chrome (macOS, Ubuntu)
- Firefox (macOS, Ubuntu)
- Safari
- MSEdge (macOS)
Additional notes¶
When reviewing, it will be easier to understand if you check the commits (patches) in order. The commits are split to help clarify how the feature was implemented. Please combine them into one commit when merging this feature.
Screenshots¶
When using CommonMark Markdown, the original message format is almost preserved:
When using Textile, the original message format is not preserved:
Files
Updated by Katsuya HIDAKA about 2 months ago
- File 0001-Add-system-tests-for-the-current-behavior.patch 0001-Add-system-tests-for-the-current-behavior.patch added
- File 0002-Implement-and-use-JS-function-to-handle-quote-reply.patch 0002-Implement-and-use-JS-function-to-handle-quote-reply.patch added
- File 0003-Add-the-ability-to-quote-partial-text.patch 0003-Add-the-ability-to-quote-partial-text.patch added
- File 0004-Separate-the-quote-reply-implementation-into-quote_reply.js.patch 0004-Separate-the-quote-reply-implementation-into-quote_reply.js.patch added
- File 0005-Separate-helpers-for-the-quote-reply-into-the-Redmine-QuoteReply.patch 0005-Separate-helpers-for-the-quote-reply-into-the-Redmine-QuoteReply.patch added
- File 0006-Separate-the-implementation-for-building-a-quote-into-Redmine-QuoteReply.patch 0006-Separate-the-implementation-for-building-a-quote-into-Redmine-QuoteReply.patch added
- File 0007-Allow-replying-qith-quotes-in-CommonMark-format.patch 0007-Allow-replying-qith-quotes-in-CommonMark-format.patch added
I attached the patch files for this feature.
Updated by Katsuya HIDAKA about 2 months ago
- File 0008-Modified-to-simpler-implementation-and-improved-code-comments.patch 0008-Modified-to-simpler-implementation-and-improved-code-comments.patch added
I have added a patch file to simplify the implementation and improve some code comments.
Updated by Katsuya HIDAKA about 2 months ago
- File Partial-quoting-feature-for-Issues-and-Forums.patch Partial-quoting-feature-for-Issues-and-Forums.patch added
To make it easier to try and test this feature in your environment, I have added the patch file that combines all patch files (0001...0008-*.patch).
Updated by Katsuya HIDAKA about 2 months ago
Below is a short screencast demonstrating the functionality: Text formatting is set to CommonMark Markdown.
Also, this patch adds new functionality to the existing quote reply feature but does not change its current behavior, so even after this patch is integrated, the current quote reply functionality that quotes the entire message will continue to work as before.
Please let me know your thoughts on this feature. Any feedback is greatly appreciated.
Updated by Go MAEDA about 1 month ago
- Category set to UI
- Target version set to Candidate for next major release
I have been using Redmine for user support for long years, and I have always wanted the ability to partially quote issue descprion or notes. After trying this patch, I found that it works exactly I expected. Additionally, it is especially great when the text formatter is CommonMark Markdown, as the markup is preserved in the quoted text.
Redmine 6.0.0 will introduce several UI improvements such as #23980, #41321, and #41298, and I belive this partial quoting feature would be a great addition to those improvements.
Updated by Go MAEDA about 1 month ago
- Target version changed from Candidate for next major release to 6.0.0
Setting the target version to 6.0.0.
Updated by Go MAEDA about 1 month ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch in r23107.
Thank you for your contribution.
Updated by Katsuya HIDAKA 22 days ago
- File Fixed-tests-for-the-partial-quoting-feature-that-randomly-fail.patch Fixed-tests-for-the-partial-quoting-feature-that-randomly-fail.patch added
I found that some tests for this feature have been failing randomly, so I have attached a patch to fix it. Please review and commit the patch.