@gravity-ui/markdown-editor 14.7.0 → 14.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -14
- package/build/cjs/bundle/MarkdownEditorView.d.ts +27 -0
- package/build/cjs/bundle/MarkdownEditorView.js +19 -2
- package/build/cjs/bundle/config/action-names.d.ts +1 -1
- package/build/cjs/bundle/config/action-names.js +50 -27
- package/build/cjs/bundle/config/index.d.ts +3 -0
- package/build/cjs/bundle/config/index.js +3 -0
- package/build/cjs/bundle/config/markup.js +3 -0
- package/build/cjs/bundle/config/wysiwyg.d.ts +3 -0
- package/build/cjs/bundle/toolbar/utils.d.ts +17 -0
- package/build/cjs/bundle/toolbar/utils.js +64 -0
- package/build/cjs/extensions/markdown/Link/paste-plugin.js +21 -5
- package/build/cjs/i18n/menubar/en.json +1 -0
- package/build/cjs/i18n/menubar/index.d.ts +2 -1
- package/build/cjs/i18n/menubar/ru.json +1 -0
- package/build/cjs/markup/codemirror/create.js +24 -11
- package/build/cjs/markup/codemirror/smart-reindent/index.d.ts +4 -0
- package/build/cjs/markup/codemirror/smart-reindent/index.js +42 -0
- package/build/cjs/markup/codemirror/smart-reindent/utils.d.ts +15 -0
- package/build/cjs/markup/codemirror/smart-reindent/utils.js +59 -0
- package/build/cjs/modules/toolbars/constants.d.ts +13 -0
- package/build/cjs/modules/toolbars/constants.js +18 -0
- package/build/cjs/modules/toolbars/items.d.ts +127 -0
- package/build/cjs/modules/toolbars/items.js +736 -0
- package/build/cjs/modules/toolbars/presets.d.ts +6 -0
- package/build/cjs/modules/toolbars/presets.js +465 -0
- package/build/cjs/modules/toolbars/types.d.ts +62 -0
- package/build/cjs/modules/toolbars/types.js +2 -0
- package/build/cjs/toolbar/types.d.ts +8 -0
- package/build/cjs/toolbar/types.js +2 -0
- package/build/cjs/version.js +1 -1
- package/build/esm/bundle/MarkdownEditorView.d.ts +27 -0
- package/build/esm/bundle/MarkdownEditorView.js +19 -2
- package/build/esm/bundle/config/action-names.d.ts +1 -1
- package/build/esm/bundle/config/action-names.js +50 -27
- package/build/esm/bundle/config/index.d.ts +3 -0
- package/build/esm/bundle/config/index.js +3 -0
- package/build/esm/bundle/config/markup.js +3 -0
- package/build/esm/bundle/config/wysiwyg.d.ts +3 -0
- package/build/esm/bundle/toolbar/utils.d.ts +17 -0
- package/build/esm/bundle/toolbar/utils.js +59 -0
- package/build/esm/extensions/markdown/Link/paste-plugin.js +21 -5
- package/build/esm/i18n/menubar/en.json +1 -0
- package/build/esm/i18n/menubar/index.d.ts +2 -1
- package/build/esm/i18n/menubar/ru.json +1 -0
- package/build/esm/markup/codemirror/create.js +24 -11
- package/build/esm/markup/codemirror/smart-reindent/index.d.ts +4 -0
- package/build/esm/markup/codemirror/smart-reindent/index.js +38 -0
- package/build/esm/markup/codemirror/smart-reindent/utils.d.ts +15 -0
- package/build/esm/markup/codemirror/smart-reindent/utils.js +55 -0
- package/build/esm/modules/toolbars/constants.d.ts +13 -0
- package/build/esm/modules/toolbars/constants.js +15 -0
- package/build/esm/modules/toolbars/items.d.ts +127 -0
- package/build/esm/modules/toolbars/items.js +730 -0
- package/build/esm/modules/toolbars/presets.d.ts +6 -0
- package/build/esm/modules/toolbars/presets.js +462 -0
- package/build/esm/modules/toolbars/types.d.ts +62 -0
- package/build/esm/modules/toolbars/types.js +1 -0
- package/build/esm/toolbar/types.d.ts +8 -0
- package/build/esm/toolbar/types.js +2 -0
- package/build/esm/version.js +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fileItemView = exports.imageItemMarkup = exports.imageItemWysiwyg = exports.imagePopupItemView = exports.imageItemView = exports.codeItemMarkup = exports.codeItemWysiwyg = exports.codeItemView = exports.tableItemMarkup = exports.tableItemWysiwyg = exports.tableItemView = exports.noteItemMarkup = exports.noteItemWysiwyg = exports.noteItemView = exports.cutItemMarkup = exports.cutItemWysiwyg = exports.cutItemView = exports.quoteItemMarkup = exports.quoteItemWysiwyg = exports.quoteItemView = exports.linkItemMarkup = exports.linkItemWysiwyg = exports.linkItemView = exports.checkboxItemMarkup = exports.checkboxItemWysiwyg = exports.checkboxItemView = exports.markedItemMarkup = exports.markedItemWysiwyg = exports.markedItemView = exports.monospaceItemMarkup = exports.monospaceItemWysiwyg = exports.monospaceItemView = exports.strikethroughItemMarkup = exports.strikethroughItemWysiwyg = exports.strikethroughItemView = exports.underlineItemMarkup = exports.underlineItemWysiwyg = exports.underlineItemView = exports.italicItemMarkup = exports.italicItemWysiwyg = exports.italicItemView = exports.boldItemMarkup = exports.boldItemWysiwyg = exports.boldItemView = exports.redoItemMarkup = exports.redoItemWysiwyg = exports.redoItemView = exports.undoItemMarkup = exports.undoItemWysiwyg = exports.undoItemView = void 0;
|
|
4
|
+
exports.orderedListItemWysiwyg = exports.orderedListItemView = exports.bulletListItemMarkup = exports.bulletListItemWysiwyg = exports.bulletListItemView = exports.heading6ItemMarkup = exports.heading6ItemWysiwyg = exports.heading6ItemView = exports.heading5ItemMarkup = exports.heading5ItemWysiwyg = exports.heading5ItemView = exports.heading4ItemMarkup = exports.heading4ItemWysiwyg = exports.heading4ItemView = exports.heading3ItemMarkup = exports.heading3ItemWysiwyg = exports.heading3ItemView = exports.heading2ItemMarkup = exports.heading2ItemWysiwyg = exports.heading2ItemView = exports.heading1ItemMarkup = exports.heading1ItemWysiwyg = exports.heading1ItemView = exports.emojiItemMarkup = exports.emojiItemWysiwyg = exports.emojiItemView = exports.hruleItemMarkup = exports.hruleItemWysiwyg = exports.hruleItemView = exports.codeBlockItemMarkup = exports.codeBlockItemWysiwyg = exports.codeBlockItemView = exports.mermaidItemMarkup = exports.mermaidItemWysiwyg = exports.mermaidItemView = exports.yfmHtmlBlockItemMarkup = exports.yfmHtmlBlockItemWysiwyg = exports.yfmHtmlBlockItemView = exports.mathBlockItemMarkup = exports.mathBlockItemWysiwyg = exports.mathBlockItemView = exports.mathInlineItemMarkup = exports.mathInlineItemWysiwyg = exports.mathInlineItemView = exports.tabsItemMarkup = exports.tabsItemWysiwyg = exports.tabsItemView = exports.fileItemMarkup = exports.fileItemWysiwyg = exports.filePopupItemView = void 0;
|
|
5
|
+
exports.mathListItemView = exports.codeBlocksListItemView = exports.moveListItemView = exports.listsListItemView = exports.headingListItemView = exports.gptItemMarkup = exports.gptItemWysiwyg = exports.gptItemView = exports.colorifyItemMarkup = exports.colorifyItemWysiwyg = exports.colorifyItemView = exports.paragraphItemMarkup = exports.paragraphItemWisywig = exports.paragraphItemView = exports.textContextItemWisywig = exports.textContextItemView = exports.toggleHeadingFoldingItemWysiwyg = exports.toggleHeadingFoldingItemView = exports.liftListItemMarkup = exports.liftListItemWysiwyg = exports.liftListItemView = exports.sinkListItemMarkup = exports.sinkListItemWysiwyg = exports.sinkListItemView = exports.orderedListItemMarkup = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
8
|
+
const icons_1 = require("../../bundle/config/icons");
|
|
9
|
+
const MToolbarColors_1 = require("../../bundle/toolbar/markup/MToolbarColors");
|
|
10
|
+
const MToolbarFilePopup_1 = require("../../bundle/toolbar/markup/MToolbarFilePopup");
|
|
11
|
+
const MToolbarImagePopup_1 = require("../../bundle/toolbar/markup/MToolbarImagePopup");
|
|
12
|
+
const WToolbarColors_1 = require("../../bundle/toolbar/wysiwyg/WToolbarColors");
|
|
13
|
+
const WToolbarTextSelect_1 = require("../../bundle/toolbar/wysiwyg/WToolbarTextSelect");
|
|
14
|
+
const extensions_1 = require("../../extensions");
|
|
15
|
+
const constants_1 = require("../../extensions/additional/GPT/constants");
|
|
16
|
+
const hints_1 = require("../../i18n/hints");
|
|
17
|
+
const menubar_1 = require("../../i18n/menubar");
|
|
18
|
+
const commands_1 = require("../../markup/commands");
|
|
19
|
+
const shortcuts_1 = require("../../shortcuts");
|
|
20
|
+
const toolbar_1 = require("../../toolbar");
|
|
21
|
+
const noop = () => { };
|
|
22
|
+
const inactive = () => false;
|
|
23
|
+
const enable = () => true;
|
|
24
|
+
const disable = () => false;
|
|
25
|
+
// ---- Undo ----
|
|
26
|
+
exports.undoItemView = {
|
|
27
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
28
|
+
title: menubar_1.i18n.bind(null, 'undo'),
|
|
29
|
+
icon: icons_1.icons.undo,
|
|
30
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Undo),
|
|
31
|
+
};
|
|
32
|
+
exports.undoItemWysiwyg = {
|
|
33
|
+
hintWhenDisabled: false,
|
|
34
|
+
exec: (e) => e.actions.undo.run(),
|
|
35
|
+
isActive: (e) => e.actions.undo.isActive(),
|
|
36
|
+
isEnable: (e) => e.actions.undo.isEnable(),
|
|
37
|
+
};
|
|
38
|
+
exports.undoItemMarkup = {
|
|
39
|
+
hintWhenDisabled: false,
|
|
40
|
+
exec: (e) => (0, commands_1.undo)(e.cm),
|
|
41
|
+
isActive: inactive,
|
|
42
|
+
isEnable: (e) => (0, commands_1.undoDepth)(e.cm.state) > 0,
|
|
43
|
+
};
|
|
44
|
+
// ---- Redo ----
|
|
45
|
+
exports.redoItemView = {
|
|
46
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
47
|
+
title: menubar_1.i18n.bind(null, 'redo'),
|
|
48
|
+
icon: icons_1.icons.redo,
|
|
49
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Redo),
|
|
50
|
+
};
|
|
51
|
+
exports.redoItemWysiwyg = {
|
|
52
|
+
hintWhenDisabled: false,
|
|
53
|
+
exec: (e) => e.actions.redo.run(),
|
|
54
|
+
isActive: (e) => e.actions.redo.isActive(),
|
|
55
|
+
isEnable: (e) => e.actions.redo.isEnable(),
|
|
56
|
+
};
|
|
57
|
+
exports.redoItemMarkup = {
|
|
58
|
+
hintWhenDisabled: false,
|
|
59
|
+
exec: (e) => (0, commands_1.redo)(e.cm),
|
|
60
|
+
isActive: inactive,
|
|
61
|
+
isEnable: (e) => (0, commands_1.redoDepth)(e.cm.state) > 0,
|
|
62
|
+
};
|
|
63
|
+
// ---- Bold ----
|
|
64
|
+
exports.boldItemView = {
|
|
65
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
66
|
+
title: menubar_1.i18n.bind(null, 'bold'),
|
|
67
|
+
icon: icons_1.icons.bold,
|
|
68
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Bold),
|
|
69
|
+
};
|
|
70
|
+
exports.boldItemWysiwyg = {
|
|
71
|
+
exec: (e) => e.actions.bold.run(),
|
|
72
|
+
isActive: (e) => e.actions.bold.isActive(),
|
|
73
|
+
isEnable: (e) => e.actions.bold.isEnable(),
|
|
74
|
+
};
|
|
75
|
+
exports.boldItemMarkup = {
|
|
76
|
+
exec: (e) => (0, commands_1.toggleBold)(e.cm),
|
|
77
|
+
isActive: inactive,
|
|
78
|
+
isEnable: enable,
|
|
79
|
+
};
|
|
80
|
+
// ---- Italic ----
|
|
81
|
+
exports.italicItemView = {
|
|
82
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
83
|
+
title: menubar_1.i18n.bind(null, 'italic'),
|
|
84
|
+
icon: icons_1.icons.italic,
|
|
85
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Italic),
|
|
86
|
+
};
|
|
87
|
+
exports.italicItemWysiwyg = {
|
|
88
|
+
exec: (e) => e.actions.italic.run(),
|
|
89
|
+
isActive: (e) => e.actions.italic.isActive(),
|
|
90
|
+
isEnable: (e) => e.actions.italic.isEnable(),
|
|
91
|
+
};
|
|
92
|
+
exports.italicItemMarkup = {
|
|
93
|
+
exec: (e) => (0, commands_1.toggleItalic)(e.cm),
|
|
94
|
+
isActive: inactive,
|
|
95
|
+
isEnable: enable,
|
|
96
|
+
};
|
|
97
|
+
// ---- Underline ----
|
|
98
|
+
exports.underlineItemView = {
|
|
99
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
100
|
+
title: menubar_1.i18n.bind(null, 'underline'),
|
|
101
|
+
icon: icons_1.icons.underline,
|
|
102
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Underline),
|
|
103
|
+
};
|
|
104
|
+
exports.underlineItemWysiwyg = {
|
|
105
|
+
exec: (e) => e.actions.underline.run(),
|
|
106
|
+
isActive: (e) => e.actions.underline.isActive(),
|
|
107
|
+
isEnable: (e) => e.actions.underline.isEnable(),
|
|
108
|
+
};
|
|
109
|
+
exports.underlineItemMarkup = {
|
|
110
|
+
exec: (e) => (0, commands_1.toggleUnderline)(e.cm),
|
|
111
|
+
isActive: inactive,
|
|
112
|
+
isEnable: enable,
|
|
113
|
+
};
|
|
114
|
+
// ---- Strikethrough ----
|
|
115
|
+
exports.strikethroughItemView = {
|
|
116
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
117
|
+
title: menubar_1.i18n.bind(null, 'strike'),
|
|
118
|
+
icon: icons_1.icons.strikethrough,
|
|
119
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Strike),
|
|
120
|
+
};
|
|
121
|
+
exports.strikethroughItemWysiwyg = {
|
|
122
|
+
exec: (e) => e.actions.strike.run(),
|
|
123
|
+
isActive: (e) => e.actions.strike.isActive(),
|
|
124
|
+
isEnable: (e) => e.actions.strike.isEnable(),
|
|
125
|
+
};
|
|
126
|
+
exports.strikethroughItemMarkup = {
|
|
127
|
+
exec: (e) => (0, commands_1.toggleStrikethrough)(e.cm),
|
|
128
|
+
isActive: inactive,
|
|
129
|
+
isEnable: enable,
|
|
130
|
+
};
|
|
131
|
+
// ---- Monospace ----
|
|
132
|
+
exports.monospaceItemView = {
|
|
133
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
134
|
+
title: menubar_1.i18n.bind(null, 'mono'),
|
|
135
|
+
icon: icons_1.icons.mono,
|
|
136
|
+
};
|
|
137
|
+
exports.monospaceItemWysiwyg = {
|
|
138
|
+
exec: (e) => e.actions.mono.run(),
|
|
139
|
+
isActive: (e) => e.actions.mono.isActive(),
|
|
140
|
+
isEnable: (e) => e.actions.mono.isEnable(),
|
|
141
|
+
};
|
|
142
|
+
exports.monospaceItemMarkup = {
|
|
143
|
+
exec: (e) => (0, commands_1.toggleMonospace)(e.cm),
|
|
144
|
+
isActive: inactive,
|
|
145
|
+
isEnable: enable,
|
|
146
|
+
};
|
|
147
|
+
// ---- Marked ----
|
|
148
|
+
exports.markedItemView = {
|
|
149
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
150
|
+
title: menubar_1.i18n.bind(null, 'mark'),
|
|
151
|
+
icon: icons_1.icons.mark,
|
|
152
|
+
};
|
|
153
|
+
exports.markedItemWysiwyg = {
|
|
154
|
+
exec: (e) => e.actions.mark.run(),
|
|
155
|
+
isActive: (e) => e.actions.mark.isActive(),
|
|
156
|
+
isEnable: (e) => e.actions.mark.isEnable(),
|
|
157
|
+
};
|
|
158
|
+
exports.markedItemMarkup = {
|
|
159
|
+
exec: (e) => (0, commands_1.toggleMarked)(e.cm),
|
|
160
|
+
isActive: inactive,
|
|
161
|
+
isEnable: enable,
|
|
162
|
+
};
|
|
163
|
+
// ---- Checkbox ----
|
|
164
|
+
exports.checkboxItemView = {
|
|
165
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
166
|
+
title: menubar_1.i18n.bind(null, 'checkbox'),
|
|
167
|
+
icon: icons_1.icons.checklist,
|
|
168
|
+
};
|
|
169
|
+
exports.checkboxItemWysiwyg = {
|
|
170
|
+
exec: (e) => e.actions.addCheckbox.run(),
|
|
171
|
+
isActive: (e) => e.actions.addCheckbox.isActive(),
|
|
172
|
+
isEnable: (e) => e.actions.addCheckbox.isEnable(),
|
|
173
|
+
};
|
|
174
|
+
exports.checkboxItemMarkup = {
|
|
175
|
+
exec: (e) => (0, commands_1.wrapToCheckbox)(e.cm),
|
|
176
|
+
isActive: inactive,
|
|
177
|
+
isEnable: enable,
|
|
178
|
+
};
|
|
179
|
+
// ---- Link ----
|
|
180
|
+
exports.linkItemView = {
|
|
181
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
182
|
+
title: menubar_1.i18n.bind(null, 'link'),
|
|
183
|
+
icon: icons_1.icons.link,
|
|
184
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Link),
|
|
185
|
+
};
|
|
186
|
+
exports.linkItemWysiwyg = {
|
|
187
|
+
exec: (e) => e.actions.addLink.run(),
|
|
188
|
+
isActive: (e) => e.actions.addLink.isActive(),
|
|
189
|
+
isEnable: (e) => e.actions.addLink.isEnable(),
|
|
190
|
+
};
|
|
191
|
+
exports.linkItemMarkup = {
|
|
192
|
+
exec: (e) => (0, commands_1.insertLink)(e.cm),
|
|
193
|
+
isActive: inactive,
|
|
194
|
+
isEnable: enable,
|
|
195
|
+
};
|
|
196
|
+
// ---- Quote ----
|
|
197
|
+
exports.quoteItemView = {
|
|
198
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
199
|
+
title: menubar_1.i18n.bind(null, 'quote'),
|
|
200
|
+
icon: icons_1.icons.quote,
|
|
201
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Quote),
|
|
202
|
+
};
|
|
203
|
+
exports.quoteItemWysiwyg = {
|
|
204
|
+
exec: (e) => e.actions.quote.run(),
|
|
205
|
+
isActive: (e) => e.actions.quote.isActive(),
|
|
206
|
+
isEnable: (e) => e.actions.quote.isEnable(),
|
|
207
|
+
};
|
|
208
|
+
exports.quoteItemMarkup = {
|
|
209
|
+
exec: (e) => (0, commands_1.wrapToBlockquote)(e.cm),
|
|
210
|
+
isActive: inactive,
|
|
211
|
+
isEnable: enable,
|
|
212
|
+
};
|
|
213
|
+
// ---- Cut ----
|
|
214
|
+
exports.cutItemView = {
|
|
215
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
216
|
+
title: menubar_1.i18n.bind(null, 'cut'),
|
|
217
|
+
icon: icons_1.icons.cut,
|
|
218
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Cut),
|
|
219
|
+
};
|
|
220
|
+
exports.cutItemWysiwyg = {
|
|
221
|
+
exec: (e) => e.actions.toYfmCut.run(),
|
|
222
|
+
isActive: (e) => e.actions.toYfmCut.isActive(),
|
|
223
|
+
isEnable: (e) => e.actions.toYfmCut.isEnable(),
|
|
224
|
+
};
|
|
225
|
+
exports.cutItemMarkup = {
|
|
226
|
+
exec: (e) => (0, commands_1.wrapToYfmCut)(e.cm),
|
|
227
|
+
isActive: inactive,
|
|
228
|
+
isEnable: enable,
|
|
229
|
+
};
|
|
230
|
+
// ---- Note ----
|
|
231
|
+
exports.noteItemView = {
|
|
232
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
233
|
+
title: menubar_1.i18n.bind(null, 'note'),
|
|
234
|
+
icon: icons_1.icons.note,
|
|
235
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Note),
|
|
236
|
+
};
|
|
237
|
+
exports.noteItemWysiwyg = {
|
|
238
|
+
exec: (e) => e.actions.toYfmNote.run(),
|
|
239
|
+
isActive: (e) => e.actions.toYfmNote.isActive(),
|
|
240
|
+
isEnable: (e) => e.actions.toYfmNote.isEnable(),
|
|
241
|
+
};
|
|
242
|
+
exports.noteItemMarkup = {
|
|
243
|
+
exec: (e) => (0, commands_1.wrapToYfmNote)(e.cm),
|
|
244
|
+
isActive: inactive,
|
|
245
|
+
isEnable: enable,
|
|
246
|
+
};
|
|
247
|
+
// ---- Table ----
|
|
248
|
+
exports.tableItemView = {
|
|
249
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
250
|
+
title: menubar_1.i18n.bind(null, 'table'),
|
|
251
|
+
icon: icons_1.icons.table,
|
|
252
|
+
};
|
|
253
|
+
exports.tableItemWysiwyg = {
|
|
254
|
+
exec: (e) => e.actions.createYfmTable.run(),
|
|
255
|
+
isActive: (e) => e.actions.createYfmTable.isActive(),
|
|
256
|
+
isEnable: (e) => e.actions.createYfmTable.isEnable(),
|
|
257
|
+
};
|
|
258
|
+
exports.tableItemMarkup = {
|
|
259
|
+
exec: (e) => (0, commands_1.insertYfmTable)(e.cm),
|
|
260
|
+
isActive: inactive,
|
|
261
|
+
isEnable: enable,
|
|
262
|
+
};
|
|
263
|
+
// ---- Code ----
|
|
264
|
+
exports.codeItemView = {
|
|
265
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
266
|
+
title: menubar_1.i18n.bind(null, 'code_inline'),
|
|
267
|
+
icon: icons_1.icons.code,
|
|
268
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Code),
|
|
269
|
+
};
|
|
270
|
+
exports.codeItemWysiwyg = {
|
|
271
|
+
exec: (e) => e.actions.code.run(),
|
|
272
|
+
isActive: (e) => e.actions.code.isActive(),
|
|
273
|
+
isEnable: (e) => e.actions.code.isEnable(),
|
|
274
|
+
};
|
|
275
|
+
exports.codeItemMarkup = {
|
|
276
|
+
exec: (e) => (0, commands_1.wrapToInlineCode)(e.cm),
|
|
277
|
+
isActive: inactive,
|
|
278
|
+
isEnable: enable,
|
|
279
|
+
};
|
|
280
|
+
// ---- Image ----
|
|
281
|
+
exports.imageItemView = {
|
|
282
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
283
|
+
title: menubar_1.i18n.bind(null, 'image'),
|
|
284
|
+
icon: icons_1.icons.image,
|
|
285
|
+
};
|
|
286
|
+
exports.imagePopupItemView = {
|
|
287
|
+
type: toolbar_1.ToolbarDataType.ButtonPopup,
|
|
288
|
+
title: menubar_1.i18n.bind(null, 'image'),
|
|
289
|
+
icon: icons_1.icons.image,
|
|
290
|
+
};
|
|
291
|
+
exports.imageItemWysiwyg = {
|
|
292
|
+
exec: (e) => e.actions.addImageWidget.run(),
|
|
293
|
+
isActive: (e) => e.actions.addImageWidget.isActive(),
|
|
294
|
+
isEnable: (e) => e.actions.addImageWidget.isEnable(),
|
|
295
|
+
};
|
|
296
|
+
exports.imageItemMarkup = {
|
|
297
|
+
exec: noop,
|
|
298
|
+
isActive: inactive,
|
|
299
|
+
isEnable: enable,
|
|
300
|
+
renderPopup: (props) => react_1.default.createElement(MToolbarImagePopup_1.MToolbarImagePopup, Object.assign({}, props)),
|
|
301
|
+
};
|
|
302
|
+
// ---- File ----
|
|
303
|
+
exports.fileItemView = {
|
|
304
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
305
|
+
title: menubar_1.i18n.bind(null, 'file'),
|
|
306
|
+
icon: icons_1.icons.file,
|
|
307
|
+
};
|
|
308
|
+
exports.filePopupItemView = {
|
|
309
|
+
type: toolbar_1.ToolbarDataType.ButtonPopup,
|
|
310
|
+
title: menubar_1.i18n.bind(null, 'file'),
|
|
311
|
+
icon: icons_1.icons.file,
|
|
312
|
+
};
|
|
313
|
+
exports.fileItemWysiwyg = {
|
|
314
|
+
exec: (e) => e.actions.addFile.run(),
|
|
315
|
+
isActive: (e) => e.actions.addFile.isActive(),
|
|
316
|
+
isEnable: (e) => e.actions.addFile.isEnable(),
|
|
317
|
+
};
|
|
318
|
+
exports.fileItemMarkup = {
|
|
319
|
+
exec: noop,
|
|
320
|
+
isActive: inactive,
|
|
321
|
+
isEnable: enable,
|
|
322
|
+
renderPopup: (props) => react_1.default.createElement(MToolbarFilePopup_1.MToolbarFilePopup, Object.assign({}, props)),
|
|
323
|
+
};
|
|
324
|
+
// ---- Tabs ----
|
|
325
|
+
exports.tabsItemView = {
|
|
326
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
327
|
+
title: menubar_1.i18n.bind(null, 'tabs'),
|
|
328
|
+
icon: icons_1.icons.tabs,
|
|
329
|
+
};
|
|
330
|
+
exports.tabsItemWysiwyg = {
|
|
331
|
+
exec: (e) => e.actions.toYfmTabs.run(),
|
|
332
|
+
isActive: (e) => e.actions.toYfmTabs.isActive(),
|
|
333
|
+
isEnable: (e) => e.actions.toYfmTabs.isEnable(),
|
|
334
|
+
};
|
|
335
|
+
exports.tabsItemMarkup = {
|
|
336
|
+
exec: (e) => (0, commands_1.insertYfmTabs)(e.cm),
|
|
337
|
+
isActive: inactive,
|
|
338
|
+
isEnable: enable,
|
|
339
|
+
};
|
|
340
|
+
// ---- Math Inline ----
|
|
341
|
+
exports.mathInlineItemView = {
|
|
342
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
343
|
+
title: menubar_1.i18n.bind(null, 'math_inline'),
|
|
344
|
+
icon: icons_1.icons.functionInline,
|
|
345
|
+
hint: () => `${hints_1.i18n.bind(null, 'math_hint')()} ${hints_1.i18n.bind(null, 'math_hint_katex')()}`,
|
|
346
|
+
};
|
|
347
|
+
exports.mathInlineItemWysiwyg = {
|
|
348
|
+
exec: (e) => e.actions.addMathInline.run(),
|
|
349
|
+
isActive: (e) => e.actions.addMathInline.isActive(),
|
|
350
|
+
isEnable: (e) => e.actions.addMathInline.isEnable(),
|
|
351
|
+
};
|
|
352
|
+
exports.mathInlineItemMarkup = {
|
|
353
|
+
exec: (e) => (0, commands_1.wrapToMathInline)(e.cm),
|
|
354
|
+
isActive: inactive,
|
|
355
|
+
isEnable: enable,
|
|
356
|
+
};
|
|
357
|
+
// ---- Math Block ----
|
|
358
|
+
exports.mathBlockItemView = {
|
|
359
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
360
|
+
title: menubar_1.i18n.bind(null, 'math_block'),
|
|
361
|
+
icon: icons_1.icons.functionBlock,
|
|
362
|
+
hint: () => `${hints_1.i18n.bind(null, 'math_hint')()} ${hints_1.i18n.bind(null, 'math_hint_katex')()}`,
|
|
363
|
+
};
|
|
364
|
+
exports.mathBlockItemWysiwyg = {
|
|
365
|
+
exec: (e) => e.actions.toMathBlock.run(),
|
|
366
|
+
isActive: (e) => e.actions.toMathBlock.isActive(),
|
|
367
|
+
isEnable: (e) => e.actions.toMathBlock.isEnable(),
|
|
368
|
+
};
|
|
369
|
+
exports.mathBlockItemMarkup = {
|
|
370
|
+
exec: (e) => (0, commands_1.wrapToMathBlock)(e.cm),
|
|
371
|
+
isActive: inactive,
|
|
372
|
+
isEnable: enable,
|
|
373
|
+
};
|
|
374
|
+
// ---- Yfm Html Block ----
|
|
375
|
+
exports.yfmHtmlBlockItemView = {
|
|
376
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
377
|
+
title: menubar_1.i18n.bind(null, 'html'),
|
|
378
|
+
icon: icons_1.icons.html,
|
|
379
|
+
};
|
|
380
|
+
exports.yfmHtmlBlockItemWysiwyg = {
|
|
381
|
+
exec: (e) => e.actions.createYfmHtmlBlock.run(),
|
|
382
|
+
isActive: (e) => e.actions.createYfmHtmlBlock.isActive(),
|
|
383
|
+
isEnable: (e) => e.actions.createYfmHtmlBlock.isEnable(),
|
|
384
|
+
};
|
|
385
|
+
exports.yfmHtmlBlockItemMarkup = {
|
|
386
|
+
exec: (e) => (0, commands_1.insertYfmHtmlBlock)(e.cm),
|
|
387
|
+
isActive: inactive,
|
|
388
|
+
isEnable: enable,
|
|
389
|
+
};
|
|
390
|
+
// ---- Mermaid ----
|
|
391
|
+
exports.mermaidItemView = {
|
|
392
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
393
|
+
title: menubar_1.i18n.bind(null, 'mermaid'),
|
|
394
|
+
icon: icons_1.icons.mermaid,
|
|
395
|
+
};
|
|
396
|
+
exports.mermaidItemWysiwyg = {
|
|
397
|
+
exec: (e) => e.actions.createMermaid.run(),
|
|
398
|
+
isActive: (e) => e.actions.createMermaid.isActive(),
|
|
399
|
+
isEnable: (e) => e.actions.createMermaid.isEnable(),
|
|
400
|
+
};
|
|
401
|
+
exports.mermaidItemMarkup = {
|
|
402
|
+
exec: (e) => (0, commands_1.insertMermaidDiagram)(e.cm),
|
|
403
|
+
isActive: inactive,
|
|
404
|
+
isEnable: enable,
|
|
405
|
+
};
|
|
406
|
+
// ---- Code Block ----
|
|
407
|
+
exports.codeBlockItemView = {
|
|
408
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
409
|
+
title: menubar_1.i18n.bind(null, 'codeblock'),
|
|
410
|
+
icon: icons_1.icons.codeBlock,
|
|
411
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.CodeBlock),
|
|
412
|
+
};
|
|
413
|
+
exports.codeBlockItemWysiwyg = {
|
|
414
|
+
exec: (e) => e.actions.toCodeBlock.run(),
|
|
415
|
+
isActive: (e) => e.actions.toCodeBlock.isActive(),
|
|
416
|
+
isEnable: (e) => e.actions.toCodeBlock.isEnable(),
|
|
417
|
+
};
|
|
418
|
+
exports.codeBlockItemMarkup = {
|
|
419
|
+
exec: (e) => (0, commands_1.wrapToCodeBlock)(e.cm),
|
|
420
|
+
isActive: inactive,
|
|
421
|
+
isEnable: enable,
|
|
422
|
+
};
|
|
423
|
+
// ---- Horizontal Rule ----
|
|
424
|
+
exports.hruleItemView = {
|
|
425
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
426
|
+
title: menubar_1.i18n.bind(null, 'hrule'),
|
|
427
|
+
icon: icons_1.icons.horizontalRule,
|
|
428
|
+
};
|
|
429
|
+
exports.hruleItemWysiwyg = {
|
|
430
|
+
exec: (e) => e.actions.hRule.run(),
|
|
431
|
+
isActive: (e) => e.actions.hRule.isActive(),
|
|
432
|
+
isEnable: (e) => e.actions.hRule.isEnable(),
|
|
433
|
+
};
|
|
434
|
+
exports.hruleItemMarkup = {
|
|
435
|
+
exec: (e) => (0, commands_1.insertHRule)(e.cm),
|
|
436
|
+
isActive: inactive,
|
|
437
|
+
isEnable: enable,
|
|
438
|
+
};
|
|
439
|
+
// ---- Emoji ----
|
|
440
|
+
exports.emojiItemView = {
|
|
441
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
442
|
+
title: menubar_1.i18n.bind(null, 'emoji'),
|
|
443
|
+
icon: icons_1.icons.emoji,
|
|
444
|
+
};
|
|
445
|
+
exports.emojiItemWysiwyg = {
|
|
446
|
+
exec: (e) => e.actions.openEmojiSuggest.run({}),
|
|
447
|
+
isActive: (e) => e.actions.openEmojiSuggest.isActive(),
|
|
448
|
+
isEnable: (e) => e.actions.openEmojiSuggest.isEnable(),
|
|
449
|
+
};
|
|
450
|
+
exports.emojiItemMarkup = {
|
|
451
|
+
exec: noop,
|
|
452
|
+
hintWhenDisabled: menubar_1.i18n.bind(null, 'emoji__hint'),
|
|
453
|
+
isActive: inactive,
|
|
454
|
+
isEnable: disable,
|
|
455
|
+
};
|
|
456
|
+
// ---- Heading 1 ----
|
|
457
|
+
exports.heading1ItemView = {
|
|
458
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
459
|
+
title: menubar_1.i18n.bind(null, 'heading1'),
|
|
460
|
+
icon: icons_1.icons.h1,
|
|
461
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading1),
|
|
462
|
+
};
|
|
463
|
+
exports.heading1ItemWysiwyg = {
|
|
464
|
+
exec: (e) => e.actions.toH1.run(),
|
|
465
|
+
isActive: (e) => e.actions.toH1.isActive(),
|
|
466
|
+
isEnable: (e) => e.actions.toH1.isEnable(),
|
|
467
|
+
};
|
|
468
|
+
exports.heading1ItemMarkup = {
|
|
469
|
+
exec: (e) => (0, commands_1.toH1)(e.cm),
|
|
470
|
+
isActive: inactive,
|
|
471
|
+
isEnable: enable,
|
|
472
|
+
};
|
|
473
|
+
// ---- Heading 2 ----
|
|
474
|
+
exports.heading2ItemView = {
|
|
475
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
476
|
+
title: menubar_1.i18n.bind(null, 'heading2'),
|
|
477
|
+
icon: icons_1.icons.h2,
|
|
478
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading2),
|
|
479
|
+
};
|
|
480
|
+
exports.heading2ItemWysiwyg = {
|
|
481
|
+
exec: (e) => e.actions.toH2.run(),
|
|
482
|
+
isActive: (e) => e.actions.toH2.isActive(),
|
|
483
|
+
isEnable: (e) => e.actions.toH2.isEnable(),
|
|
484
|
+
};
|
|
485
|
+
exports.heading2ItemMarkup = {
|
|
486
|
+
exec: (e) => (0, commands_1.toH2)(e.cm),
|
|
487
|
+
isActive: inactive,
|
|
488
|
+
isEnable: enable,
|
|
489
|
+
};
|
|
490
|
+
// ---- Heading 3 ----
|
|
491
|
+
exports.heading3ItemView = {
|
|
492
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
493
|
+
title: menubar_1.i18n.bind(null, 'heading3'),
|
|
494
|
+
icon: icons_1.icons.h3,
|
|
495
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading3),
|
|
496
|
+
};
|
|
497
|
+
exports.heading3ItemWysiwyg = {
|
|
498
|
+
exec: (e) => e.actions.toH3.run(),
|
|
499
|
+
isActive: (e) => e.actions.toH3.isActive(),
|
|
500
|
+
isEnable: (e) => e.actions.toH3.isEnable(),
|
|
501
|
+
};
|
|
502
|
+
exports.heading3ItemMarkup = {
|
|
503
|
+
exec: (e) => (0, commands_1.toH3)(e.cm),
|
|
504
|
+
isActive: inactive,
|
|
505
|
+
isEnable: enable,
|
|
506
|
+
};
|
|
507
|
+
// ---- Heading 4 ----
|
|
508
|
+
exports.heading4ItemView = {
|
|
509
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
510
|
+
title: menubar_1.i18n.bind(null, 'heading4'),
|
|
511
|
+
icon: icons_1.icons.h4,
|
|
512
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading4),
|
|
513
|
+
};
|
|
514
|
+
exports.heading4ItemWysiwyg = {
|
|
515
|
+
exec: (e) => e.actions.toH4.run(),
|
|
516
|
+
isActive: (e) => e.actions.toH4.isActive(),
|
|
517
|
+
isEnable: (e) => e.actions.toH4.isEnable(),
|
|
518
|
+
};
|
|
519
|
+
exports.heading4ItemMarkup = {
|
|
520
|
+
exec: (e) => (0, commands_1.toH4)(e.cm),
|
|
521
|
+
isActive: inactive,
|
|
522
|
+
isEnable: enable,
|
|
523
|
+
};
|
|
524
|
+
// ---- Heading 5 ----
|
|
525
|
+
exports.heading5ItemView = {
|
|
526
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
527
|
+
title: menubar_1.i18n.bind(null, 'heading5'),
|
|
528
|
+
icon: icons_1.icons.h5,
|
|
529
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading5),
|
|
530
|
+
};
|
|
531
|
+
exports.heading5ItemWysiwyg = {
|
|
532
|
+
exec: (e) => e.actions.toH5.run(),
|
|
533
|
+
isActive: (e) => e.actions.toH5.isActive(),
|
|
534
|
+
isEnable: (e) => e.actions.toH5.isEnable(),
|
|
535
|
+
};
|
|
536
|
+
exports.heading5ItemMarkup = {
|
|
537
|
+
exec: (e) => (0, commands_1.toH5)(e.cm),
|
|
538
|
+
isActive: inactive,
|
|
539
|
+
isEnable: enable,
|
|
540
|
+
};
|
|
541
|
+
// ---- Heading 6 ----
|
|
542
|
+
exports.heading6ItemView = {
|
|
543
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
544
|
+
title: menubar_1.i18n.bind(null, 'heading6'),
|
|
545
|
+
icon: icons_1.icons.h6,
|
|
546
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading6),
|
|
547
|
+
};
|
|
548
|
+
exports.heading6ItemWysiwyg = {
|
|
549
|
+
exec: (e) => e.actions.toH6.run(),
|
|
550
|
+
isActive: (e) => e.actions.toH6.isActive(),
|
|
551
|
+
isEnable: (e) => e.actions.toH6.isEnable(),
|
|
552
|
+
};
|
|
553
|
+
exports.heading6ItemMarkup = {
|
|
554
|
+
exec: (e) => (0, commands_1.toH6)(e.cm),
|
|
555
|
+
isActive: inactive,
|
|
556
|
+
isEnable: enable,
|
|
557
|
+
};
|
|
558
|
+
// ---- Bullet List ----
|
|
559
|
+
exports.bulletListItemView = {
|
|
560
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
561
|
+
title: menubar_1.i18n.bind(null, 'ulist'),
|
|
562
|
+
icon: icons_1.icons.bulletList,
|
|
563
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.BulletList),
|
|
564
|
+
};
|
|
565
|
+
exports.bulletListItemWysiwyg = {
|
|
566
|
+
exec: (e) => e.actions.toBulletList.run(),
|
|
567
|
+
isActive: (e) => e.actions.toBulletList.isActive(),
|
|
568
|
+
isEnable: (e) => e.actions.toBulletList.isEnable(),
|
|
569
|
+
};
|
|
570
|
+
exports.bulletListItemMarkup = {
|
|
571
|
+
exec: (e) => (0, commands_1.toBulletList)(e.cm),
|
|
572
|
+
isActive: inactive,
|
|
573
|
+
isEnable: enable,
|
|
574
|
+
};
|
|
575
|
+
// ---- Ordered List ----
|
|
576
|
+
exports.orderedListItemView = {
|
|
577
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
578
|
+
title: menubar_1.i18n.bind(null, 'olist'),
|
|
579
|
+
icon: icons_1.icons.orderedList,
|
|
580
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.OrderedList),
|
|
581
|
+
};
|
|
582
|
+
exports.orderedListItemWysiwyg = {
|
|
583
|
+
exec: (e) => e.actions.toOrderedList.run(),
|
|
584
|
+
isActive: (e) => e.actions.toOrderedList.isActive(),
|
|
585
|
+
isEnable: (e) => e.actions.toOrderedList.isEnable(),
|
|
586
|
+
};
|
|
587
|
+
exports.orderedListItemMarkup = {
|
|
588
|
+
exec: (e) => (0, commands_1.toOrderedList)(e.cm),
|
|
589
|
+
isActive: inactive,
|
|
590
|
+
isEnable: enable,
|
|
591
|
+
};
|
|
592
|
+
// ---- Sink List ----
|
|
593
|
+
exports.sinkListItemView = {
|
|
594
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
595
|
+
title: menubar_1.i18n.bind(null, 'list__action_sink'),
|
|
596
|
+
icon: icons_1.icons.sink,
|
|
597
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.SinkListItem),
|
|
598
|
+
};
|
|
599
|
+
exports.sinkListItemWysiwyg = {
|
|
600
|
+
exec: (e) => e.actions.sinkListItem.run(),
|
|
601
|
+
hintWhenDisabled: () => (0, menubar_1.i18n)('list_action_disabled'),
|
|
602
|
+
isActive: (e) => e.actions.sinkListItem.isActive(),
|
|
603
|
+
isEnable: (e) => e.actions.sinkListItem.isEnable(),
|
|
604
|
+
};
|
|
605
|
+
exports.sinkListItemMarkup = {
|
|
606
|
+
exec: (e) => (0, commands_1.sinkListItem)(e.cm),
|
|
607
|
+
isActive: inactive,
|
|
608
|
+
isEnable: enable,
|
|
609
|
+
};
|
|
610
|
+
// ---- Lift List ----
|
|
611
|
+
exports.liftListItemView = {
|
|
612
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
613
|
+
title: menubar_1.i18n.bind(null, 'list__action_lift'),
|
|
614
|
+
icon: icons_1.icons.lift,
|
|
615
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.LiftListItem),
|
|
616
|
+
};
|
|
617
|
+
exports.liftListItemWysiwyg = {
|
|
618
|
+
exec: (e) => e.actions.liftListItem.run(),
|
|
619
|
+
hintWhenDisabled: () => (0, menubar_1.i18n)('list_action_disabled'),
|
|
620
|
+
isActive: (e) => e.actions.liftListItem.isActive(),
|
|
621
|
+
isEnable: (e) => e.actions.liftListItem.isEnable(),
|
|
622
|
+
};
|
|
623
|
+
exports.liftListItemMarkup = {
|
|
624
|
+
exec: (e) => (0, commands_1.liftListItem)(e.cm),
|
|
625
|
+
isActive: inactive,
|
|
626
|
+
isEnable: enable,
|
|
627
|
+
};
|
|
628
|
+
// ---- Toggle Heading Folding ----
|
|
629
|
+
exports.toggleHeadingFoldingItemView = {
|
|
630
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
631
|
+
icon: icons_1.icons.foldingHeading,
|
|
632
|
+
title: () => (0, menubar_1.i18n)('folding-heading'),
|
|
633
|
+
hint: () => (0, menubar_1.i18n)('folding-heading__hint'),
|
|
634
|
+
};
|
|
635
|
+
exports.toggleHeadingFoldingItemWysiwyg = {
|
|
636
|
+
isActive: (editor) => { var _a, _b; return (_b = (_a = editor.actions.toggleHeadingFolding) === null || _a === void 0 ? void 0 : _a.isActive()) !== null && _b !== void 0 ? _b : false; },
|
|
637
|
+
isEnable: (editor) => { var _a, _b; return (_b = (_a = editor.actions.toggleHeadingFolding) === null || _a === void 0 ? void 0 : _a.isEnable()) !== null && _b !== void 0 ? _b : false; },
|
|
638
|
+
exec: (editor) => editor.actions.toggleHeadingFolding.run(),
|
|
639
|
+
condition: 'enabled',
|
|
640
|
+
};
|
|
641
|
+
// ---- Text Context ----
|
|
642
|
+
exports.textContextItemView = {
|
|
643
|
+
type: toolbar_1.ToolbarDataType.ReactComponent,
|
|
644
|
+
};
|
|
645
|
+
exports.textContextItemWisywig = {
|
|
646
|
+
component: WToolbarTextSelect_1.WToolbarTextSelect,
|
|
647
|
+
width: 0,
|
|
648
|
+
condition: ({ selection: { $from, $to }, schema }) => {
|
|
649
|
+
if (!$from.sameParent($to))
|
|
650
|
+
return false;
|
|
651
|
+
const { parent } = $from;
|
|
652
|
+
return parent.type === (0, extensions_1.pType)(schema) || parent.type === (0, extensions_1.headingType)(schema);
|
|
653
|
+
},
|
|
654
|
+
};
|
|
655
|
+
// ---- Paragraph ----
|
|
656
|
+
exports.paragraphItemView = {
|
|
657
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
658
|
+
title: menubar_1.i18n.bind(null, 'text'),
|
|
659
|
+
icon: icons_1.icons.text,
|
|
660
|
+
hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Text),
|
|
661
|
+
doNotActivateList: true,
|
|
662
|
+
};
|
|
663
|
+
exports.paragraphItemWisywig = {
|
|
664
|
+
exec: (e) => e.actions.toParagraph.run(),
|
|
665
|
+
isActive: (e) => e.actions.toParagraph.isActive(),
|
|
666
|
+
isEnable: (e) => e.actions.toParagraph.isEnable(),
|
|
667
|
+
};
|
|
668
|
+
exports.paragraphItemMarkup = {
|
|
669
|
+
exec: noop,
|
|
670
|
+
isActive: inactive,
|
|
671
|
+
isEnable: enable,
|
|
672
|
+
};
|
|
673
|
+
// --- Colorify ----
|
|
674
|
+
exports.colorifyItemView = {
|
|
675
|
+
type: toolbar_1.ToolbarDataType.ReactComponent,
|
|
676
|
+
};
|
|
677
|
+
exports.colorifyItemWysiwyg = {
|
|
678
|
+
component: WToolbarColors_1.WToolbarColors,
|
|
679
|
+
width: 42,
|
|
680
|
+
};
|
|
681
|
+
exports.colorifyItemMarkup = {
|
|
682
|
+
component: MToolbarColors_1.MToolbarColors,
|
|
683
|
+
width: 42,
|
|
684
|
+
};
|
|
685
|
+
// ---- GPT ----
|
|
686
|
+
exports.gptItemView = {
|
|
687
|
+
type: toolbar_1.ToolbarDataType.SingleButton,
|
|
688
|
+
title: menubar_1.i18n.bind(null, 'gpt'),
|
|
689
|
+
hotkey: constants_1.gptHotKeys.openGptKeyTooltip,
|
|
690
|
+
icon: icons_1.icons.gpt,
|
|
691
|
+
};
|
|
692
|
+
exports.gptItemWysiwyg = {
|
|
693
|
+
exec: (e) => e.actions.addGptWidget.run({}),
|
|
694
|
+
isActive: (e) => e.actions.addGptWidget.isActive(),
|
|
695
|
+
isEnable: (e) => e.actions.addGptWidget.isEnable(),
|
|
696
|
+
};
|
|
697
|
+
exports.gptItemMarkup = {
|
|
698
|
+
exec: (e) => (0, commands_1.insertMermaidDiagram)(e.cm),
|
|
699
|
+
isActive: inactive,
|
|
700
|
+
isEnable: enable,
|
|
701
|
+
};
|
|
702
|
+
// ---- Heading list ----
|
|
703
|
+
exports.headingListItemView = {
|
|
704
|
+
type: toolbar_1.ToolbarDataType.ListButton,
|
|
705
|
+
icon: icons_1.icons.headline,
|
|
706
|
+
title: menubar_1.i18n.bind(null, 'heading'),
|
|
707
|
+
withArrow: true,
|
|
708
|
+
};
|
|
709
|
+
// ---- Lists list ----
|
|
710
|
+
exports.listsListItemView = {
|
|
711
|
+
type: toolbar_1.ToolbarDataType.ListButton,
|
|
712
|
+
icon: icons_1.icons.bulletList,
|
|
713
|
+
withArrow: true,
|
|
714
|
+
title: menubar_1.i18n.bind(null, 'list'),
|
|
715
|
+
};
|
|
716
|
+
// ---- Move list ----
|
|
717
|
+
exports.moveListItemView = {
|
|
718
|
+
type: toolbar_1.ToolbarDataType.ListButton,
|
|
719
|
+
icon: icons_1.icons.lift,
|
|
720
|
+
withArrow: true,
|
|
721
|
+
title: menubar_1.i18n.bind(null, 'move_list'),
|
|
722
|
+
};
|
|
723
|
+
// ---- Code list ----
|
|
724
|
+
exports.codeBlocksListItemView = {
|
|
725
|
+
type: toolbar_1.ToolbarDataType.ListButton,
|
|
726
|
+
icon: icons_1.icons.code,
|
|
727
|
+
title: menubar_1.i18n.bind(null, 'code'),
|
|
728
|
+
withArrow: true,
|
|
729
|
+
};
|
|
730
|
+
// ---- Math list ----
|
|
731
|
+
exports.mathListItemView = {
|
|
732
|
+
type: toolbar_1.ToolbarDataType.ListButton,
|
|
733
|
+
icon: icons_1.icons.functionInline,
|
|
734
|
+
withArrow: true,
|
|
735
|
+
title: menubar_1.i18n.bind(null, 'math'),
|
|
736
|
+
};
|