diff options
author | Ev Bogue <ev@evbogue.com> | 2019-12-15 08:40:05 -0600 |
---|---|---|
committer | Ev Bogue <ev@evbogue.com> | 2019-12-15 08:40:05 -0600 |
commit | 0ce80cde9303db97124ada1a5745aed554041859 (patch) | |
tree | cbf99255c2654217ee5107c7176290cb34738924 /render.js | |
parent | 55989c498fd62a47b47cb033a764fd4dd23ed5a6 (diff) |
fix some glitches with the edit function
Diffstat (limited to 'render.js')
-rw-r--r-- | render.js | 45 |
1 files changed, 22 insertions, 23 deletions
@@ -88,7 +88,7 @@ function render (msg, keys, preview) { if (msgcontents) { msgcontents.parentNode.replaceChild(editedcontents, msgcontents) } - message.appendChild(h('div', [ + message.firstChild.appendChild(h('div', [ 'edited in:', h('a', {href: '#' + nextPost.key}, [nextPost.key.substring(0, 10) + '...']) ])) @@ -123,7 +123,7 @@ function render (msg, keys, preview) { if (msg.type == 'edit') { message.appendChild(getHeader(msg, keys)) - message.appendChild(h('span', [ + message.firstChild.appendChild(h('span', [ 'edited: ', h('a', {href: '#' + msg.edited}, [msg.edited.substring(0, 10) + '...']) ])) @@ -157,35 +157,34 @@ function render (msg, keys, preview) { message.appendChild(getHeader(msg, keys)) if (msg.reply) { - message.appendChild(h('span', [ + //message.appendChild(h('span', [ + message.firstChild.appendChild(h('span', [ 're: ', h('a', {href: '#' + msg.reply}, [msg.reply.substring(0, 10) + '...']) ])) } - //quickName(msg.author).then(name => { - message.appendChild(h('div',{id: 'content:' + msg.key, innerHTML: marked(msg.text)})) - if (!preview) { + message.appendChild(h('div',{id: 'content:' + msg.key, innerHTML: marked(msg.text)})) + if (!preview) { + message.appendChild(h('button', { + onclick: function () { + quickName(msg.author).then(name => { + if (messageDiv.firstChild) { + messageDiv.insertBefore(h('div', {classList: 'submessage'}, [composer(keys, msg, name)]), messageDiv.childNodes[1]) + } else { + messageDiv.appendChild(h('div', {classList: 'submessage'}, [composer(keys, msg, name)])) + } + }) + } + }, ['Reply'])) + if (msg.author === keys.publicKey) { message.appendChild(h('button', { onclick: function () { - quickName(msg.author).then(name => { - if (messageDiv.firstChild) { - messageDiv.insertBefore(h('div', {classList: 'submessage'}, [composer(keys, msg, name)]), messageDiv.childNodes[1]) - } else { - messageDiv.appendChild(h('div', {classList: 'submessage'}, [composer(keys, msg, name)])) - } - }) + var editor = h('div', {classList: 'submessage'}, [composer(keys, msg, {name: false}, {edit: true})]) + messageDiv.appendChild(editor) } - }, ['Reply'])) - if (msg.author === keys.publicKey) { - message.appendChild(h('button', { - onclick: function () { - var editor = h('div', [composer(keys, msg, {name: false}, {edit: true})]) - message.appendChild(editor) - } - }, ['Edit'])) - } + }, ['Edit'])) } - //}) + } } else if (msg.type == 'name') { var mini = h('span', [' identified ', h('a', {href: '#' + msg.named }, [msg.named.substring(0, 10) + '...']), ' as ' + msg.name]) message.appendChild(getHeader(msg, keys, mini)) |