|
11 | 11 | <body>
|
12 | 12 | <div class="ce-example">
|
13 | 13 | <div class="ce-example__header">
|
14 |
| - <a class="ce-example__header-logo" href="https://codex.so/editor">Editor.js</a> |
15 |
| - |
| 14 | + <a class="ce-example__header-logo" href="https://www.npmjs.com/package/@calumk/editorjs-codeflask"> |
| 15 | + <svg class="svgicon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>npm</title><path d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/></svg> |
| 16 | + </a> |
| 17 | + <a class="ce-example__header-logo" href="https://github.com/calumk/editorjs-codeflask"> |
| 18 | + <svg class="svgicon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg> |
| 19 | + @calumk/editorjs-codeflask |
| 20 | + </a> |
16 | 21 | </div>
|
17 | 22 | <div class="ce-example__content _ce-example__content--small">
|
18 | 23 | <div id="editorjs"></div>
|
|
33 | 38 | </div>
|
34 | 39 | <div class="ce-example__output">
|
35 | 40 | <pre class="ce-example__output-content" id="output"></pre>
|
36 |
| - |
37 | 41 | </div>
|
38 | 42 | </div>
|
39 |
| - |
40 |
| - |
41 | 43 | </body>
|
42 | 44 |
|
43 |
| - <!-- Load Tools --> |
44 |
| - <!-- |
45 |
| - You can upload Tools to your project's directory and connect them by relative links. |
46 | 45 |
|
47 |
| - Also you can load each Tool from CDN or use NPM/Yarn packages. |
48 | 46 |
|
49 |
| - Read more at Tools Connection doc: |
50 |
| - https://editorjs.io/getting-started#tools-connection |
51 |
| - --> |
52 | 47 |
|
53 |
| - <script src="../dist/editorjs-codeflask.bundle.js"></script><!-- Codeflask --> |
| 48 | + <!-- Load Official Tools --> |
| 49 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script> |
54 | 50 |
|
55 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script><!-- Header --> |
| 51 | + <!-- |
| 52 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest"></script> |
| 53 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/delimiter@latest"></script> |
| 54 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/checklist@latest"></script> |
| 55 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/list@latest"></script> |
| 56 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/quote@latest"></script> |
| 57 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/code@latest"></script> |
| 58 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/embed@latest"></script> |
| 59 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/table@latest"></script> |
| 60 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/link@latest"></script> |
| 61 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/warning@latest"></script> |
| 62 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"></script> |
| 63 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/inline-code@latest"></script> |
| 64 | + --> |
| 65 | + |
| 66 | + |
| 67 | + <!-- Load Local Tools --> |
| 68 | + <script src="../dist/editorjs-codeflask.bundle.js"></script> |
| 69 | + <!-- |
| 70 | + --> |
56 | 71 |
|
| 72 | + |
| 73 | + <!-- Load 3rd Party Tools --> |
57 | 74 | <!--
|
58 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest"></script><!~~ Image ~~> |
59 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/delimiter@latest"></script><!~~ Delimiter ~~> |
60 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/checklist@latest"></script><!~~ Checklist ~~> |
61 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/quote@latest"></script><!~~ Quote ~~> |
62 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/code@latest"></script><!~~ Code ~~> |
63 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/embed@latest"></script><!~~ Embed ~~> |
64 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/table@latest"></script><!~~ Table ~~> |
65 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/link@latest"></script><!~~ Link ~~> |
66 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/warning@latest"></script><!~~ Warning ~~> |
67 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"></script><!~~ Marker ~~> |
68 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/inline-code@latest"></script><!~~ Inline Code ~~> |
69 |
| - --> |
| 75 | + --> |
70 | 76 |
|
71 | 77 | <!-- Load Editor.js's Core -->
|
72 |
| - <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script> |
| 78 | + <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script> |
73 | 79 |
|
74 | 80 | <!-- Initialization -->
|
75 | 81 | <script>
|
76 | 82 |
|
77 |
| - /** |
78 |
| - * To initialize the Editor, create a new instance with configuration object |
79 |
| - * @see docs/installation.md for mode details |
80 |
| - */ |
81 | 83 | editor = new EditorJS({
|
82 |
| - /** |
83 |
| - * Enable/Disable the read only mode |
84 |
| - */ |
85 | 84 | readOnly: false,
|
86 |
| - |
87 |
| - /** |
88 |
| - * Wrapper of Editor |
89 |
| - */ |
90 | 85 | holder: 'editorjs',
|
91 |
| - |
92 |
| - /** |
93 |
| - * Common Inline Toolbar settings |
94 |
| - * - if true (or not specified), the order from 'tool' property will be used |
95 |
| - * - if an array of tool names, this order will be used |
96 |
| - */ |
97 |
| - // inlineToolbar: ['link', 'marker', 'bold', 'italic'], |
98 |
| - // inlineToolbar: true, |
99 |
| - |
100 |
| - /** |
101 |
| - * Tools list |
102 |
| - */ |
103 | 86 | tools: {
|
104 |
| - /** |
105 |
| - * Each Tool is a Plugin. Pass them via 'class' option with necessary settings {@link docs/tools.md} |
106 |
| - */ |
107 |
| - header: Header, |
108 |
| - |
109 |
| - // image: SimpleImage, |
110 |
| - |
111 |
| - // list: List, |
112 |
| - |
113 |
| - // checklist: Checklist, |
114 |
| - |
115 |
| - // quote: Quote, |
116 |
| - |
117 |
| - // warning: Warning, |
118 |
| - |
119 |
| - // marker: Marker, |
120 |
| - |
121 | 87 |
|
122 |
| - |
123 |
| - // delimiter: Delimiter, |
124 |
| - |
125 |
| - // inlineCode: { |
126 |
| - // class: InlineCode, |
127 |
| - // shortcut: 'CMD+SHIFT+C' |
128 |
| - // }, |
129 |
| - |
130 |
| - // linkTool: LinkTool, |
131 |
| - |
132 |
| - // embed: Embed, |
133 |
| - |
134 |
| - // table: { |
135 |
| - // class: Table, |
136 |
| - // inlineToolbar: true, |
137 |
| - // shortcut: 'CMD+ALT+T' |
138 |
| - // }, |
139 |
| - |
140 |
| - code: { |
141 |
| - class: editorjsCodeflask |
142 |
| - }, |
| 88 | + // Load Official Tools |
| 89 | + header: Header, |
| 90 | + // image: SimpleImage, |
| 91 | + // delimiter: Delimiter, |
| 92 | + // checklist: Checklist, |
| 93 | + // list: List, |
| 94 | + // quote: Quote, |
| 95 | + // code : Code, |
| 96 | + // embed: Embed, |
| 97 | + // table: Table, |
| 98 | + // linkTool: LinkTool, |
| 99 | + // warning: Warning, |
| 100 | + // marker: Marker, |
| 101 | + // inlineCode:, |
| 102 | + |
| 103 | + // Load Local Tools |
| 104 | + code: editorjsCodeflask, |
| 105 | + |
| 106 | + // Load 3rd Party Tools |
| 107 | + // n/a |
143 | 108 |
|
144 | 109 | },
|
145 |
| - |
146 |
| - /** |
147 |
| - * This Tool will be used as default |
148 |
| - */ |
149 |
| - // defaultBlock: 'paragraph', |
150 |
| - |
151 |
| - /** |
152 |
| - * Initial Editor data |
153 |
| - */ |
154 | 110 | data: {
|
155 | 111 | "blocks":[
|
156 | 112 | {
|
157 | 113 | "type":"header",
|
158 | 114 | "data":{
|
159 |
| - "text":"Example", |
160 |
| - "level":2 |
| 115 | + "text":"Example : @calumk/editorjs-codeflask ", |
| 116 | + "level":3 |
161 | 117 | }
|
162 | 118 | },
|
163 | 119 | {
|
164 | 120 | "type":"paragraph",
|
165 | 121 | "data":{
|
166 |
| - "text":"This is an example of EditorJs" |
| 122 | + "text":"This is an example of using EditorJs, with the @calumk/editorjs-codeflask package" |
167 | 123 | }
|
168 | 124 | },
|
169 | 125 | {
|
|
195 | 151 | saveButton.click();
|
196 | 152 | },
|
197 | 153 | onChange: function() {
|
198 |
| - console.log('something changed'); |
| 154 | + // console.log('something changed'); |
199 | 155 | }
|
200 | 156 | });
|
201 | 157 |
|
202 |
| - /** |
203 |
| - * Saving button |
204 |
| - */ |
205 |
| - const saveButton = document.getElementById('saveButton'); |
206 | 158 |
|
207 |
| - /** |
208 |
| - * Toggle read-only button |
209 |
| - */ |
| 159 | + // Buttons |
| 160 | + const saveButton = document.getElementById('saveButton'); |
210 | 161 | const toggleReadOnlyButton = document.getElementById('toggleReadOnlyButton');
|
211 | 162 | const readOnlyIndicator = document.getElementById('readonly-state');
|
212 | 163 |
|
213 |
| - /** |
214 |
| - * Saving example |
215 |
| - */ |
| 164 | + |
| 165 | + // Save Example |
216 | 166 | saveButton.addEventListener('click', function () {
|
217 | 167 | editor.save()
|
218 | 168 | .then((savedData) => {
|
|
223 | 173 | });
|
224 | 174 | });
|
225 | 175 |
|
226 |
| - /** |
227 |
| - * Toggle read-only example |
228 |
| - */ |
| 176 | + // Toggle Readonly mode |
229 | 177 | toggleReadOnlyButton.addEventListener('click', async () => {
|
230 | 178 | const readOnlyState = await editor.readOnly.toggle();
|
231 | 179 |
|
232 | 180 | readOnlyIndicator.textContent = readOnlyState ? 'On' : 'Off';
|
233 | 181 | });
|
234 | 182 |
|
235 |
| - |
236 | 183 | </script>
|
237 | 184 |
|
238 | 185 |
|
239 |
| - |
240 |
| - |
241 |
| - |
242 | 186 | </html>
|
0 commit comments