|
1 | 1 | <html> |
| 2 | + |
2 | 3 | <head> |
3 | | -<link href="https://fonts.googleapis.com/css?family=PT+Mono" rel="stylesheet"> |
4 | | -<link href="assets/demo.css" rel="stylesheet"> |
5 | | -<script src="dist/bundle.js" type="module"></script> |
| 4 | + <link href="https://fonts.googleapis.com/css?family=PT+Mono" rel="stylesheet"> |
| 5 | + <link href="assets/demo.css" rel="stylesheet"> |
| 6 | + <script src="dist/bundle.js" type="module"></script> |
| 7 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script><!-- Header --> |
| 8 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest"></script><!-- Image --> |
| 9 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/delimiter@latest"></script><!-- Delimiter --> |
| 10 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/list@latest"></script><!-- List --> |
| 11 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/checklist@latest"></script><!-- Checklist --> |
| 12 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/quote@latest"></script><!-- Quote --> |
| 13 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/code@latest"></script><!-- Code --> |
| 14 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/embed@latest"></script><!-- Embed --> |
| 15 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/table@latest"></script><!-- Table --> |
| 16 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/link@latest"></script><!-- Link --> |
| 17 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/warning@latest"></script><!-- Warning --> |
6 | 18 |
|
7 | | -<meta charset="utf-8" /> |
8 | | -</head> |
| 19 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"></script><!-- Marker --> |
| 20 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/inline-code@latest"></script><!-- Inline Code --> |
| 21 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script> |
| 22 | + <script src="dist/bundle.js"></script> |
| 23 | + <style> |
| 24 | + #title { |
| 25 | + font-family: "Helvetica", sans-serif; |
| 26 | + color: #1e1e1e; |
| 27 | + text-align: center; |
| 28 | + } |
| 29 | + |
| 30 | + #output-wrapper { |
| 31 | + display: flex; |
| 32 | + flex-direction: column; |
| 33 | + justify-content: center; |
| 34 | + align-items: center; |
| 35 | + } |
9 | 36 |
|
10 | | -<div class="ce-example__output"> |
11 | | - <pre class="ce-example__output-content" id="output"></pre> |
12 | | -</div> |
| 37 | + #save-button { |
| 38 | + width: 80px; |
| 39 | + margin: 20px; |
| 40 | + } |
| 41 | + </style> |
13 | 42 |
|
14 | | -<div class="ce-example__content _ce-example__content--small"> |
15 | | - <div id="editorjs"> |
| 43 | + <meta charset="utf-8" /> |
| 44 | +</head> |
| 45 | + |
| 46 | +<body> |
| 47 | + <h2 id="title">Editor.js - Github Gist Plugin</h2> |
| 48 | + <div id="editorjs"></div> |
| 49 | + <div id="output-wrapper"> |
| 50 | + <button id="save-button" class="cdx-button">Save</button> |
| 51 | + <pre id="output"></pre> |
16 | 52 | </div> |
17 | | -</div> |
18 | | -<div class="ce-example__button" id="saveButton"> |
19 | | - editor.save() |
20 | | -</div> |
| 53 | + |
| 54 | + <script> |
| 55 | + const editor = new EditorJS({ |
| 56 | + autofocus: true, |
| 57 | + |
| 58 | + tools: { |
| 59 | + header: { |
| 60 | + class: Header, |
| 61 | + inlineToolbar: ['marker', 'link'], |
| 62 | + config: { |
| 63 | + placeholder: 'Header' |
| 64 | + }, |
| 65 | + shortcut: 'CMD+SHIFT+H' |
| 66 | + }, |
| 67 | + image: SimpleImage, |
| 68 | + |
| 69 | + list: { |
| 70 | + class: List, |
| 71 | + inlineToolbar: true, |
| 72 | + shortcut: 'CMD+SHIFT+L' |
| 73 | + }, |
| 74 | + |
| 75 | + checklist: { |
| 76 | + class: Checklist, |
| 77 | + inlineToolbar: true, |
| 78 | + }, |
| 79 | + |
| 80 | + quote: { |
| 81 | + class: Quote, |
| 82 | + inlineToolbar: true, |
| 83 | + config: { |
| 84 | + quotePlaceholder: 'Enter a quote', |
| 85 | + captionPlaceholder: 'Quote\'s author', |
| 86 | + }, |
| 87 | + shortcut: 'CMD+SHIFT+O' |
| 88 | + }, |
| 89 | + |
| 90 | + warning: Warning, |
| 91 | + |
| 92 | + marker: { |
| 93 | + class: Marker, |
| 94 | + shortcut: 'CMD+SHIFT+M' |
| 95 | + }, |
| 96 | + |
| 97 | + code: { |
| 98 | + class: CodeTool, |
| 99 | + shortcut: 'CMD+SHIFT+C' |
| 100 | + }, |
| 101 | + |
| 102 | + delimiter: Delimiter, |
| 103 | + |
| 104 | + inlineCode: { |
| 105 | + class: InlineCode, |
| 106 | + shortcut: 'CMD+SHIFT+C' |
| 107 | + }, |
| 108 | + |
| 109 | + linkTool: LinkTool, |
| 110 | + |
| 111 | + embed: Embed, |
| 112 | + |
| 113 | + parser: MarkdownParser, |
| 114 | + importer: MarkdownImporter, |
| 115 | + |
| 116 | + table: { |
| 117 | + class: Table, |
| 118 | + inlineToolbar: true, |
| 119 | + shortcut: 'CMD+ALT+T' |
| 120 | + }, |
| 121 | + |
| 122 | + |
| 123 | + }, |
| 124 | + }); |
| 125 | + |
| 126 | + const saveButton = document.getElementById('save-button'); |
| 127 | + const output = document.getElementById('output'); |
| 128 | + |
| 129 | + saveButton.addEventListener('click', () => { |
| 130 | + editor.save().then(savedData => { |
| 131 | + output.innerHTML = JSON.stringify(savedData, null, 4); |
| 132 | + }) |
| 133 | + }) |
| 134 | + </script> |
| 135 | +</body> |
| 136 | + |
21 | 137 | </html> |
0 commit comments