comparison 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
comparison
equal deleted inserted replaced
45:2d4f00755092 46:289718f121e4
14 post = Post.get_by_id(post) or error() 14 post = Post.get_by_id(post) or error()
15 Io.stdout = Http.response.text_writer() 15 Io.stdout = Http.response.text_writer()
16 %> 16 %>
17 let postDiv = document.querySelector('[post="<%=post.id%>"]'); 17 let postDiv = document.querySelector('[post="<%=post.id%>"]');
18 postDiv.querySelector('[output]').style.display = 'none'; 18 postDiv.querySelector('[output]').style.display = 'none';
19 postDiv.querySelector('[edit]').innerHTML = document.querySelector('[hidden][edit]').innerHTML; 19 bbcodeCreate( postDiv.querySelector('[edit]'), {
20 content: <%= json_string(html_encode(post.content)) %>,
21 save: saveEdit,
22 cancel: cancelEdit,
23 } );
20 let textarea = postDiv.querySelector('textarea'); 24 let textarea = postDiv.querySelector('textarea');
21 textarea.innerHTML = <%= json_string(html_encode(post.content)) %>;
22 fixTextarea(textarea);
23 textarea.focus(); 25 textarea.focus();
24 <% 26 <%
25 end 27 end