Make formatbar work

This commit is contained in:
Jonny Tischbein 2018-09-20 17:20:57 +02:00
parent f590d31b4b
commit 9bc6238b59
2 changed files with 20 additions and 5 deletions

View file

@ -27,6 +27,22 @@ function insertFormatting(BBcode, id) {
return true;
}
function insertFormattingToPost(BBcode) {
textarea = document.getElementById("#profile-jot-text");
if (document.selection) {
textarea.focus();
selected = document.selection.createRange();
selected.text = "[" + BBcode + "]" + selected.text + "[/" + BBcode + "]";
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
var start = textarea.selectionStart;
var end = textarea.selectionEnd;
textarea.value = textarea.value.substring(0, start) + "[" + BBcode + "]" + textarea.value.substring(start, end) + "[/" + BBcode + "]" + textarea.value.substring(end, textarea.value.length);
}
$(textarea).trigger('change');
return true;
}
function showThread(id) {
$("#collapsed-comments-" + id).show()