Skip to content

Add a View Markdown option for topics and comments

Bauke requested to merge Bauke/tildes:markdown-source into master

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:

  1. If a data-js-copy-target="#selector" is set on the copy button, it will copy the contents of that target element.
  2. Otherwise let jQuery pick the first input or textarea it finds in the form and use that instead.

The 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.

image

image

image

Merge request reports