diff options
author | luxagraf <sng@luxagraf.net> | 2018-02-02 16:46:46 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-02-02 16:46:46 -0600 |
commit | 401c90364b76f2ad5a37e489ccdefc6be38fe1ac (patch) | |
tree | 27058193b22adc7df0a6d674e633f48dd95072a1 /design/templates/admin/insert_images.html | |
parent | 56956009a2a1f02a60d7591cddcdd5f627d88258 (diff) |
added return false to stop reload
Diffstat (limited to 'design/templates/admin/insert_images.html')
-rw-r--r-- | design/templates/admin/insert_images.html | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/design/templates/admin/insert_images.html b/design/templates/admin/insert_images.html index 9caaeed..192feb9 100644 --- a/design/templates/admin/insert_images.html +++ b/design/templates/admin/insert_images.html @@ -97,15 +97,16 @@ Array.from(document.getElementsByClassName('insert')).forEach(function(item) { } item.addEventListener("click", function( event ) { var el = parent.document.getElementById('{{textarea_id}}'); - var start = el.selectionStart - var end = el.selectionEnd - var text = el.value - var before = text.substring(0, start) - var after = text.substring(end, text.length) - el.value = (before + code + after) + var start = el.selectionStart; + var end = el.selectionEnd; + var text = el.value; + var before = text.substring(0, start); + var after = text.substring(end, text.length); + el.value = (before + code + after); console.log(code); - el.selectionStart = el.selectionEnd = start + code.length - el.focus() + el.selectionStart = el.selectionEnd = start + code.length; + el.focus(); + return false; }, false); }); </script> |