diff options
Diffstat (limited to 'design/templates')
-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> |