diff src/thread.html.luan @ 32:72a1b77b4548

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 29 Jul 2022 13:57:20 -0600
parents 0837820b97fb
children 4fdc4ec0050b
line wrap: on
line diff
--- a/src/thread.html.luan	Wed Jul 27 22:10:18 2022 -0600
+++ b/src/thread.html.luan	Fri Jul 29 13:57:20 2022 -0600
@@ -71,19 +71,26 @@
 				} while( node = node.parentNode );
 			}
 
-			function cancelEdit(a) {
-				let postDiv = getPostDiv(a);
+			function cancelEdit(src) {
+				let postDiv = getPostDiv(src);
 				postDiv.querySelector('[output]').style.display = 'block';
 				postDiv.querySelector('[edit]').innerHTML = '';
 			}
-			function saveEdit(a) {
-				let postDiv = getPostDiv(a);
+			function saveEdit(src) {
+				let postDiv = getPostDiv(src);
 				let post = postDiv.getAttribute('post');
 				let text = postDiv.querySelector('textarea').value;
 				let postData = 'post=' + post + '&text=' + encodeURIComponent(text);
 				ajax("save_edit.js",postData);
 			}
 
+			function upload(src) {
+				let postDiv = getPostDiv(src);
+				let textarea = postDiv.querySelector('textarea');
+				textarea.focus();
+				textarea.setRangeText('xyz',textarea.selectionStart,textarea.selectionEnd,'select');
+			}
+
 			function deletePost(span) {
 				span.innerHTML = document.querySelector('[hidden][delete]').innerHTML;
 			}
@@ -142,6 +149,7 @@
 		<div hidden edit>
 			<textarea></textarea>
 			<p>
+				<button onclick="upload(this)">upload</button>
 				<button onclick="saveEdit(this)">save</button>
 				<button onclick="cancelEdit(this)">cancel</button>
 			</p>