aboutsummaryrefslogtreecommitdiff
path: root/render.js
diff options
context:
space:
mode:
authorEv Bogue <ev@evbogue.com>2019-12-15 08:40:05 -0600
committerEv Bogue <ev@evbogue.com>2019-12-15 08:40:05 -0600
commit0ce80cde9303db97124ada1a5745aed554041859 (patch)
treecbf99255c2654217ee5107c7176290cb34738924 /render.js
parent55989c498fd62a47b47cb033a764fd4dd23ed5a6 (diff)
fix some glitches with the edit function
Diffstat (limited to 'render.js')
-rw-r--r--render.js45
1 files changed, 22 insertions, 23 deletions
diff --git a/render.js b/render.js
index 27b8fb4..ca42e09 100644
--- a/render.js
+++ b/render.js
@@ -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))