]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/ui/toolbars.ts
fe19b94ed7a95e666a11f43b956291ec8cf8c0a2
[bookstack] / resources / js / wysiwyg / ui / toolbars.ts
1 import {EditorButton} from "./framework/buttons";
2 import {
3     blockquote, bold, bulletList, clearFormating, code,
4     dangerCallout, details,
5     h2, h3, h4, h5, highlightColor, image,
6     infoCallout, italic, link, numberList, paragraph,
7     redo, source, strikethrough, subscript,
8     successCallout, superscript, taskList, textColor, underline,
9     undo,
10     warningCallout
11 } from "./defaults/button-definitions";
12 import {EditorContainerUiElement, EditorSimpleClassContainer} from "./framework/core";
13 import {el} from "../helpers";
14 import {EditorFormatMenu} from "./framework/blocks/format-menu";
15 import {FormatPreviewButton} from "./framework/blocks/format-preview-button";
16 import {EditorDropdownButton} from "./framework/blocks/dropdown-button";
17 import {EditorColorPicker} from "./framework/blocks/color-picker";
18
19
20 export function getMainEditorFullToolbar(): EditorContainerUiElement {
21     return new EditorSimpleClassContainer('editor-toolbar-main', [
22         // History state
23         new EditorButton(undo),
24         new EditorButton(redo),
25
26         // Block formats
27         new EditorFormatMenu([
28             new FormatPreviewButton(el('h2'), h2),
29             new FormatPreviewButton(el('h3'), h3),
30             new FormatPreviewButton(el('h4'), h4),
31             new FormatPreviewButton(el('h5'), h5),
32             new FormatPreviewButton(el('blockquote'), blockquote),
33             new FormatPreviewButton(el('p'), paragraph),
34             new FormatPreviewButton(el('p', {class: 'callout info'}), infoCallout),
35             new FormatPreviewButton(el('p', {class: 'callout success'}), successCallout),
36             new FormatPreviewButton(el('p', {class: 'callout warning'}), warningCallout),
37             new FormatPreviewButton(el('p', {class: 'callout danger'}), dangerCallout),
38         ]),
39
40         // Inline formats
41         new EditorButton(bold),
42         new EditorButton(italic),
43         new EditorButton(underline),
44         new EditorDropdownButton(textColor, [
45             new EditorColorPicker('color'),
46         ]),
47         new EditorDropdownButton(highlightColor, [
48             new EditorColorPicker('background-color'),
49         ]),
50         new EditorButton(strikethrough),
51         new EditorButton(superscript),
52         new EditorButton(subscript),
53         new EditorButton(code),
54         new EditorButton(clearFormating),
55
56         // Lists
57         new EditorButton(bulletList),
58         new EditorButton(numberList),
59         new EditorButton(taskList),
60
61         // Insert types
62         new EditorButton(link),
63         new EditorButton(image),
64         new EditorButton(details),
65
66         // Meta elements
67         new EditorButton(source),
68     ]);
69 }