@atlaskit/editor-plugin-insert-block 0.1.1 → 0.2.1
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/.eslintrc.js +26 -0
- package/CHANGELOG.md +12 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/plugin.js +164 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +169 -0
- package/dist/cjs/ui/ElementBrowser/types.js +5 -0
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-element-browser.js +42 -0
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +42 -0
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +66 -0
- package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +217 -0
- package/dist/cjs/ui/ToolbarInsertBlock/dropdown-button.js +52 -0
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +570 -0
- package/dist/cjs/ui/ToolbarInsertBlock/item.js +252 -0
- package/dist/cjs/ui/ToolbarInsertBlock/messages.js +12 -0
- package/dist/cjs/ui/ToolbarInsertBlock/shallow-equals.js +20 -0
- package/dist/cjs/ui/ToolbarInsertBlock/sort-items.js +30 -0
- package/dist/cjs/ui/ToolbarInsertBlock/styles.js +11 -0
- package/dist/cjs/ui/ToolbarInsertBlock/types.js +5 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugin.js +158 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +156 -0
- package/dist/es2019/ui/ElementBrowser/types.js +1 -0
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-element-browser.js +35 -0
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +35 -0
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +59 -0
- package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +198 -0
- package/dist/es2019/ui/ToolbarInsertBlock/dropdown-button.js +39 -0
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +562 -0
- package/dist/es2019/ui/ToolbarInsertBlock/item.js +202 -0
- package/dist/es2019/ui/ToolbarInsertBlock/messages.js +1 -0
- package/dist/es2019/ui/ToolbarInsertBlock/shallow-equals.js +8 -0
- package/dist/es2019/ui/ToolbarInsertBlock/sort-items.js +22 -0
- package/dist/es2019/ui/ToolbarInsertBlock/styles.js +16 -0
- package/dist/es2019/ui/ToolbarInsertBlock/types.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugin.js +157 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +163 -0
- package/dist/esm/ui/ElementBrowser/types.js +1 -0
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-element-browser.js +35 -0
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +35 -0
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +59 -0
- package/dist/esm/ui/ToolbarInsertBlock/create-items.js +210 -0
- package/dist/esm/ui/ToolbarInsertBlock/dropdown-button.js +44 -0
- package/dist/esm/ui/ToolbarInsertBlock/index.js +564 -0
- package/dist/esm/ui/ToolbarInsertBlock/item.js +244 -0
- package/dist/esm/ui/ToolbarInsertBlock/messages.js +1 -0
- package/dist/esm/ui/ToolbarInsertBlock/shallow-equals.js +13 -0
- package/dist/esm/ui/ToolbarInsertBlock/sort-items.js +24 -0
- package/dist/esm/ui/ToolbarInsertBlock/styles.js +4 -0
- package/dist/esm/ui/ToolbarInsertBlock/types.js +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/plugin.d.ts +16 -0
- package/dist/types/types.d.ts +45 -0
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +4 -0
- package/dist/types/ui/ElementBrowser/types.d.ts +22 -0
- package/dist/types/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +28 -0
- package/dist/types/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +21 -0
- package/dist/types/ui/ToolbarInsertBlock/block-insert-menu.d.ts +33 -0
- package/dist/types/ui/ToolbarInsertBlock/create-items.d.ts +39 -0
- package/dist/types/ui/ToolbarInsertBlock/dropdown-button.d.ts +16 -0
- package/dist/types/ui/ToolbarInsertBlock/index.d.ts +46 -0
- package/dist/types/ui/ToolbarInsertBlock/item.d.ts +35 -0
- package/dist/types/ui/ToolbarInsertBlock/messages.d.ts +1 -0
- package/dist/types/ui/ToolbarInsertBlock/shallow-equals.d.ts +1 -0
- package/dist/types/ui/ToolbarInsertBlock/sort-items.d.ts +2 -0
- package/dist/types/ui/ToolbarInsertBlock/styles.d.ts +1 -0
- package/dist/types/ui/ToolbarInsertBlock/types.d.ts +59 -0
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/plugin.d.ts +16 -0
- package/dist/types-ts4.5/types.d.ts +45 -0
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +4 -0
- package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +22 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +28 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +21 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu.d.ts +33 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/create-items.d.ts +42 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/dropdown-button.d.ts +16 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/index.d.ts +46 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/item.d.ts +35 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/messages.d.ts +1 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/shallow-equals.d.ts +1 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/sort-items.d.ts +2 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/styles.d.ts +1 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/types.d.ts +59 -0
- package/package.json +37 -9
- package/report.api.md +82 -1
- package/tmp/api-report-tmp.d.ts +0 -9
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import memoizeOne from 'memoize-one';
|
|
5
|
+
import { addLink, getAriaKeyshortcuts, toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
|
+
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
7
|
+
import ExpandNodeIcon from '@atlaskit/icon/glyph/chevron-right-circle';
|
|
8
|
+
import CodeIcon from '@atlaskit/icon/glyph/editor/code';
|
|
9
|
+
import DateIcon from '@atlaskit/icon/glyph/editor/date';
|
|
10
|
+
import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
|
|
11
|
+
import EmojiIcon from '@atlaskit/icon/glyph/editor/emoji';
|
|
12
|
+
import HorizontalRuleIcon from '@atlaskit/icon/glyph/editor/horizontal-rule';
|
|
13
|
+
import EditorImageIcon from '@atlaskit/icon/glyph/editor/image';
|
|
14
|
+
import InfoIcon from '@atlaskit/icon/glyph/editor/info';
|
|
15
|
+
import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
|
|
16
|
+
import LinkIcon from '@atlaskit/icon/glyph/editor/link';
|
|
17
|
+
import MentionIcon from '@atlaskit/icon/glyph/editor/mention';
|
|
18
|
+
import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
|
|
19
|
+
import TableIcon from '@atlaskit/icon/glyph/editor/table';
|
|
20
|
+
import TaskIcon from '@atlaskit/icon/glyph/editor/task';
|
|
21
|
+
import PlaceholderTextIcon from '@atlaskit/icon/glyph/media-services/text';
|
|
22
|
+
import QuoteIcon from '@atlaskit/icon/glyph/quote';
|
|
23
|
+
import StatusIcon from '@atlaskit/icon/glyph/status';
|
|
24
|
+
import { shallowEquals } from './shallow-equals';
|
|
25
|
+
var from = function from(init) {
|
|
26
|
+
return {
|
|
27
|
+
content: init.content,
|
|
28
|
+
tooltipDescription: init.tooltipDescription,
|
|
29
|
+
value: {
|
|
30
|
+
name: init.name
|
|
31
|
+
},
|
|
32
|
+
elemBefore: jsx(init.Icon, {
|
|
33
|
+
label: init.content
|
|
34
|
+
}),
|
|
35
|
+
elemAfter: init.shortcut ?
|
|
36
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
37
|
+
jsx("div", {
|
|
38
|
+
css: shortcutStyle
|
|
39
|
+
}, init.shortcut) : undefined,
|
|
40
|
+
'aria-label': init.shortcut ? init.content + ' ' + init.shortcut : init.content,
|
|
41
|
+
'aria-haspopup': init['aria-haspopup'],
|
|
42
|
+
'aria-keyshortcuts': init['aria-keyshortcuts'],
|
|
43
|
+
shortcut: init.shortcut,
|
|
44
|
+
isDisabled: init.disabled
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var mem = function mem(fn) {
|
|
48
|
+
return memoizeOne(fn, shallowEquals);
|
|
49
|
+
};
|
|
50
|
+
export var action = mem(function (init) {
|
|
51
|
+
return from({
|
|
52
|
+
content: init.content,
|
|
53
|
+
tooltipDescription: init.tooltipDescription,
|
|
54
|
+
disabled: init.disabled,
|
|
55
|
+
name: 'action',
|
|
56
|
+
shortcut: '[]',
|
|
57
|
+
Icon: TaskIcon,
|
|
58
|
+
'aria-keyshortcuts': '[ ] Space'
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
export var link = mem(function (init) {
|
|
62
|
+
return from({
|
|
63
|
+
content: init.content,
|
|
64
|
+
tooltipDescription: init.tooltipDescription,
|
|
65
|
+
disabled: init.disabled,
|
|
66
|
+
name: 'link',
|
|
67
|
+
shortcut: tooltip(addLink),
|
|
68
|
+
Icon: LinkIcon,
|
|
69
|
+
'aria-haspopup': init['aria-haspopup'],
|
|
70
|
+
'aria-keyshortcuts': getAriaKeyshortcuts(addLink)
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
export var media = mem(function (init) {
|
|
74
|
+
return from({
|
|
75
|
+
content: init.content,
|
|
76
|
+
tooltipDescription: init.tooltipDescription,
|
|
77
|
+
disabled: init.disabled,
|
|
78
|
+
name: 'media',
|
|
79
|
+
Icon: EditorImageIcon
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
export var imageUpload = mem(function (init) {
|
|
83
|
+
return from({
|
|
84
|
+
content: init.content,
|
|
85
|
+
tooltipDescription: init.tooltipDescription,
|
|
86
|
+
disabled: init.disabled,
|
|
87
|
+
name: 'image upload',
|
|
88
|
+
Icon: EditorImageIcon
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
export var mention = mem(function (init) {
|
|
92
|
+
return from({
|
|
93
|
+
content: init.content,
|
|
94
|
+
tooltipDescription: init.tooltipDescription,
|
|
95
|
+
disabled: init.disabled,
|
|
96
|
+
name: 'mention',
|
|
97
|
+
Icon: MentionIcon,
|
|
98
|
+
shortcut: '@',
|
|
99
|
+
'aria-haspopup': init['aria-haspopup'],
|
|
100
|
+
'aria-keyshortcuts': 'Shift+2 Space'
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
export var emoji = mem(function (init) {
|
|
104
|
+
return from({
|
|
105
|
+
content: init.content,
|
|
106
|
+
tooltipDescription: init.tooltipDescription,
|
|
107
|
+
disabled: init.disabled,
|
|
108
|
+
name: 'emoji',
|
|
109
|
+
Icon: EmojiIcon,
|
|
110
|
+
shortcut: ':',
|
|
111
|
+
'aria-haspopup': init['aria-haspopup'],
|
|
112
|
+
'aria-keyshortcuts': 'Shift+;'
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
export var table = mem(function (init) {
|
|
116
|
+
return from({
|
|
117
|
+
content: init.content,
|
|
118
|
+
tooltipDescription: init.tooltipDescription,
|
|
119
|
+
disabled: init.disabled,
|
|
120
|
+
name: 'table',
|
|
121
|
+
Icon: TableIcon,
|
|
122
|
+
shortcut: tooltip(toggleTable),
|
|
123
|
+
'aria-keyshortcuts': getAriaKeyshortcuts(toggleTable)
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
export var layout = mem(function (init) {
|
|
127
|
+
return from({
|
|
128
|
+
content: init.content,
|
|
129
|
+
tooltipDescription: init.tooltipDescription,
|
|
130
|
+
disabled: init.disabled,
|
|
131
|
+
name: 'layout',
|
|
132
|
+
Icon: LayoutTwoEqualIcon
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
export var codeblock = mem(function (init) {
|
|
136
|
+
return from({
|
|
137
|
+
content: init.content,
|
|
138
|
+
tooltipDescription: init.tooltipDescription,
|
|
139
|
+
disabled: init.disabled,
|
|
140
|
+
name: 'codeblock',
|
|
141
|
+
Icon: CodeIcon,
|
|
142
|
+
shortcut: init.shortcut,
|
|
143
|
+
'aria-keyshortcuts': getAriaKeyshortcuts(init.shortcut)
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
export var panel = mem(function (init) {
|
|
147
|
+
return from({
|
|
148
|
+
content: init.content,
|
|
149
|
+
tooltipDescription: init.tooltipDescription,
|
|
150
|
+
disabled: init.disabled,
|
|
151
|
+
name: 'panel',
|
|
152
|
+
Icon: InfoIcon,
|
|
153
|
+
shortcut: init.shortcut,
|
|
154
|
+
'aria-keyshortcuts': getAriaKeyshortcuts(init.shortcut)
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
export var blockquote = mem(function (init) {
|
|
158
|
+
return from({
|
|
159
|
+
content: init.content,
|
|
160
|
+
tooltipDescription: init.tooltipDescription,
|
|
161
|
+
disabled: init.disabled,
|
|
162
|
+
name: 'blockquote',
|
|
163
|
+
Icon: QuoteIcon,
|
|
164
|
+
shortcut: init.shortcut,
|
|
165
|
+
'aria-keyshortcuts': 'Shift+. Space'
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
export var decision = mem(function (init) {
|
|
169
|
+
return from({
|
|
170
|
+
content: init.content,
|
|
171
|
+
tooltipDescription: init.tooltipDescription,
|
|
172
|
+
disabled: init.disabled,
|
|
173
|
+
name: 'decision',
|
|
174
|
+
Icon: DecisionIcon,
|
|
175
|
+
shortcut: '<>',
|
|
176
|
+
'aria-keyshortcuts': 'Shift+, Shift+. Space'
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
export var horizontalrule = mem(function (init) {
|
|
180
|
+
return from({
|
|
181
|
+
content: init.content,
|
|
182
|
+
tooltipDescription: init.tooltipDescription,
|
|
183
|
+
disabled: init.disabled,
|
|
184
|
+
name: 'horizontalrule',
|
|
185
|
+
Icon: HorizontalRuleIcon,
|
|
186
|
+
shortcut: '---',
|
|
187
|
+
'aria-keyshortcuts': '- - -'
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
export var expand = mem(function (init) {
|
|
191
|
+
return from({
|
|
192
|
+
content: init.content,
|
|
193
|
+
tooltipDescription: init.tooltipDescription,
|
|
194
|
+
disabled: init.disabled,
|
|
195
|
+
name: 'expand',
|
|
196
|
+
Icon: ExpandNodeIcon
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
export var date = mem(function (init) {
|
|
200
|
+
return from({
|
|
201
|
+
content: init.content,
|
|
202
|
+
tooltipDescription: init.tooltipDescription,
|
|
203
|
+
disabled: init.disabled,
|
|
204
|
+
name: 'date',
|
|
205
|
+
Icon: DateIcon,
|
|
206
|
+
shortcut: '//',
|
|
207
|
+
'aria-keyshortcuts': '/ / Enter'
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
export var placeholder = mem(function (init) {
|
|
211
|
+
return from({
|
|
212
|
+
content: init.content,
|
|
213
|
+
tooltipDescription: init.tooltipDescription,
|
|
214
|
+
disabled: init.disabled,
|
|
215
|
+
name: 'placeholder text',
|
|
216
|
+
Icon: function Icon() {
|
|
217
|
+
return jsx(PlaceholderTextIcon, {
|
|
218
|
+
label: ""
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
export var status = mem(function (init) {
|
|
224
|
+
return from({
|
|
225
|
+
content: init.content,
|
|
226
|
+
tooltipDescription: init.tooltipDescription,
|
|
227
|
+
disabled: init.disabled,
|
|
228
|
+
name: 'status',
|
|
229
|
+
Icon: StatusIcon
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
export var more = mem(function (init) {
|
|
233
|
+
return from({
|
|
234
|
+
content: init.content,
|
|
235
|
+
tooltipDescription: init.tooltipDescription,
|
|
236
|
+
disabled: init.disabled,
|
|
237
|
+
name: 'macro',
|
|
238
|
+
Icon: function Icon() {
|
|
239
|
+
return jsx(EditorMoreIcon, {
|
|
240
|
+
label: ""
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
export var shallowEquals = function shallowEquals(_ref, _ref2) {
|
|
3
|
+
var _ref3 = _slicedToArray(_ref, 1),
|
|
4
|
+
aRaw = _ref3[0];
|
|
5
|
+
var _ref4 = _slicedToArray(_ref2, 1),
|
|
6
|
+
bRaw = _ref4[0];
|
|
7
|
+
var a = aRaw;
|
|
8
|
+
var b = bRaw;
|
|
9
|
+
return !Object.keys(a).some(function (key) {
|
|
10
|
+
var k = key;
|
|
11
|
+
return a[k] !== b[k];
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var endPositionNames = ['macro-browser', 'slash-onboarding'];
|
|
2
|
+
var isMacro = function isMacro(item) {
|
|
3
|
+
return typeof item.content === 'string' && item.content.includes('macro');
|
|
4
|
+
};
|
|
5
|
+
export var sortItems = function sortItems(items) {
|
|
6
|
+
return items.sort(function (a, b) {
|
|
7
|
+
if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
|
|
8
|
+
return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
|
|
9
|
+
}
|
|
10
|
+
if (endPositionNames.includes(b.value.name)) {
|
|
11
|
+
return -1;
|
|
12
|
+
}
|
|
13
|
+
if (endPositionNames.includes(a.value.name)) {
|
|
14
|
+
return 1;
|
|
15
|
+
}
|
|
16
|
+
if (isMacro(a) && !isMacro(b)) {
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
if (isMacro(b) && !isMacro(a)) {
|
|
20
|
+
return -1;
|
|
21
|
+
}
|
|
22
|
+
return a.content < b.content ? -1 : 1;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
export var triggerWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 42px;\n\n display: flex;\n align-items: center;\n\n > div,\n > span {\n display: flex;\n }\n\n > div > div {\n display: flex;\n }\n"])));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { insertBlockPlugin } from './plugin';
|
|
2
|
+
export type { InsertBlockPlugin } from './plugin';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { InsertBlockPluginDependencies } from './types';
|
|
3
|
+
export interface InsertBlockOptions {
|
|
4
|
+
allowTables?: boolean;
|
|
5
|
+
allowExpand?: boolean;
|
|
6
|
+
insertMenuItems?: any;
|
|
7
|
+
horizontalRuleEnabled?: boolean;
|
|
8
|
+
nativeStatusSupported?: boolean;
|
|
9
|
+
replacePlusMenuWithElementBrowser?: boolean;
|
|
10
|
+
showElementBrowserLink?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type InsertBlockPlugin = NextEditorPlugin<'insertBlock', {
|
|
13
|
+
pluginConfiguration: InsertBlockOptions | undefined;
|
|
14
|
+
dependencies: InsertBlockPluginDependencies;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const insertBlockPlugin: InsertBlockPlugin;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { BlockTypePlugin } from '@atlaskit/editor-plugin-block-type';
|
|
4
|
+
import type { CodeBlockPlugin } from '@atlaskit/editor-plugin-code-block';
|
|
5
|
+
import type { DatePlugin } from '@atlaskit/editor-plugin-date';
|
|
6
|
+
import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
7
|
+
import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
|
|
8
|
+
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
9
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
10
|
+
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
11
|
+
import type { ImageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
|
|
12
|
+
import type { LayoutPlugin } from '@atlaskit/editor-plugin-layout';
|
|
13
|
+
import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
14
|
+
import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
15
|
+
import type { PanelPlugin } from '@atlaskit/editor-plugin-panel';
|
|
16
|
+
import type { PlaceholderTextPlugin } from '@atlaskit/editor-plugin-placeholder-text';
|
|
17
|
+
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
18
|
+
import type { RulePlugin } from '@atlaskit/editor-plugin-rule';
|
|
19
|
+
import type { StatusPlugin } from '@atlaskit/editor-plugin-status';
|
|
20
|
+
import type { TablePlugin } from '@atlaskit/editor-plugin-table';
|
|
21
|
+
import type { TasksAndDecisionsPlugin } from '@atlaskit/editor-plugin-tasks-and-decisions';
|
|
22
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
23
|
+
export type InsertBlockPluginDependencies = [
|
|
24
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
25
|
+
TypeAheadPlugin,
|
|
26
|
+
OptionalPlugin<TablePlugin>,
|
|
27
|
+
OptionalPlugin<HyperlinkPlugin>,
|
|
28
|
+
OptionalPlugin<DatePlugin>,
|
|
29
|
+
OptionalPlugin<BlockTypePlugin>,
|
|
30
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
31
|
+
OptionalPlugin<ImageUploadPlugin>,
|
|
32
|
+
OptionalPlugin<EmojiPlugin>,
|
|
33
|
+
OptionalPlugin<QuickInsertPlugin>,
|
|
34
|
+
OptionalPlugin<RulePlugin>,
|
|
35
|
+
OptionalPlugin<CodeBlockPlugin>,
|
|
36
|
+
OptionalPlugin<PanelPlugin>,
|
|
37
|
+
OptionalPlugin<MediaPlugin>,
|
|
38
|
+
OptionalPlugin<MentionsPlugin>,
|
|
39
|
+
OptionalPlugin<StatusPlugin>,
|
|
40
|
+
OptionalPlugin<LayoutPlugin>,
|
|
41
|
+
OptionalPlugin<ExpandPlugin>,
|
|
42
|
+
OptionalPlugin<PlaceholderTextPlugin>,
|
|
43
|
+
OptionalPlugin<ExtensionPlugin>,
|
|
44
|
+
OptionalPlugin<TasksAndDecisionsPlugin>
|
|
45
|
+
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { InsertMenuProps } from './types';
|
|
3
|
+
declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
|
|
4
|
+
export default InsertMenu;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PluginInjectionAPIWithDependencies } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { InsertBlockPluginDependencies } from '../../types';
|
|
6
|
+
import type { BlockMenuItem } from '../ToolbarInsertBlock/create-items';
|
|
7
|
+
type SimpleEventHandler<T> = (event?: T) => void;
|
|
8
|
+
export interface InsertMenuProps {
|
|
9
|
+
dropdownItems: BlockMenuItem[];
|
|
10
|
+
editorView: EditorView;
|
|
11
|
+
showElementBrowserLink: boolean;
|
|
12
|
+
toggleVisiblity: SimpleEventHandler<MouseEvent | KeyboardEvent>;
|
|
13
|
+
onInsert: OnInsert;
|
|
14
|
+
pluginInjectionApi: PluginInjectionAPIWithDependencies<InsertBlockPluginDependencies> | undefined;
|
|
15
|
+
}
|
|
16
|
+
export type SvgGetterParams = {
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
export type OnInsert = ({ item }: {
|
|
20
|
+
item: MenuItem;
|
|
21
|
+
}) => Transaction;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PluginInjectionAPIWithDependencies } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { InsertBlockPluginDependencies } from '../../types';
|
|
5
|
+
import type { OnInsert } from '../ElementBrowser/types';
|
|
6
|
+
import type { BlockMenuItem } from './create-items';
|
|
7
|
+
type SimpleEventHandler<T> = (event?: T) => void;
|
|
8
|
+
export interface BlockInsertElementBrowserProps {
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
editorView: EditorView;
|
|
11
|
+
items: BlockMenuItem[];
|
|
12
|
+
spacing: 'none' | 'default';
|
|
13
|
+
label: string;
|
|
14
|
+
open: boolean;
|
|
15
|
+
popupsBoundariesElement?: HTMLElement;
|
|
16
|
+
popupsMountPoint?: HTMLElement;
|
|
17
|
+
popupsScrollableElement?: HTMLElement;
|
|
18
|
+
plusButtonRef?: HTMLElement;
|
|
19
|
+
showElementBrowserLink: boolean;
|
|
20
|
+
onRef(el: HTMLElement): void;
|
|
21
|
+
onClick: React.MouseEventHandler;
|
|
22
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
23
|
+
onInsert: OnInsert;
|
|
24
|
+
togglePlusMenuVisibility: SimpleEventHandler<MouseEvent | KeyboardEvent>;
|
|
25
|
+
pluginInjectionApi: PluginInjectionAPIWithDependencies<InsertBlockPluginDependencies> | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare const BlockInsertElementBrowser: (props: BlockInsertElementBrowserProps) => JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
+
import type { BlockMenuItem } from './create-items';
|
|
4
|
+
export interface BlockInsertMenuLegacyProps {
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
spacing: 'none' | 'default';
|
|
7
|
+
label: string;
|
|
8
|
+
open: boolean;
|
|
9
|
+
items: BlockMenuItem[];
|
|
10
|
+
popupsMountPoint?: HTMLElement;
|
|
11
|
+
popupsBoundariesElement?: HTMLElement;
|
|
12
|
+
popupsScrollableElement?: HTMLElement;
|
|
13
|
+
onClick: React.MouseEventHandler;
|
|
14
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
15
|
+
onRef(el: HTMLElement): void;
|
|
16
|
+
onItemActivated(attrs: {
|
|
17
|
+
item: MenuItem;
|
|
18
|
+
}): void;
|
|
19
|
+
onOpenChange(attrs: any): void;
|
|
20
|
+
}
|
|
21
|
+
export declare const BlockInsertMenuLegacy: (props: BlockInsertMenuLegacyProps) => JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PluginInjectionAPIWithDependencies } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { InsertBlockPluginDependencies } from '../../types';
|
|
6
|
+
import type { OnInsert } from '../ElementBrowser/types';
|
|
7
|
+
import type { BlockMenuItem } from './create-items';
|
|
8
|
+
export interface BlockInsertMenuProps {
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
editorView: EditorView;
|
|
11
|
+
items: BlockMenuItem[];
|
|
12
|
+
label: string;
|
|
13
|
+
open: boolean;
|
|
14
|
+
plusButtonRef?: HTMLElement;
|
|
15
|
+
popupsBoundariesElement?: HTMLElement;
|
|
16
|
+
popupsMountPoint?: HTMLElement;
|
|
17
|
+
popupsScrollableElement?: HTMLElement;
|
|
18
|
+
replacePlusMenuWithElementBrowser: boolean;
|
|
19
|
+
spacing: 'none' | 'default';
|
|
20
|
+
showElementBrowserLink: boolean;
|
|
21
|
+
onRef(el: HTMLElement): void;
|
|
22
|
+
onPlusButtonRef(el: HTMLElement): void;
|
|
23
|
+
onClick: React.MouseEventHandler;
|
|
24
|
+
onItemActivated(attrs: {
|
|
25
|
+
item: MenuItem;
|
|
26
|
+
}): void;
|
|
27
|
+
onInsert: OnInsert;
|
|
28
|
+
onOpenChange(attrs: any): void;
|
|
29
|
+
togglePlusMenuVisibility(): void;
|
|
30
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
31
|
+
pluginInjectionApi: PluginInjectionAPIWithDependencies<InsertBlockPluginDependencies> | undefined;
|
|
32
|
+
}
|
|
33
|
+
export declare const BlockInsertMenu: (props: BlockInsertMenuProps) => JSX.Element | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
+
import type { BlockType } from '@atlaskit/editor-plugin-block-type';
|
|
5
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import type { EmojiProvider } from '@atlaskit/emoji/resource';
|
|
7
|
+
export interface CreateItemsConfig {
|
|
8
|
+
isTypeAheadAllowed?: boolean;
|
|
9
|
+
tableSupported?: boolean;
|
|
10
|
+
mediaUploadsEnabled?: boolean;
|
|
11
|
+
mediaSupported?: boolean;
|
|
12
|
+
imageUploadSupported?: boolean;
|
|
13
|
+
imageUploadEnabled?: boolean;
|
|
14
|
+
mentionsSupported?: boolean;
|
|
15
|
+
mentionsDisabled?: boolean;
|
|
16
|
+
availableWrapperBlockTypes?: BlockType[];
|
|
17
|
+
actionSupported?: boolean;
|
|
18
|
+
decisionSupported?: boolean;
|
|
19
|
+
linkSupported?: boolean;
|
|
20
|
+
linkDisabled?: boolean;
|
|
21
|
+
emojiDisabled?: boolean;
|
|
22
|
+
nativeStatusSupported?: boolean;
|
|
23
|
+
dateEnabled?: boolean;
|
|
24
|
+
placeholderTextEnabled?: boolean;
|
|
25
|
+
horizontalRuleEnabled?: boolean;
|
|
26
|
+
layoutSectionEnabled?: boolean;
|
|
27
|
+
showElementBrowserLink?: boolean;
|
|
28
|
+
expandEnabled?: boolean;
|
|
29
|
+
insertMenuItems?: MenuItem[];
|
|
30
|
+
emojiProvider?: Promise<EmojiProvider>;
|
|
31
|
+
schema: Schema;
|
|
32
|
+
numberOfButtons: number;
|
|
33
|
+
formatMessage: WrappedComponentProps['intl']['formatMessage'];
|
|
34
|
+
isNewMenuEnabled?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface BlockMenuItem extends MenuItem {
|
|
37
|
+
title: JSX.Element | null;
|
|
38
|
+
}
|
|
39
|
+
export declare const createItems: import("memoize-one").MemoizedFn<(config: CreateItemsConfig) => readonly [BlockMenuItem[], BlockMenuItem[]]>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ToolbarButtonRef } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
+
export interface DropDownButtonProps {
|
|
5
|
+
label: string;
|
|
6
|
+
selected: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
'aria-expanded': React.AriaAttributes['aria-expanded'];
|
|
9
|
+
'aria-haspopup': React.AriaAttributes['aria-haspopup'];
|
|
10
|
+
'aria-keyshortcuts'?: React.AriaAttributes['aria-keyshortcuts'];
|
|
11
|
+
onClick: React.MouseEventHandler;
|
|
12
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
13
|
+
spacing: 'none' | 'default';
|
|
14
|
+
handleRef(el: ToolbarButtonRef): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const DropDownButton: React.StatelessComponent<DropDownButtonProps>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
5
|
+
import type { Props, State } from './types';
|
|
6
|
+
export declare class ToolbarInsertBlock extends React.PureComponent<Props & WrappedComponentProps, State> {
|
|
7
|
+
private dropdownButtonRef?;
|
|
8
|
+
private emojiButtonRef?;
|
|
9
|
+
private plusButtonRef?;
|
|
10
|
+
state: State;
|
|
11
|
+
static getDerivedStateFromProps(props: Props & WrappedComponentProps, state: State): State | null;
|
|
12
|
+
componentDidUpdate(prevProps: Props): void;
|
|
13
|
+
private onOpenChange;
|
|
14
|
+
private togglePlusMenuVisibility;
|
|
15
|
+
private toggleEmojiPicker;
|
|
16
|
+
private handleEmojiPressEscape;
|
|
17
|
+
private handleEmojiClickOutside;
|
|
18
|
+
private renderPopup;
|
|
19
|
+
private handleEmojiButtonRef;
|
|
20
|
+
private handlePlusButtonRef;
|
|
21
|
+
private handleDropDownButtonRef;
|
|
22
|
+
render(): jsx.JSX.Element | null;
|
|
23
|
+
private handleClick;
|
|
24
|
+
private handleOpenByKeyboard;
|
|
25
|
+
private toggleLinkPanel;
|
|
26
|
+
private insertMention;
|
|
27
|
+
private insertTable;
|
|
28
|
+
private createDate;
|
|
29
|
+
private createPlaceholderText;
|
|
30
|
+
private insertLayoutColumns;
|
|
31
|
+
private createStatus;
|
|
32
|
+
private openMediaPicker;
|
|
33
|
+
private insertTaskDecision;
|
|
34
|
+
private insertHorizontalRule;
|
|
35
|
+
private insertExpand;
|
|
36
|
+
private insertBlockType;
|
|
37
|
+
private handleSelectedEmoji;
|
|
38
|
+
private openElementBrowser;
|
|
39
|
+
private onItemActivated;
|
|
40
|
+
private insertToolbarMenuItem;
|
|
41
|
+
private insertInsertMenuItem;
|
|
42
|
+
}
|
|
43
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
44
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
45
|
+
};
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { MemoizedFn } from 'memoize-one';
|
|
4
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
5
|
+
export interface CreateInit {
|
|
6
|
+
content: string;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
tooltipDescription?: string;
|
|
9
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
10
|
+
'aria-haspopup'?: React.AriaAttributes['aria-haspopup'];
|
|
11
|
+
}
|
|
12
|
+
export declare const action: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
13
|
+
export declare const link: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
14
|
+
export declare const media: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
15
|
+
export declare const imageUpload: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
16
|
+
export declare const mention: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
17
|
+
export declare const emoji: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
18
|
+
export declare const table: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
19
|
+
export declare const layout: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
20
|
+
export declare const codeblock: MemoizedFn<(init: CreateInit & {
|
|
21
|
+
shortcut?: string;
|
|
22
|
+
}) => MenuItem>;
|
|
23
|
+
export declare const panel: MemoizedFn<(init: CreateInit & {
|
|
24
|
+
shortcut?: string;
|
|
25
|
+
}) => MenuItem>;
|
|
26
|
+
export declare const blockquote: MemoizedFn<(init: CreateInit & {
|
|
27
|
+
shortcut?: string;
|
|
28
|
+
}) => MenuItem>;
|
|
29
|
+
export declare const decision: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
30
|
+
export declare const horizontalrule: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
31
|
+
export declare const expand: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
32
|
+
export declare const date: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
33
|
+
export declare const placeholder: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
34
|
+
export declare const status: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
35
|
+
export declare const more: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shallowEquals: <T extends {}>([aRaw]: ReadonlyArray<unknown>, [bRaw]: ReadonlyArray<unknown>) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const triggerWrapper: import("@emotion/react").SerializedStyles;
|