comparison src/thread.html.luan @ 25:66fd3784e60e

back to textarea for bbcode
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 19 Jul 2022 22:24:24 -0600
parents 33731231093a
children 0837820b97fb
comparison
equal deleted inserted replaced
24:fccbe5554fcc 25:66fd3784e60e
54 color: #888; 54 color: #888;
55 } 55 }
56 [message] { 56 [message] {
57 white-space: pre-wrap; 57 white-space: pre-wrap;
58 } 58 }
59 </style> 59 textarea {
60 width: 100%;
61 xmax-width: 450px;
62 height: 100px;
63 }
64 </style>
60 <script> 65 <script>
61 function getPostDiv(node) { 66 function getPostDiv(node) {
62 do { 67 do {
63 if( node.getAttribute('post') ) 68 if( node.getAttribute('post') )
64 return node; 69 return node;
71 postDiv.querySelector('[edit]').innerHTML = ''; 76 postDiv.querySelector('[edit]').innerHTML = '';
72 } 77 }
73 function saveEdit(a) { 78 function saveEdit(a) {
74 let postDiv = getPostDiv(a); 79 let postDiv = getPostDiv(a);
75 let post = postDiv.getAttribute('post'); 80 let post = postDiv.getAttribute('post');
76 let text = postDiv.querySelector('[contentEditable]').innerHTML; 81 let text = postDiv.querySelector('textarea').value;
77 let postData = 'post=' + post + '&text=' + encodeURIComponent(text); 82 let postData = 'post=' + post + '&text=' + encodeURIComponent(text);
78 ajax("save_edit.js",postData); 83 ajax("save_edit.js",postData);
79 } 84 }
80 85
81 function deletePost(span) { 86 function deletePost(span) {
132 </div> 137 </div>
133 <% footer() %> 138 <% footer() %>
134 <span hidden delete>Delete? <a href="javascript:" onclick="deleteYes(parentNode)">yes</a> / <a href="javascript:" onclick="deleteNo(parentNode)">no</a></span> 139 <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> 140 <span hidden undelete><%deletePost()%></span>
136 <div hidden edit> 141 <div hidden edit>
137 <div contentEditable></div> 142 <textarea></textarea>
138 <p> 143 <p>
139 <button onclick="saveEdit(this)">save</button> 144 <button onclick="saveEdit(this)">save</button>
140 <button onclick="cancelEdit(this)">cancel</button> 145 <button onclick="cancelEdit(this)">cancel</button>
141 </p> 146 </p>
142 </div> 147 </div>