Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/assets/javascripts/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $(() => {
const preSelectionEnd = $field[0].selectionEnd;
QPixel.MD.insertIntoField($field, this.start, this.end);
$field[0].selectionStart = preSelectionStart + this.start.length;
$field[0].selectionEnd = preSelectionEnd + this.end.length;
$field[0].selectionEnd = preSelectionEnd + this.start.length;
}
}

Expand Down Expand Up @@ -102,7 +102,10 @@ $(() => {
hr: new InlineAction('\n\n-----\n\n'),
table: new InlineAction('\n\n| Title1 | Title2 |\n|- | - |\n| row1_1 | row1_2 |\n\n'),
mathjax: new InlineAction('$', '$'),
spoiler: new InlineAction('\n\n<details>\n<summary>Spoiler</summary>\n', '\n</details>\n\n'),
spoiler: new InlineAction(
'\n\n<details>\n<summary>Spoiler</summary>\n' +
'<!-- An empty line is required for markdown to render -->\n\n',
'\n</details>\n\n'),
};

$(document).on('click', '.js-markdown-tool', (ev) => {
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_markdown_tools.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

<div class="button-list is-gutterless">
<a href="javascript:void(0)" class="button is-outlined is-muted is-icon-only" data-drop="#markdown-tools"
data-drop-self-class-toggle="is-active" aria-label="Tools" title="Tools: headings, lines" role="button">
data-drop-self-class-toggle="is-active" aria-label="Tools" title="Other tools" role="button">
<i class="fas fa-tools"></i>
</a>

Expand Down
Loading