]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/ui/toolbars.ts
Lexical: Added format previews to format buttons
[bookstack] / resources / js / wysiwyg / ui / toolbars.ts
1 import {EditorButton, FormatPreviewButton} from "./framework/buttons";
2 import {
3     blockquote, bold, code,
4     dangerCallout,
5     h2, h3, h4, h5,
6     infoCallout, italic, link, paragraph,
7     redo, 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         new EditorButton(undo),
19         new EditorButton(redo),
20
21         new EditorFormatMenu([
22             new FormatPreviewButton(el('h2'), h2),
23             new FormatPreviewButton(el('h3'), h3),
24             new FormatPreviewButton(el('h4'), h4),
25             new FormatPreviewButton(el('h5'), h5),
26             new FormatPreviewButton(el('blockquote'), blockquote),
27             new FormatPreviewButton(el('p'), paragraph),
28             new FormatPreviewButton(el('p', {class: 'callout info'}), infoCallout),
29             new FormatPreviewButton(el('p', {class: 'callout success'}), successCallout),
30             new FormatPreviewButton(el('p', {class: 'callout warning'}), warningCallout),
31             new FormatPreviewButton(el('p', {class: 'callout danger'}), dangerCallout),
32         ]),
33
34         new EditorButton(bold),
35         new EditorButton(italic),
36         new EditorButton(underline),
37         new EditorButton(strikethrough),
38         new EditorButton(superscript),
39         new EditorButton(subscript),
40         new EditorButton(code),
41
42         new EditorButton(link),
43     ]);
44 }