Add a View Markdown option for topics and comments
Fixes #67 (closed).
This adds a "More..." dropdown to text topics and comments that contains a "View Markdown" button which will render a read-only textarea that contains the Markdown. As well as a "Hide" and "Copy Markdown" button.
For the JS copy functionality I created a generic behavior similar to the cancel button that can operate in 2 modes:
- If a
data-js-copy-target="#selector"is set on the copy button, it will copy the contents of that target element.
- Otherwise let jQuery pick the first input or textarea it finds in the form and use that instead.
data-js-copy-target code isn't necessary for this MR but I figured it would be nice to keep if in the future we need to be able to copy a specific element.
To get the style to match the other buttons I changed some stuff around, I'm not sure if it's all done in the right places but it works.