]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/ui/toolbars.ts
Lexical: Added clear formatting button
[bookstack] / resources / js / wysiwyg / ui / toolbars.ts
1 import {EditorButton, FormatPreviewButton} from "./framework/buttons";
2 import {
3     blockquote, bold, clearFormating, code,
4     dangerCallout, details,
5     h2, h3, h4, h5, image,
6     infoCallout, italic, link, paragraph,
7     redo, source, strikethrough, subscript,
8     successCallout, superscript, underline,
9     undo,
10     warningCallout
11 } from "./defaults/button-definitions";
12 import {EditorContainerUiElement, EditorFormatMenu, EditorSimpleClassContainer} from "./framework/containers";
13 import {el} from "../helpers";
14
15
16 export function getMainEditorFullToolbar(): EditorContainerUiElement {
17     return new EditorSimpleClassContainer('editor-toolbar-main', [
18         // History state
19         new EditorButton(undo),
20         new EditorButton(redo),
21
22         // Block formats
23         new EditorFormatMenu([
24             new FormatPreviewButton(el('h2'), h2),
25             new FormatPreviewButton(el('h3'), h3),
26             new FormatPreviewButton(el('h4'), h4),
27             new FormatPreviewButton(el('h5'), h5),
28             new FormatPreviewButton(el('blockquote'), blockquote),
29             new FormatPreviewButton(el('p'), paragraph),
30             new FormatPreviewButton(el('p', {class: 'callout info'}), infoCallout),
31             new FormatPreviewButton(el('p', {class: 'callout success'}), successCallout),
32             new FormatPreviewButton(el('p', {class: 'callout warning'}), warningCallout),
33             new FormatPreviewButton(el('p', {class: 'callout danger'}), dangerCallout),
34         ]),
35
36         // Inline formats
37         new EditorButton(bold),
38         new EditorButton(italic),
39         new EditorButton(underline),
40         new EditorButton(strikethrough),
41         new EditorButton(superscript),
42         new EditorButton(subscript),
43         new EditorButton(code),
44         new EditorButton(clearFormating),
45
46         // Insert types
47         new EditorButton(link),
48         new EditorButton(image),
49         new EditorButton(details),
50
51         // Meta elements
52         new EditorButton(source),
53     ]);
54 }