]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/ui/toolbars.ts
Lexical: Added button icon system
[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 console.log(undo);
20
21 export function getMainEditorFullToolbar(): EditorContainerUiElement {
22     return new EditorSimpleClassContainer('editor-toolbar-main', [
23         // History state
24         new EditorButton(undo),
25         new EditorButton(redo),
26
27         // Block formats
28         new EditorFormatMenu([
29             new FormatPreviewButton(el('h2'), h2),
30             new FormatPreviewButton(el('h3'), h3),
31             new FormatPreviewButton(el('h4'), h4),
32             new FormatPreviewButton(el('h5'), h5),
33             new FormatPreviewButton(el('blockquote'), blockquote),
34             new FormatPreviewButton(el('p'), paragraph),
35             new FormatPreviewButton(el('p', {class: 'callout info'}), infoCallout),
36             new FormatPreviewButton(el('p', {class: 'callout success'}), successCallout),
37             new FormatPreviewButton(el('p', {class: 'callout warning'}), warningCallout),
38             new FormatPreviewButton(el('p', {class: 'callout danger'}), dangerCallout),
39         ]),
40
41         // Inline formats
42         new EditorButton(bold),
43         new EditorButton(italic),
44         new EditorButton(underline),
45         new EditorDropdownButton(textColor, [
46             new EditorColorPicker('color'),
47         ]),
48         new EditorDropdownButton(highlightColor, [
49             new EditorColorPicker('background-color'),
50         ]),
51         new EditorButton(strikethrough),
52         new EditorButton(superscript),
53         new EditorButton(subscript),
54         new EditorButton(code),
55         new EditorButton(clearFormating),
56
57         // Lists
58         new EditorButton(bulletList),
59         new EditorButton(numberList),
60         new EditorButton(taskList),
61
62         // Insert types
63         new EditorButton(link),
64         new EditorButton(image),
65         new EditorButton(details),
66
67         // Meta elements
68         new EditorButton(source),
69     ]);
70 }