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
|
import BalloonEditorBase from '@ckeditor/ckeditor5-editor-balloon/src/ballooneditor';
import { builtinPlugins } from './builtin-plugins.js';
import { defaultConfig } from './default-config.js';
export default class BalloonEditor extends BalloonEditorBase {}
export { createBalloonEditorFromTextarea };
BalloonEditor.builtinPlugins = builtinPlugins;
BalloonEditor.defaultConfig = {
...defaultConfig,
balloonToolbar: {
items: [
'bold',
'italic',
'underline',
'subscript',
'superscript',
'|',
'removeFormat',
'|',
'fontColor',
'fontBackgroundColor',
'|',
'link',
'math',
'specialCharacters',
],
shouldNotGroupWhenFull: true,
},
blockToolbar: [
'paragraph',
'heading1',
'heading2',
'|',
'bulletedList',
'numberedList',
'|',
'alignment:left',
'alignment:right',
'alignment:center',
'alignment:justify',
],
};
function createBalloonEditorFromTextarea(textarea) {
const replacement = document.createElement('div');
replacement.classList.add('wysiwyg-balloon');
replacement.innerHTML = textarea.value;
textarea.parentNode.insertBefore(replacement, textarea.nextSibling);
textarea.style.display = 'none';
return BalloonEditor.create(replacement);
}
|