diff src/edit.js.luan @ 46:289718f121e4

use bbcode editor
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 14 Nov 2022 18:43:38 -0700
parents 0c1b820fff34
children 8b5b1bce7d6b
line wrap: on
line diff
--- a/src/edit.js.luan	Sun Nov 13 22:07:18 2022 -0700
+++ b/src/edit.js.luan	Mon Nov 14 18:43:38 2022 -0700
@@ -16,10 +16,12 @@
 %>
 	let postDiv = document.querySelector('[post="<%=post.id%>"]');
 	postDiv.querySelector('[output]').style.display = 'none';
-	postDiv.querySelector('[edit]').innerHTML = document.querySelector('[hidden][edit]').innerHTML;
+	bbcodeCreate( postDiv.querySelector('[edit]'), {
+		content: <%= json_string(html_encode(post.content)) %>,
+		save: saveEdit,
+		cancel: cancelEdit,
+	} );
 	let textarea = postDiv.querySelector('textarea');
-	textarea.innerHTML = <%= json_string(html_encode(post.content)) %>;
-	fixTextarea(textarea);
 	textarea.focus();
 <%
 end