test multiline comments

pull/13/head
OFF0 2 years ago
parent 7b7b4d3f28
commit 409ff80d64
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -25,7 +25,7 @@
<img class="mbox-img" id="bubble" src="assets/comment.svg" alt=""> <img class="mbox-img" id="bubble" src="assets/comment.svg" alt="">
<div class="mbox-body" id="newMessage"> <div class="mbox-body" id="newMessage">
<form action="#" class="form-inline" id="writeForm"> <form action="#" class="form-inline" id="writeForm">
<input type="text" name="message"> <textarea name="message"></textarea>
<button type="submit" id="publish" disabled>send</button> <button type="submit" id="publish" disabled>send</button>
</form> </form>
<small id="sendstatus" class="form-status"></small> <small id="sendstatus" class="form-status"></small>

@ -152,6 +152,12 @@ setInterval(() => {
}); });
}, 10000); }, 10000);
function renderMultilineText(string) {
return string
.split('\n')
.reduce((acc, next, i) => acc.concat(i === 0 ? next : [elem('br'), next]), []);
}
function createTextNote(evt, relay) { function createTextNote(evt, relay) {
const {host, img, isReply, replies, time, userName} = getMetadata(evt, relay); const {host, img, isReply, replies, time, userName} = getMetadata(evt, relay);
const isLongContent = evt.content.length > 280; const isLongContent = evt.content.length > 280;
@ -172,7 +178,7 @@ function createTextNote(evt, relay) {
elem('time', {dateTime: time.toISOString()}, formatTime(time)), elem('time', {dateTime: time.toISOString()}, formatTime(time)),
]), ]),
]), ]),
elem('div', {data: isLongContent ? {append: evt.content.slice(280)} : null}, content), elem('div', {data: isLongContent ? {append: evt.content.slice(280)} : null}, renderMultilineText(content)),
elem('button', { elem('button', {
className: 'btn-inline', name: 'star', type: 'button', className: 'btn-inline', name: 'star', type: 'button',
data: {'eventId': evt.id, relay}, data: {'eventId': evt.id, relay},
@ -360,7 +366,7 @@ function getMetadata(evt, relay) {
// reply // reply
const writeForm = document.querySelector('#writeForm'); const writeForm = document.querySelector('#writeForm');
const input = document.querySelector('input[name="message"]'); const input = document.querySelector('textarea[name="message"]');
let lastReplyBtn = null; let lastReplyBtn = null;
let replyTo = null; let replyTo = null;
feedContainer.addEventListener('click', (e) => { feedContainer.addEventListener('click', (e) => {

Loading…
Cancel
Save