diff options
Diffstat (limited to 'view/theme/diabook-red')
-rwxr-xr-x | view/theme/diabook-red/theme.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/view/theme/diabook-red/theme.php b/view/theme/diabook-red/theme.php index aec3ab95d..d1b932f1c 100755 --- a/view/theme/diabook-red/theme.php +++ b/view/theme/diabook-red/theme.php @@ -523,15 +523,21 @@ function insertFormatting(BBcode,id) { $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty"); openMenu("comment-edit-submit-wrapper-" + id); } - + textarea = document.getElementById("comment-edit-text-" +id); if (document.selection) { textarea.focus(); selected = document.selection.createRange(); + if (BBcode == "url"){ + selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]"; + } else selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]"; } else if (textarea.selectionStart || textarea.selectionStart == "0") { var start = textarea.selectionStart; var end = textarea.selectionEnd; + if (BBcode == "url"){ + textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length); + } else textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length); } return true; |