1 import {EditorButton} from "./framework/buttons";
2 import {EditorContainerUiElement, EditorSimpleClassContainer, EditorUiElement} from "./framework/core";
3 import {EditorFormatMenu} from "./framework/blocks/format-menu";
4 import {FormatPreviewButton} from "./framework/blocks/format-preview-button";
5 import {EditorDropdownButton} from "./framework/blocks/dropdown-button";
6 import {EditorColorPicker} from "./framework/blocks/color-picker";
7 import {EditorTableCreator} from "./framework/blocks/table-creator";
8 import {EditorColorButton} from "./framework/blocks/color-button";
9 import {EditorOverflowContainer} from "./framework/blocks/overflow-container";
11 cellProperties, clearTableFormatting,
19 deleteTableMenuAction,
28 pasteRowBefore, resizeTableToContents,
31 table, tableProperties
32 } from "./defaults/buttons/tables";
33 import {fullscreen, redo, source, undo} from "./defaults/buttons/controls";
35 blockquote, dangerCallout,
44 } from "./defaults/buttons/block-formats";
46 bold, clearFormating, code,
49 strikethrough, subscript,
53 } from "./defaults/buttons/inline-formats";
54 import {alignCenter, alignJustify, alignLeft, alignRight} from "./defaults/buttons/alignments";
55 import {bulletList, numberList, taskList} from "./defaults/buttons/lists";
59 diagram, diagramManager,
65 } from "./defaults/buttons/objects";
66 import {el} from "../utils/dom";
67 import {EditorButtonWithMenu} from "./framework/blocks/button-with-menu";
69 export function getMainEditorFullToolbar(): EditorContainerUiElement {
70 return new EditorSimpleClassContainer('editor-toolbar-main', [
73 new EditorOverflowContainer(2, [
74 new EditorButton(undo),
75 new EditorButton(redo),
79 new EditorFormatMenu([
80 new FormatPreviewButton(el('h2'), h2),
81 new FormatPreviewButton(el('h3'), h3),
82 new FormatPreviewButton(el('h4'), h4),
83 new FormatPreviewButton(el('h5'), h5),
84 new FormatPreviewButton(el('blockquote'), blockquote),
85 new FormatPreviewButton(el('p'), paragraph),
86 new EditorDropdownButton({button: {label: 'Callouts'}, showOnHover: true, direction: 'vertical'}, [
87 new FormatPreviewButton(el('p', {class: 'callout info'}), infoCallout),
88 new FormatPreviewButton(el('p', {class: 'callout success'}), successCallout),
89 new FormatPreviewButton(el('p', {class: 'callout warning'}), warningCallout),
90 new FormatPreviewButton(el('p', {class: 'callout danger'}), dangerCallout),
95 new EditorOverflowContainer(6, [
96 new EditorButton(bold),
97 new EditorButton(italic),
98 new EditorButton(underline),
99 new EditorDropdownButton({ button: new EditorColorButton(textColor, 'color') }, [
100 new EditorColorPicker('color'),
102 new EditorDropdownButton({button: new EditorColorButton(highlightColor, 'background-color')}, [
103 new EditorColorPicker('background-color'),
105 new EditorButton(strikethrough),
106 new EditorButton(superscript),
107 new EditorButton(subscript),
108 new EditorButton(code),
109 new EditorButton(clearFormating),
113 new EditorOverflowContainer(4, [
114 new EditorButton(alignLeft),
115 new EditorButton(alignCenter),
116 new EditorButton(alignRight),
117 new EditorButton(alignJustify),
121 new EditorOverflowContainer(3, [
122 new EditorButton(bulletList),
123 new EditorButton(numberList),
124 new EditorButton(taskList),
128 new EditorOverflowContainer(8, [
129 new EditorButton(link),
131 new EditorDropdownButton({button: table, direction: 'vertical'}, [
132 new EditorDropdownButton({button: {...table, format: 'long'}, showOnHover: true}, [
133 new EditorTableCreator(),
135 new EditorDropdownButton({button: {label: 'Cell'}, direction: 'vertical', showOnHover: true}, [
136 new EditorButton(cellProperties),
137 new EditorButton(mergeCells),
138 new EditorButton(splitCell),
140 new EditorDropdownButton({button: {label: 'Row'}, direction: 'vertical', showOnHover: true}, [
141 new EditorButton({...insertRowAbove, format: 'long'}),
142 new EditorButton({...insertRowBelow, format: 'long'}),
143 new EditorButton({...deleteRow, format: 'long'}),
144 new EditorButton(rowProperties),
145 new EditorButton(cutRow),
146 new EditorButton(copyRow),
147 new EditorButton(pasteRowBefore),
148 new EditorButton(pasteRowAfter),
150 new EditorDropdownButton({button: {label: 'Column'}, direction: 'vertical', showOnHover: true}, [
151 new EditorButton({...insertColumnBefore, format: 'long'}),
152 new EditorButton({...insertColumnAfter, format: 'long'}),
153 new EditorButton({...deleteColumn, format: 'long'}),
154 new EditorButton(cutColumn),
155 new EditorButton(copyColumn),
156 new EditorButton(pasteColumnBefore),
157 new EditorButton(pasteColumnAfter),
159 new EditorButton({...tableProperties, format: 'long'}),
160 new EditorButton(clearTableFormatting),
161 new EditorButton(resizeTableToContents),
162 new EditorButton(deleteTableMenuAction),
165 new EditorButton(image),
166 new EditorButton(horizontalRule),
167 new EditorButton(codeBlock),
168 new EditorButtonWithMenu(
169 new EditorButton(diagram),
170 [new EditorButton(diagramManager)],
172 new EditorButton(media),
173 new EditorButton(details),
177 new EditorOverflowContainer(3, [
178 new EditorButton(source),
179 new EditorButton(fullscreen),
182 // new EditorButton({
183 // label: 'Test button',
184 // action(context: EditorUiContext) {
185 // context.editor.update(() => {
197 export function getImageToolbarContent(): EditorUiElement[] {
198 return [new EditorButton(image)];
201 export function getLinkToolbarContent(): EditorUiElement[] {
203 new EditorButton(link),
204 new EditorButton(unlink),
208 export function getCodeToolbarContent(): EditorUiElement[] {
210 new EditorButton(editCodeBlock),
214 export function getTableToolbarContent(): EditorUiElement[] {
216 new EditorOverflowContainer(2, [
217 new EditorButton(tableProperties),
218 new EditorButton(deleteTable),
220 new EditorOverflowContainer(3, [
221 new EditorButton(insertRowAbove),
222 new EditorButton(insertRowBelow),
223 new EditorButton(deleteRow),
225 new EditorOverflowContainer(3, [
226 new EditorButton(insertColumnBefore),
227 new EditorButton(insertColumnAfter),
228 new EditorButton(deleteColumn),