git ssb

16+

Dominic / patchbay



Tree: eedc2fe6825e871a92ed902f67846829bc6e7509

Files: eedc2fe6825e871a92ed902f67846829bc6e7509 / modules / message-confirm.js

874 bytesRaw
1var lightbox = require('hyperlightbox')
2var h = require('hyperscript')
3var u = require('../util')
4//publish or add
5
6var plugs = require('../plugs')
7
8var publish = plugs.first(exports.publish = [])
9var message_content = plugs.first(exports.message_content = [])
10
11exports.message_confirm = function (content, sbot) {
12
13 var lb = lightbox()
14 document.body.appendChild(lb)
15
16 var okay = h('button', 'okay', {onclick: function () {
17 publish(content); lb.remove()
18 }})
19
20 var cancel = h('button', 'cancel', {onclick: function () {
21 lb.remove()
22 }})
23
24 okay.addEventListener('keydown', function (ev) {
25 if(ev.keyCode === 27) cancel.click() //escape
26 })
27
28 lb.show(h('div.column',
29 message_content({key: "DRAFT", value: {content: content}})
30 || h('pre', JSON.stringify(content, null, 2)),
31 h('div.row', okay, cancel)
32 ))
33
34 okay.focus()
35
36}
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

Built with git-ssb-web