comparison src/thread.html.luan @ 21:33731231093a

fix bbcode editing
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 17 Jul 2022 08:24:52 -0600
parents 3ea49246d6a7
children 66fd3784e60e
comparison
equal deleted inserted replaced
20:3ea49246d6a7 21:33731231093a
71 postDiv.querySelector('[edit]').innerHTML = ''; 71 postDiv.querySelector('[edit]').innerHTML = '';
72 } 72 }
73 function saveEdit(a) { 73 function saveEdit(a) {
74 let postDiv = getPostDiv(a); 74 let postDiv = getPostDiv(a);
75 let post = postDiv.getAttribute('post'); 75 let post = postDiv.getAttribute('post');
76 let text = postDiv.querySelector('[contentEditable]').textContent; 76 let text = postDiv.querySelector('[contentEditable]').innerHTML;
77 let postData = 'post=' + post + '&text=' + encodeURIComponent(text); 77 let postData = 'post=' + post + '&text=' + encodeURIComponent(text);
78 ajax("save_edit.js",postData); 78 ajax("save_edit.js",postData);
79 } 79 }
80 80
81 function deletePost(span) { 81 function deletePost(span) {
132 </div> 132 </div>
133 <% footer() %> 133 <% footer() %>
134 <span hidden delete>Delete? <a href="javascript:" onclick="deleteYes(parentNode)">yes</a> / <a href="javascript:" onclick="deleteNo(parentNode)">no</a></span> 134 <span hidden delete>Delete? <a href="javascript:" onclick="deleteYes(parentNode)">yes</a> / <a href="javascript:" onclick="deleteNo(parentNode)">no</a></span>
135 <span hidden undelete><%deletePost()%></span> 135 <span hidden undelete><%deletePost()%></span>
136 <div hidden edit> 136 <div hidden edit>
137 <div contentEditable onkeypress="return editorKey()"></div> 137 <div contentEditable></div>
138 <p> 138 <p>
139 <button onclick="saveEdit(this)">save</button> 139 <button onclick="saveEdit(this)">save</button>
140 <button onclick="cancelEdit(this)">cancel</button> 140 <button onclick="cancelEdit(this)">cancel</button>
141 </p> 141 </p>
142 </div> 142 </div>