This repository has been archived by the owner on Jun 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 142
/
app.js
51 lines (45 loc) · 1.45 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
var mercury = require('../../index');
var h = mercury.h;
var inlineMdEditor = require('./component/inlineMdEditor');
var sideBySideMdEditor = require('./component/sideBySideMdEditor');
app.render = appRender;
module.exports = app;
function app() {
var state = mercury.struct({
inlineEditor: inlineMdEditor({
placeholder: 'Enter some markdown...'
}),
sideBySideEditor: sideBySideMdEditor({
placeholder: 'Enter some markdown...',
value: [
'#Hello World',
'',
'* sample',
'* bullet',
'* points'
].join('\n')
})
});
return state;
}
function appRender(state) {
return h('.page', {
style: { visibility: 'hidden' }
}, [
h('link', {
rel: 'stylesheet',
href: '/mercury/examples/markdown/style.css'
}),
h('.content', [
h('h2', 'Side-by-side Markdown Editor'),
h('p', 'Enter some markdown in the left pane and see it rendered ' +
'in the pane on the right.'),
sideBySideMdEditor.render(state.sideBySideEditor),
h('h2', 'Inline Markdown Editor'),
h('p', 'Enter some markdown and click outside of the textarea to ' +
'see the parsed result. Click the output to edit again.'),
inlineMdEditor.render(state.inlineEditor)
])
]);
}