diff options
-rw-r--r-- | view/js/main.js | 20 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 17 |
2 files changed, 37 insertions, 0 deletions
diff --git a/view/js/main.js b/view/js/main.js index eb8c78ef4..68a140a33 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -118,6 +118,26 @@ return true; } + function inserteditortag(BBcode) { + // allow themes to override this + if(typeof(insertEditorFormatting) != 'undefined') + return(insertEditorFormatting(BBcode)); + + textarea = document.getElementById('profile-jot-text'); + if (document.selection) { + textarea.focus(); + selected = document.selection.createRange(); + selected.text = urlprefix+"["+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); + } + return true; + } + + + function insertCommentURL(comment,id) { reply = prompt(aStr['linkurl']); diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 4fe48d4e5..4d9207c3b 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -38,6 +38,23 @@ </div> <div id="profile-jot-submit-wrapper" class="jothidden"> <div id="profile-jot-submit-left" class="btn-toolbar pull-left"> + <div class='btn-group'> + <button id="main-editor-bold" class="btn btn-default btn-sm" title="{{$bold}}" onclick="inserteditortag('b'); return false;"> + <i class="icon-bold jot-icons"></i> + </button> + <button id="main-editor-italic" class="btn btn-default btn-sm" title="{{$italic}}" onclick="inserteditortag('i'); return false;"> + <i class="icon-italic jot-icons"></i> + </button> + <button id="main-editor-underline" class="btn btn-default btn-sm" title="{{$underline}}" onclick="inserteditortag('u'); return false;"> + <i class="icon-underline jot-icons"></i> + </button> + <button id="main-editor-quote" class="btn btn-default btn-sm" title="{{$quote}}" onclick="inserteditortag('quote'); return false;"> + <i class="icon-quote-left jot-icons"></i> + </button> + <button id="main-editor-code" class="btn btn-default btn-sm" title="{{$code}}" onclick="inserteditortag('code'); return false;"> + <i class="icon-terminal jot-icons"></i> + </button> + </div> {{if $visitor}} <div class='btn-group'> <button id="wall-image-upload" class="btn btn-default btn-sm" title="{{$upload}}" > |