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
Related issues