compose.jsView |
---|
105 | 105 | textarea.value += embed + '['+file.name+']('+file.link+')' |
106 | 106 | }), |
107 | 107 | h('button.btn', 'Cancel', { |
108 | 108 | onclick: function () { |
109 | | - var message = document.getElementById(opts.branch.substring(0,10)) |
110 | | - if (opts.updated) |
111 | | - message.parentNode.removeChild(message) |
112 | | - else |
113 | | - message.parentNode.removeChild(message) |
| 109 | + var cancel |
| 110 | + if (opts.updated) { |
| 111 | + cancel = document.getElementById(opts.updated.substring(0,10)) |
| 112 | + var oldMessage = h('div.message__body', tools.markdown(opts.messageText)) |
| 113 | + cancel.parentNode.replaceChild(oldMessage, cancel) |
| 114 | + console.log(opts.buttons) |
| 115 | + oldMessage.parentNode.appendChild(opts.buttons) |
| 116 | + } else { |
| 117 | + cancel = document.getElementById(opts.branch.substring(0,10)) |
| 118 | + cancel.parentNode.removeChild(cancel) |
| 119 | + } |
114 | 120 | } |
| 121 | + |
115 | 122 | }) |
116 | 123 | ) |
117 | 124 | |
118 | 125 | composer.appendChild(container) |