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";
68 import {EditorSeparator} from "./framework/blocks/separator";
70 export function getMainEditorFullToolbar(): EditorContainerUiElement {
71 return new EditorSimpleClassContainer('editor-toolbar-main', [
74 new EditorOverflowContainer(2, [
75 new EditorButton(undo),
76 new EditorButton(redo),
80 new EditorFormatMenu([
81 new FormatPreviewButton(el('h2'), h2),
82 new FormatPreviewButton(el('h3'), h3),
83 new FormatPreviewButton(el('h4'), h4),
84 new FormatPreviewButton(el('h5'), h5),
85 new FormatPreviewButton(el('blockquote'), blockquote),
86 new FormatPreviewButton(el('p'), paragraph),
87 new EditorDropdownButton({button: {label: 'Callouts', format: 'long'}, showOnHover: true, direction: 'vertical'}, [
88 new FormatPreviewButton(el('p', {class: 'callout info'}), infoCallout),
89 new FormatPreviewButton(el('p', {class: 'callout success'}), successCallout),
90 new FormatPreviewButton(el('p', {class: 'callout warning'}), warningCallout),
91 new FormatPreviewButton(el('p', {class: 'callout danger'}), dangerCallout),
96 new EditorOverflowContainer(6, [
97 new EditorButton(bold),
98 new EditorButton(italic),
99 new EditorButton(underline),
100 new EditorDropdownButton({ button: new EditorColorButton(textColor, 'color') }, [
101 new EditorColorPicker('color'),
103 new EditorDropdownButton({button: new EditorColorButton(highlightColor, 'background-color')}, [
104 new EditorColorPicker('background-color'),
106 new EditorButton(strikethrough),
107 new EditorButton(superscript),
108 new EditorButton(subscript),
109 new EditorButton(code),
110 new EditorButton(clearFormating),
114 new EditorOverflowContainer(4, [
115 new EditorButton(alignLeft),
116 new EditorButton(alignCenter),
117 new EditorButton(alignRight),
118 new EditorButton(alignJustify),
122 new EditorOverflowContainer(3, [
123 new EditorButton(bulletList),
124 new EditorButton(numberList),
125 new EditorButton(taskList),
129 new EditorOverflowContainer(4, [
130 new EditorButton(link),
132 new EditorDropdownButton({button: table, direction: 'vertical'}, [
133 new EditorDropdownButton({button: {label: 'Insert', format: 'long'}, showOnHover: true}, [
134 new EditorTableCreator(),
136 new EditorSeparator(),
137 new EditorDropdownButton({button: {label: 'Cell', format: 'long'}, direction: 'vertical', showOnHover: true}, [
138 new EditorButton(cellProperties),
139 new EditorButton(mergeCells),
140 new EditorButton(splitCell),
142 new EditorDropdownButton({button: {label: 'Row', format: 'long'}, direction: 'vertical', showOnHover: true}, [
143 new EditorButton({...insertRowAbove, format: 'long'}),
144 new EditorButton({...insertRowBelow, format: 'long'}),
145 new EditorButton({...deleteRow, format: 'long'}),
146 new EditorButton(rowProperties),
147 new EditorSeparator(),
148 new EditorButton(cutRow),
149 new EditorButton(copyRow),
150 new EditorButton(pasteRowBefore),
151 new EditorButton(pasteRowAfter),
153 new EditorDropdownButton({button: {label: 'Column', format: 'long'}, direction: 'vertical', showOnHover: true}, [
154 new EditorButton({...insertColumnBefore, format: 'long'}),
155 new EditorButton({...insertColumnAfter, format: 'long'}),
156 new EditorButton({...deleteColumn, format: 'long'}),
157 new EditorSeparator(),
158 new EditorButton(cutColumn),
159 new EditorButton(copyColumn),
160 new EditorButton(pasteColumnBefore),
161 new EditorButton(pasteColumnAfter),
163 new EditorSeparator(),
164 new EditorButton({...tableProperties, format: 'long'}),
165 new EditorButton(clearTableFormatting),
166 new EditorButton(resizeTableToContents),
167 new EditorButton(deleteTableMenuAction),
170 new EditorButton(image),
171 new EditorButton(horizontalRule),
172 new EditorButton(codeBlock),
173 new EditorButtonWithMenu(
174 new EditorButton(diagram),
175 [new EditorButton(diagramManager)],
177 new EditorButton(media),
178 new EditorButton(details),
182 new EditorOverflowContainer(3, [
183 new EditorButton(source),
184 new EditorButton(fullscreen),
187 // new EditorButton({
188 // label: 'Test button',
189 // action(context: EditorUiContext) {
190 // context.editor.update(() => {
202 export function getImageToolbarContent(): EditorUiElement[] {
203 return [new EditorButton(image)];
206 export function getLinkToolbarContent(): EditorUiElement[] {
208 new EditorButton(link),
209 new EditorButton(unlink),
213 export function getCodeToolbarContent(): EditorUiElement[] {
215 new EditorButton(editCodeBlock),
219 export function getTableToolbarContent(): EditorUiElement[] {
221 new EditorOverflowContainer(2, [
222 new EditorButton(tableProperties),
223 new EditorButton(deleteTable),
225 new EditorOverflowContainer(3, [
226 new EditorButton(insertRowAbove),
227 new EditorButton(insertRowBelow),
228 new EditorButton(deleteRow),
230 new EditorOverflowContainer(3, [
231 new EditorButton(insertColumnBefore),
232 new EditorButton(insertColumnAfter),
233 new EditorButton(deleteColumn),