From: Jonny Tischbein Date: Thu, 20 Sep 2018 15:20:57 +0000 (+0200) Subject: Make formatbar work X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9bc6238b59fac37e68d34b480bf393abf9d72516;p=friendica.git Make formatbar work --- diff --git a/view/theme/frio/js/textedit.js b/view/theme/frio/js/textedit.js index 2079c20cdc..cc79ea938e 100644 --- a/view/theme/frio/js/textedit.js +++ b/view/theme/frio/js/textedit.js @@ -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() diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index 839cba5837..f62da27969 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -93,11 +93,10 @@