1 |
|
2 |
|
3 |
|
4 | import { createHyperscript } from 'slate-hyperscript';
|
5 |
|
6 | const h = createHyperscript({
|
7 | blocks: {
|
8 | heading: 'heading',
|
9 | paragraph: 'paragraph',
|
10 | code_block: 'code_block',
|
11 | code_line: 'code_line'
|
12 | }
|
13 | });
|
14 |
|
15 | const value = (
|
16 | <value>
|
17 | <document>
|
18 | <heading>Slate + Code Editing</heading>
|
19 | <paragraph>
|
20 | {
|
21 | 'This page is a basic example of Slate + slate-edit-code plugin. Press Tab to indent code. Shift+Tab to unindent. Press Enter to carry indentation onto the newline. Press Mod (Cmd on Mac, Ctrl on Windows) + Enter to exit the code block.'
|
22 | }
|
23 | </paragraph>
|
24 | <code_block>
|
25 | <code_line>{'// Some JavaScript'}</code_line>
|
26 | <code_line>{'function hello() {'}</code_line>
|
27 | <code_line>{" console.log('Hello World')"}</code_line>
|
28 | <code_line>{'}'}</code_line>
|
29 | </code_block>
|
30 | <paragraph>End paragraph</paragraph>
|
31 | </document>
|
32 | </value>
|
33 | );
|
34 |
|
35 | export default value;
|