-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
322 lines (302 loc) · 13.3 KB
/
index.html
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>GHEditor Demo</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
<link rel="stylesheet" href="src/scss/code.css">
</head>
<body>
<div class="page-header">
<h1 class="project-name">GHEditor Markdown</h1>
<h2 class="project-tagline">GHEditor is a simple, embeddable, and beautiful JS markdown editor</h2>
<div>
<a href="https://github.com/adaorachi/ghEditor" class="button">View on GitHub</a>
<a href="https://www.npmjs.com/package/gheditor" class="button">Install from NPM</a>
<a href="https://github.com/adaorachi/ghEditor/archive/v1.7.zip" class="button">Download File</a>
</div>
</div>
<div class="main-content container">
<div class="form-group">
<h2 class="demo-title">Full Toolbar and Split-Screen</h2>
<p>This displays a full feature of the header toolbar icons, inline toolbar icons, <a
href="https://github.com/adaorachi/ghEditor">keyboard shortcuts</a> for icons used for editing contents in the
editor. It also shows the split-screen features and the indented tab features. </p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor1">
</textarea>
</div>
<div class="editable-container">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor1">Copy Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor1"></textarea>
<pre><code id="code-snippet-gheditor1">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
headerToolbar: {
icons: 'heading|bold|italic|blockquote|strikethrough|horizontal-rule|code|link|code-block|unordered-list|ordered-list|tasklist|mention|image|table|'
},
inlineToolbar: 'heading|bold|italic|code|link|unordered-list',
inlineShortcut: true,
indentWithTab: true,
splitScreen: {
enabled: true,
},
toolbarEmoji: true,
});</code></pre>
</div>
</div>
</div>
</div>
<div class="form-group">
<h2 class="demo-title">Include Emojis</h2>
<p>This lets you include cool emojis to your content. Start by inputting the emoji-prefix symbol - <b>":"</b>,
followed by the emoji name you want. E.g - <b>:smile</b> The emoji dropdown is filtered according to your
inputted value. By default, the symbol is the <b>":"</b>, but this can be changes in the <b>emojiPrefix</b>
option. You can find the list of available emojis <a
href="https://adaorachi.github.io/gheditor_emojis/emoji.json">here</a></p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor2">
</textarea>
</div>
<div class="editable-container">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor2">Copy Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor2"></textarea>
<pre><code id="code-snippet-gheditor2">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
inlineEmoji: {
enabled: true,
}
});</code></pre>
</div>
</div>
</div>
</div>
<div class="form-group">
<h2 class="demo-title">Upload Images</h2>
<p>This defines the upload image feature. This is configured to use the <a
href="https://firebase.google.com/">google firebase</a> storage bucket.</p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor3">
</textarea>
</div>
<div class="editable-container">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor3">Copy Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor3"></textarea>
<pre><code id="code-snippet-gheditor3">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
uploadImage: {
enabled: true,
config: { storageBucket: 'your-firebase-app-name.appspot.com' },
}
});</code></pre>
</div>
</div>
</div>
</div>
<div class="form-group">
<h2 class="demo-title">Autosaving</h2>
<p>This automatically saves the textarea content that is being written when the textarea is on <b>focus</b> and
will load it back in the future or when the page is refreshed. It saves at the time interval that is defined
in the <b>delay</b> attribute. The content can also be saved manually by clicking on the save icon. </p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor4">
</textarea>
</div>
<div class="editable-container">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor4">Copy Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor4"></textarea>
<pre><code id="code-snippet-gheditor4">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
autoSave: {
enabled: true,
delay: 5000,
}
});</code></pre>
</div>
</div>
</div>
</div>
<div class="form-group">
<h2 class="demo-title">Auto Use of FontAwesome</h2>
<p> This automatically includes <a href="https://fontawesome.com/">Font Awesome</a> and can be added in the
textarea input just like you would in an HTML markup </p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor5">
</textarea>
</div>
<div class="editable-container">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor5">Copy Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor5"></textarea>
<pre><code id="code-snippet-gheditor5">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
autoUseFontAwesome: true
});</code></pre>
</div>
</div>
</div>
</div>
<div class="form-group">
<h2 class="demo-title">Highlight Code</h2>
<p>This highlights codes in particular with language.</p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor6">
</textarea>
</div>
<div class="editable-container">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor6">Copy Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor6"></textarea>
<pre><code id="code-snippet-gheditor6">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
highlightCode: true
});</code></pre>
</div>
</div>
</div>
</div>
<div class="form-group">
<h2 class="demo-title">Use HTML Attributes with special characters</h2>
<p>You can also perform some cool features like defining inline CSS classes, and elements IDs and attributes with
the use of curly braces - `{}`. In order to use this, Classes are defined with a period like so - `.class-1`.
Ids are defined with an hash symbol - `#id-1`. Other attributes are defined just like you would for any HTML
tag, like so - `aria-label="true"`. You can also define emphasized text like a note, create comment or higlight
an image. </p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor7">
</textarea>
</div>
<div class="editable-container">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor7">Copy Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor7"></textarea>
<pre><code id="code-snippet-gheditor7">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
inlineAttributes: true,
});</code></pre>
</div>
</div>
</div>
</div>
<form id="form">
<div class="form-group">
<h2 class="demo-title">Output HTML Markup</h2>
<p>This syncs the text content of the editor to the default textarea and returns the content. Note that this
method should be called when an action takes place; like an event listener in order to get the full content.
See the editor content below.<br>Click the submit button to see HTML result.</p>
<div class="code-container">
<div>
<textarea class="form-control ghEditor" id="gheditor8">
</textarea>
<button type="submit" class="mt-4 btn btn-primary btn-sm run-html">Submit</button>
</div>
<div class="row flex-column">
<div class="col-12">
<div class="editable editable-container m-0 mt-4">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Output</h6>
</div>
<div class="editable editable-output"></div>
</div>
</div>
<div class="col-12">
<div class="editable-container m-0 mt-4">
<div class="editable">
<div class="code-header d-flex justify-content-between align-items-center">
<h6 class="mb-0 font-weight-bold">Code</h6>
<div class="editor-buttons">
<button type="button" class="btn btn-primary btn-sm run" id="run-code-gheditor8">Copy
Code</button>
</div>
</div>
<div class="editable">
<textarea class="textarea" id="copyTextarea-gheditor8"></textarea>
<pre><code id="code-snippet-gheditor8">const gheditor1 = ghEditor();
gheditor1.markDown({
container: 'textarea-1', // id of textarea
});
const form = document.getElementById('form');
form.addEventListener('submit', () => {
const output = gheditor1.syncValue();
console.log(output);
});</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="guide">
<a href="https://github.com/adaorachi/ghEditor/wiki/markdown_cheat_sheet" class="view-guide">View Guide</a>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<!-- <script src="https://cdn.jsdelivr.net/gh/adaorachi/[email protected]/@gheditor/dist/main.js"></script> -->
<script src="./dist/main.js"></script>
</body>
</html>