var lightbox = require('hyperlightbox') var h = require('hyperscript') var u = require('../util') //publish or add var plugs = require('../plugs') var publish = plugs.first(exports.publish = []) var message_content = plugs.first(exports.message_content = []) exports.message_confirm = function (content, sbot) { var lb = lightbox() document.body.appendChild(lb) var okay = h('button', 'okay', {onclick: function () { publish(content); lb.remove() }}) var cancel = h('button', 'cancel', {onclick: function () { lb.remove() }}) okay.addEventListener('keydown', function (ev) { if(ev.keyCode === 27) cancel.click() //escape }) lb.show(h('div.column', message_content({key: "DRAFT", value: {content: content}}) || h('pre', JSON.stringify(content, null, 2)), h('div.row', okay, cancel) )) okay.focus() }