1
0
Fork 0

Merge pull request #7728 from MrPetovan/task/7682-better-insert-link-button

Discriminate between links and non-links in [url] BBCode tag insertion
This commit is contained in:
Tobias Diekershoff 2019-10-14 14:57:31 +02:00 committed by GitHub
commit 2b8642d2b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 59 additions and 161 deletions

View file

@ -28,28 +28,6 @@ Renderer::setActiveTemplateEngine('smarty3');
}
$a->page['htmlhead'] .= <<< EOT
<script>
function insertFormatting(BBcode, id) {
var tmpStr = $("#comment-edit-text-" + id).val();
if (tmpStr == "") {
$("#comment-edit-text-" + id).addClass("comment-edit-text-full");
$("#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();
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);
}
return true;
}
function cmtBbOpen(comment, id) {
if ($(comment).hasClass('comment-edit-text-full')) {
$(".comment-edit-bb-" + id).show();