diff --git a/content/root.js b/content/root.js index 0cf90d1..5b1512e 100644 --- a/content/root.js +++ b/content/root.js @@ -29,6 +29,7 @@ function toggleTheme() { async function editMessage(messageId, content) { const newContent = prompt("Edit message:", content); + if (newContent === null) { return; } @@ -253,6 +254,10 @@ async function loadMessages(forceUpdate = false, scrollLocation) { const contentString = doc.querySelector("span").textContent; + const isMultiline = contentString.match( + "\\n", + ) && true || false; + if ( compareUsername === document.getElementById( @@ -264,6 +269,10 @@ async function loadMessages(forceUpdate = false, scrollLocation) { editHtml = ``; } + // TODO: Add edit for multiline messages + if (isMultiline) { + editHtml = ""; + } messageDiv.innerHTML = `
${username} ${timestamp} ${deleteHtml} ${editHtml}
diff --git a/readme.md b/readme.md index ff844d4..e0945f7 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,7 @@ ## Frontend ### High Priority - Lazy load with pagination (frontend and backend) +- Edit support for multiline message ### Mid Priority - Other embeds (Twitter posts, spotify tracks, soundcloud, github repos, instagram posts, other video platforms) ### Low Priority