-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathindex.js
339 lines (330 loc) · 9.28 KB
/
index.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
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
/**
* CKEditor 5 requires a license key.
*
* The "GPL" license key used below only allows you to use the open-source features.
* To use the premium features, replace it with your commercial license key.
* If you don't have one, you can get a trial license key from https://portal.ckeditor.com/checkout?plan=free.
*/
const LICENSE_KEY = 'GPL';
if ( LICENSE_KEY === 'GPL' ) {
alert( 'Premium features are disabled, because they require a commercial license key. Check the index.js file for more information.' );
}
import {
ClassicEditor,
Autoformat,
Bold,
Code,
Italic,
Strikethrough,
Subscript,
Superscript,
Underline,
BlockQuote,
Base64UploadAdapter,
CloudServices,
Essentials,
FontBackgroundColor,
FontColor,
FontFamily,
FontSize,
Heading,
HorizontalLine,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Mention,
PictureEditing,
Indent,
Link,
List,
SpecialCharacters,
SpecialCharactersEssentials,
TodoList,
Paragraph,
PasteFromOffice,
RemoveFormat,
Table,
TableToolbar,
TextTransformation
} from 'ckeditor5';
import {
SlashCommand
} from 'ckeditor5-premium-features';
import 'ckeditor5/ckeditor5.css';
import 'ckeditor5-premium-features/ckeditor5-premium-features.css';
const EMOJIS_ARRAY = [
{ character: '🙈', title: 'See-No-Evil Monkey' },
{ character: '🙄', title: 'Face With Rolling Eyes' },
{ character: '🙃', title: 'Upside Down Face' },
{ character: '🙂', title: 'Slightly Smiling Face' },
{ character: '😴', title: 'Sleeping Face' },
{ character: '😳', title: 'Flushed Face' },
{ character: '😱', title: 'Face Screaming in Fear' },
{ character: '😭', title: 'Loudly Crying Face' },
{ character: '😬', title: 'Grimacing Face' },
{ character: '😩', title: 'Weary Face' },
{ character: '😢', title: 'Crying Face' },
{ character: '😡', title: 'Pouting Face' },
{ character: '😞', title: 'Disappointed Face' },
{ character: '😜', title: 'Face with Stuck-Out Tongue and Winking Eye' },
{ character: '😚', title: 'Kissing Face With Closed Eyes' },
{ character: '😘', title: 'Face Throwing a Kiss' },
{ character: '😔', title: 'Pensive Face' },
{ character: '😒', title: 'Unamused Face' },
{ character: '😑', title: 'Expressionless Face' },
{ character: '😐', title: 'Neutral Face' },
{ character: '😏', title: 'Smirking Face' },
{ character: '😎', title: 'Smiling Face with Sunglasses' },
{ character: '😍', title: 'Smiling Face with Heart-Eyes' },
{ character: '😌', title: 'Relieved Face' },
{ character: '😋', title: 'Face Savoring Delicious Food' },
{ character: '😊', title: 'Smiling Face with Smiling Eyes' },
{ character: '😉', title: 'Winking Face' },
{ character: '😈', title: 'Smiling Face With Horns' },
{ character: '😇', title: 'Smiling Face with Halo' },
{
character: '😆',
title: 'Smiling Face with Open Mouth and Tightly-Closed Eyes'
},
{ character: '😅', title: 'Smiling Face with Open Mouth and Cold Sweat' },
{ character: '😄', title: 'Smiling Face with Open Mouth and Smiling Eyes' },
{ character: '😃', title: 'Smiling Face with Open Mouth' },
{ character: '😂', title: 'Face with Tears of Joy' },
{ character: '😁', title: 'Grinning Face with Smiling Eyes' },
{ character: '😀', title: 'Grinning Face' },
{ character: '🥺', title: 'Pleading Face' },
{ character: '🥵', title: 'Hot Face' },
{ character: '🥴', title: 'Woozy Face' },
{ character: '🥳', title: 'Partying Face' },
{ character: '🥰', title: 'Smiling Face with Hearts' },
{ character: '🤭', title: 'Face with Hand Over Mouth' },
{ character: '🤪', title: 'Zany Face' },
{ character: '🤩', title: 'Grinning Face with Star Eyes' },
{ character: '🤦', title: 'Face Palm' },
{ character: '🤤', title: 'Drooling Face' },
{ character: '🤣', title: 'Rolling on the Floor Laughing' },
{ character: '🤔', title: 'Thinking Face' },
{ character: '🤞', title: 'Crossed Fingers' },
{ character: '🙏', title: 'Person with Folded Hands' },
{ character: '🙌', title: 'Person Raising Both Hands in Celebration' },
{ character: '🙋', title: 'Happy Person Raising One Hand' },
{ character: '🤷', title: 'Shrug' },
{ character: '🤗', title: 'Hugging Face' },
{ character: '🖤', title: 'Black Heart' },
{ character: '🔥', title: 'Fire' },
{ character: '💰', title: 'Money Bag' },
{ character: '💯', title: 'Hundred Points Symbol' },
{ character: '💪', title: 'Flexed Biceps' },
{ character: '💩', title: 'Pile of Poo' },
{ character: '💥', title: 'Collision' },
{ character: '💞', title: 'Revolving Hearts' },
{ character: '💜', title: 'Purple Heart' },
{ character: '💚', title: 'Green Heart' },
{ character: '💙', title: 'Blue Heart' },
{ character: '💗', title: 'Growing Heart' },
{ character: '💖', title: 'Sparkling Heart' },
{ character: '💕', title: 'Two Hearts' },
{ character: '💔', title: 'Broken Heart' },
{ character: '💓', title: 'Beating Heart' },
{ character: '💐', title: 'Bouquet' },
{ character: '💋', title: 'Kiss Mark' },
{ character: '💀', title: 'Skull' },
{ character: '👑', title: 'Crown' },
{ character: '👏', title: 'Clapping Hands Sign' },
{ character: '👍', title: 'Thumbs Up Sign' },
{ character: '👌', title: 'OK Hand Sign' },
{ character: '👉', title: 'Backhand Index Pointing Right' },
{ character: '👈', title: 'Backhand Index Pointing Left' },
{ character: '👇', title: 'Backhand Index Pointing Down' },
{ character: '👀', title: 'Eyes' },
{ character: '🎶', title: 'Multiple Musical Notes' },
{ character: '🎊', title: 'Confetti Ball' },
{ character: '🎉', title: 'Party Popper' },
{ character: '🎈', title: 'Balloon' },
{ character: '🎂', title: 'Birthday Cake' },
{ character: '🎁', title: 'Wrapped Gift' },
{ character: '🌹', title: 'Rose' },
{ character: '🌸', title: 'Cherry Blossom' },
{ character: '🌞', title: 'Sun with Face' },
{ character: '❤️', title: 'Red Heart' },
{ character: '❣️', title: 'Heavy Heart Exclamation Mark Ornament' },
{ character: '✨', title: 'Sparkles' },
{ character: '✌️', title: 'Victory Hand' },
{ character: '✅', title: 'Check Mark Button' },
{ character: '♥️', title: 'Heart Suit' },
{ character: '☺️', title: 'Smiling Face' },
{ character: '☹️', title: 'Frowning Face' },
{ character: '☀️', title: 'Sun' }
];
/**
* Populate the special characters plugin with emojis.
*/
function SpecialCharactersEmoji( editor ) {
if ( !editor.plugins.get( 'SpecialCharacters' ) ) {
return;
}
// Make sure Emojis are last on the list.
this.afterInit = function() {
editor.plugins.get( 'SpecialCharacters' ).addItems( 'Emoji', EMOJIS_ARRAY );
};
}
ClassicEditor.create(
document.querySelector( '#cke5-user-interface-button-grouping-demo' ),
{
plugins: [
Autoformat,
BlockQuote,
Bold,
CloudServices,
Code,
Essentials,
FontBackgroundColor,
FontColor,
FontFamily,
FontSize,
Heading,
HorizontalLine,
Image,
ImageUpload,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Base64UploadAdapter,
Indent,
Italic,
Link,
List,
Mention,
Paragraph,
PasteFromOffice,
PictureEditing,
RemoveFormat,
SpecialCharacters,
SpecialCharactersEmoji,
SpecialCharactersEssentials,
Strikethrough,
Subscript,
Superscript,
Table,
TableToolbar,
TextTransformation,
TodoList,
Underline,
// Include premium features only if the license key is not GPL.
...( LICENSE_KEY !== 'GPL' ? [
SlashCommand
] : [] )
],
licenseKey: LICENSE_KEY,
toolbar: [
'undo',
'redo',
'|',
'heading',
'|',
'bold',
'italic',
'underline',
{
label: 'Basic styles',
icon: 'text',
items: [
'fontSize',
'fontFamily',
'fontColor',
'fontBackgroundColor',
'strikethrough',
'superscript',
'subscript',
'code'
]
},
'removeFormat',
'|',
'link',
'insertTable',
{
label: 'Insert',
icon: 'plus',
items: [
'uploadImage',
'blockQuote',
'specialCharacters',
'horizontalLine'
]
},
'|',
{
label: 'Lists',
icon: false,
items: [ 'bulletedList', 'numberedList', 'todoList' ]
}
],
fontFamily: {
supportAllValues: true
},
fontSize: {
options: [ 10, 12, 14, 'default', 18, 20, 22 ],
supportAllValues: true
},
heading: {
options: [
{
model: 'paragraph',
title: 'Paragraph',
class: 'ck-heading_paragraph'
},
{
model: 'heading1',
view: 'h1',
title: 'Heading 1',
class: 'ck-heading_heading1'
},
{
model: 'heading2',
view: 'h2',
title: 'Heading 2',
class: 'ck-heading_heading2'
},
{
model: 'heading3',
view: 'h3',
title: 'Heading 3',
class: 'ck-heading_heading3'
},
{
model: 'heading4',
view: 'h4',
title: 'Heading 4',
class: 'ck-heading_heading4'
}
]
},
image: {
toolbar: [
'imageTextAlternative',
'toggleImageCaption',
'|',
'imageStyle:inline',
'imageStyle:wrapText',
'imageStyle:breakText'
]
},
link: {
addTargetToExternalLinks: true,
defaultProtocol: 'https://'
},
table: {
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
}
}
)
.then( editor => {
window.editor = editor;
} )
.catch( error => {
console.error( error.stack );
} );