Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegiacometti committed Nov 16, 2021
1 parent 05cfb03 commit 714aec6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions assets/javascripts/view_layouts_base_body_bottom_markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ function styleSelectedText(textarea, prepend, append) {
textarea.val($content);
textarea.focus();
textarea.prop('selectionStart', $start - prepend.length);
textarea.prop('selectionEnd', $end - append.length);
textarea.prop('selectionEnd', $end - prepend.length);
} else {
$content = $content.slice(0, $start) + prepend + $content.slice($start, $end) + append + $content.slice($end, $content.length);
textarea.val($content);
textarea.focus();
textarea.prop('selectionStart', $start + prepend.length);
textarea.prop('selectionEnd', $end + append.length);
textarea.prop('selectionEnd', $end + prepend.length);
}
}

Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/view_layouts_base_body_bottom_textile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ function styleSelectedText(textarea, prepend, append) {
textarea.focus();
textarea.prop('selectionStart', $start - prepend.length);
var end =
textarea.prop('selectionEnd', $end - (append == "\n</pre>" ? append.replace("\n", '').length : append.length));
textarea.prop('selectionEnd', $end - prepend.length);
} else {
$content = $content.slice(0, $start) + prepend + $content.slice($start, $end) + append + $content.slice($end, $content.length);
textarea.val($content);
textarea.focus();
textarea.prop('selectionStart', $start + prepend.length);
textarea.prop('selectionEnd', $end + (append == "\n</pre>" ? append.replace("\n", '').length : append.length));
textarea.prop('selectionEnd', $end + prepend.length);
}
}

Expand Down

0 comments on commit 714aec6

Please sign in to comment.