1 import {EditorButton} from "./framework/buttons";
3 alignCenter, alignJustify,
6 blockquote, bold, bulletList, clearFormating, code, codeBlock,
7 dangerCallout, details, editCodeBlock, fullscreen,
8 h2, h3, h4, h5, highlightColor, horizontalRule, image,
9 infoCallout, italic, link, numberList, paragraph,
10 redo, source, strikethrough, subscript,
11 successCallout, superscript, table, taskList, textColor, underline,
14 } from "./defaults/button-definitions";
15 import {EditorContainerUiElement, EditorSimpleClassContainer, EditorUiElement} from "./framework/core";
16 import {el} from "../helpers";
17 import {EditorFormatMenu} from "./framework/blocks/format-menu";
18 import {FormatPreviewButton} from "./framework/blocks/format-preview-button";
19 import {EditorDropdownButton} from "./framework/blocks/dropdown-button";
20 import {EditorColorPicker} from "./framework/blocks/color-picker";
21 import {EditorTableCreator} from "./framework/blocks/table-creator";
22 import {EditorColorButton} from "./framework/blocks/color-button";
23 import {EditorOverflowContainer} from "./framework/blocks/overflow-container";
25 export function getMainEditorFullToolbar(): EditorContainerUiElement {
26 return new EditorSimpleClassContainer('editor-toolbar-main', [
29 new EditorOverflowContainer(2, [
30 new EditorButton(undo),
31 new EditorButton(redo),
35 new EditorFormatMenu([
36 new FormatPreviewButton(el('h2'), h2),
37 new FormatPreviewButton(el('h3'), h3),
38 new FormatPreviewButton(el('h4'), h4),
39 new FormatPreviewButton(el('h5'), h5),
40 new FormatPreviewButton(el('blockquote'), blockquote),
41 new FormatPreviewButton(el('p'), paragraph),
42 new EditorDropdownButton({label: 'Callouts'}, true, [
43 new FormatPreviewButton(el('p', {class: 'callout info'}), infoCallout),
44 new FormatPreviewButton(el('p', {class: 'callout success'}), successCallout),
45 new FormatPreviewButton(el('p', {class: 'callout warning'}), warningCallout),
46 new FormatPreviewButton(el('p', {class: 'callout danger'}), dangerCallout),
51 new EditorOverflowContainer(6, [
52 new EditorButton(bold),
53 new EditorButton(italic),
54 new EditorButton(underline),
55 new EditorDropdownButton(new EditorColorButton(textColor, 'color'), false, [
56 new EditorColorPicker('color'),
58 new EditorDropdownButton(new EditorColorButton(highlightColor, 'background-color'), false, [
59 new EditorColorPicker('background-color'),
61 new EditorButton(strikethrough),
62 new EditorButton(superscript),
63 new EditorButton(subscript),
64 new EditorButton(code),
65 new EditorButton(clearFormating),
69 new EditorOverflowContainer(4, [
70 new EditorButton(alignLeft),
71 new EditorButton(alignCenter),
72 new EditorButton(alignRight),
73 new EditorButton(alignJustify),
77 new EditorOverflowContainer(3, [
78 new EditorButton(bulletList),
79 new EditorButton(numberList),
80 new EditorButton(taskList),
84 new EditorOverflowContainer(6, [
85 new EditorButton(link),
86 new EditorDropdownButton(table, false, [
87 new EditorTableCreator(),
89 new EditorButton(image),
90 new EditorButton(horizontalRule),
91 new EditorButton(codeBlock),
92 new EditorButton(details),
96 new EditorOverflowContainer(3, [
97 new EditorButton(source),
98 new EditorButton(fullscreen),
101 // new EditorButton({
102 // label: 'Test button',
103 // action(context: EditorUiContext) {
104 // context.editor.update(() => {
116 export function getImageToolbarContent(): EditorUiElement[] {
117 return [new EditorButton(image)];
120 export function getLinkToolbarContent(): EditorUiElement[] {
122 new EditorButton(link),
123 new EditorButton(unlink),
127 export function getCodeToolbarContent(): EditorUiElement[] {
129 new EditorButton(editCodeBlock),