git ssb

1+

punkmonk.termux / mvd



forked from ev / mvd

Commit 86661677a7623472280bc05e563bb733054a0f01

edits should cancel correctly

Ev Bogue committed on 5/26/2018, 1:13:21 AM
Parent: c0fd0e300786fa560756710190772845cd949008

Files changed

compose.jschanged
compose.jsView
@@ -40,38 +40,36 @@
4040 module.exports = function (opts, buttons) {
4141 var files = []
4242 var filesById = {}
4343
44+ console.log(opts)
45+
4446 var composer = h('div.composer')
4547 var container = h('div.container')
4648
4749 if (opts.messageText)
4850 var textarea = h('textarea.compose', opts.messageText)
4951 else
5052 var textarea = h('textarea.compose', {placeholder: opts.placeholder || 'Write a message'})
5153
52- if (window.location.hash.substring(1) != 'compose')
53- var cancelBtn = h('button.btn', 'Cancel', {
54- onclick: function () {
55- var cancel
56- if (opts.type == 'updated') {
57- cancel = document.getElementById(opts.updated.substring(0,10))
58- var oldMessage = h('div.message__body', tools.markdown(opts.messageText))
59- cancel.parentNode.replaceChild(oldMessage, cancel)
60- oldMessage.parentNode.appendChild(buttons)
61- } else {
62- if (document.getElementById(opts.branch.substring(0,10)))
63- cancel = document.getElementById(opts.branch.substring(0,10))
64- else
65- cancel = document.getElementById('composer')
66- cancel.parentNode.removeChild(cancel)
67- }
54+ var cancelBtn = h('button.btn', 'Cancel', {
55+ onclick: function () {
56+ var cancel
57+ if (opts.updated) {
58+ cancel = document.getElementById(opts.updated.substring(0,10))
59+ var oldMessage = h('div.message__body', tools.markdown(opts.messageText))
60+ cancel.parentNode.replaceChild(oldMessage, cancel)
61+ oldMessage.parentNode.appendChild(buttons)
62+ } else if (opts.branch) {
63+ cancel = document.getElementById(opts.branch.substring(0,10))
64+ cancel.parentNode.removeChild(cancel)
65+ } else {
66+ cancel = document.getElementById('composer')
67+ cancel.parentNode.removeChild(cancel)
6868 }
69+ }
6970
70- })
71-
72- else
73- var cancel = h('span', '')
71+ })
7472
7573 var initialButtons = h('span',
7674 h('button.btn', 'Preview', {
7775 onclick: function () {

Built with git-ssb-web