From 9bc6238b59fac37e68d34b480bf393abf9d72516 Mon Sep 17 00:00:00 2001 From: Jonny Tischbein Date: Thu, 20 Sep 2018 17:20:57 +0200 Subject: [PATCH] Make formatbar work --- view/theme/frio/js/textedit.js | 16 ++++++++++++++++ view/theme/frio/templates/jot.tpl | 9 ++++----- 2 files changed, 20 insertions(+), 5 deletions(-) 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 @@