diff --git a/.gitignore b/.gitignore index 5ddb6e7..90e2325 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Binaries for programs and plugins +rwtxt *.exe *.exe~ *.dll diff --git a/static/js/rwtxt.js b/static/js/rwtxt.js index 532664a..86ebbf9 100644 --- a/static/js/rwtxt.js +++ b/static/js/rwtxt.js @@ -229,15 +229,18 @@ function onUploadFinished(file) { file.xhr.getResponseHeader("Location") + ')'; + var newLine = "\n" document.getElementById("editable").value = ( textBefore + - extraText + + extraText + + newLine + textAfter ); + console.log("SELECT LINK") // Select the newly-inserted link - document.getElementById("editable").selectionStart = cursorPos; - document.getElementById("editable").selectionEnd = cursorPos + extraText.length; + document.getElementById("editable").selectionStart = cursorPos + extraText.length + newLine.length; + document.getElementById("editable").selectionEnd = cursorPos + extraText.length + newLine.length; // expand textarea autoExpand(document.getElementById("editable")); // trigger a save