@atlaskit/editor-plugin-insert-block 3.1.2 → 3.1.4
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/CHANGELOG.md +15 -0
- package/dist/cjs/insertBlockPlugin.js +2 -54
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +14 -64
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -1
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +1 -6
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +28 -77
- package/dist/es2019/insertBlockPlugin.js +2 -52
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +14 -64
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -1
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +1 -7
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +19 -72
- package/dist/esm/insertBlockPlugin.js +2 -54
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +14 -64
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -1
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +1 -6
- package/dist/esm/ui/ToolbarInsertBlock/index.js +28 -77
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -1
- package/dist/types-ts4.5/types/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -1
- package/package.json +4 -4
- package/dist/cjs/pm-plugins/commands.js +0 -16
- package/dist/cjs/pm-plugins/elementBrowser.js +0 -39
- package/dist/cjs/ui/ElementRail/index.js +0 -236
- package/dist/cjs/ui/assets/expand.js +0 -40
- package/dist/cjs/ui/assets/switch.js +0 -26
- package/dist/cjs/ui/transformOptions.js +0 -36
- package/dist/es2019/pm-plugins/commands.js +0 -11
- package/dist/es2019/pm-plugins/elementBrowser.js +0 -31
- package/dist/es2019/ui/ElementRail/index.js +0 -233
- package/dist/es2019/ui/assets/expand.js +0 -34
- package/dist/es2019/ui/assets/switch.js +0 -18
- package/dist/es2019/ui/transformOptions.js +0 -29
- package/dist/esm/pm-plugins/commands.js +0 -11
- package/dist/esm/pm-plugins/elementBrowser.js +0 -33
- package/dist/esm/ui/ElementRail/index.js +0 -225
- package/dist/esm/ui/assets/expand.js +0 -33
- package/dist/esm/ui/assets/switch.js +0 -18
- package/dist/esm/ui/transformOptions.js +0 -29
- package/dist/types/pm-plugins/commands.d.ts +0 -6
- package/dist/types/pm-plugins/elementBrowser.d.ts +0 -16
- package/dist/types/ui/ElementRail/index.d.ts +0 -21
- package/dist/types/ui/assets/expand.d.ts +0 -8
- package/dist/types/ui/assets/switch.d.ts +0 -6
- package/dist/types/ui/transformOptions.d.ts +0 -27
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +0 -6
- package/dist/types-ts4.5/pm-plugins/elementBrowser.d.ts +0 -16
- package/dist/types-ts4.5/ui/ElementRail/index.d.ts +0 -21
- package/dist/types-ts4.5/ui/assets/expand.d.ts +0 -8
- package/dist/types-ts4.5/ui/assets/switch.d.ts +0 -6
- package/dist/types-ts4.5/ui/transformOptions.d.ts +0 -27
|
@@ -18,7 +18,6 @@ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as with
|
|
|
18
18
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
19
19
|
import { borderRadius } from '@atlaskit/theme';
|
|
20
20
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
21
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
22
21
|
export const DEFAULT_HEIGHT = 560;
|
|
23
22
|
const InsertMenu = ({
|
|
24
23
|
editorView,
|
|
@@ -29,7 +28,7 @@ const InsertMenu = ({
|
|
|
29
28
|
pluginInjectionApi,
|
|
30
29
|
isFullPageAppearance
|
|
31
30
|
}) => {
|
|
32
|
-
var _pluginInjectionApi$
|
|
31
|
+
var _pluginInjectionApi$q8, _pluginInjectionApi$q9, _pluginInjectionApi$q10;
|
|
33
32
|
const [itemCount, setItemCount] = useState(0);
|
|
34
33
|
const [height, setHeight] = useState(DEFAULT_HEIGHT);
|
|
35
34
|
const cache = useMemo(() => {
|
|
@@ -72,20 +71,13 @@ const InsertMenu = ({
|
|
|
72
71
|
const quickInsertDropdownItems = dropdownItems.map(transform);
|
|
73
72
|
const viewMoreItem = showElementBrowserLink ? quickInsertDropdownItems.pop() : undefined;
|
|
74
73
|
const onInsertItem = useCallback(item => {
|
|
74
|
+
var _pluginInjectionApi$q;
|
|
75
75
|
toggleVisiblity();
|
|
76
76
|
if (!editorView.hasFocus()) {
|
|
77
77
|
editorView.focus();
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.actions.insertItem(item,
|
|
82
|
-
// @ts-expect-error
|
|
83
|
-
INPUT_METHOD.INSERT_MENU_RIGHT_RAIL)(editorView.state, editorView.dispatch);
|
|
84
|
-
} else {
|
|
85
|
-
var _pluginInjectionApi$q2;
|
|
86
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q2 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q2 === void 0 ? void 0 : _pluginInjectionApi$q2.actions.insertItem(item, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
87
|
-
}
|
|
88
|
-
}, [editorView, toggleVisiblity, pluginInjectionApi, isFullPageAppearance]);
|
|
79
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.actions.insertItem(item, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
80
|
+
}, [editorView, toggleVisiblity, pluginInjectionApi]);
|
|
89
81
|
const {
|
|
90
82
|
connectivityState
|
|
91
83
|
} = useSharedPluginState(pluginInjectionApi, ['connectivity']);
|
|
@@ -98,58 +90,29 @@ const InsertMenu = ({
|
|
|
98
90
|
* @see above transform function for more details.
|
|
99
91
|
*/
|
|
100
92
|
if (query) {
|
|
101
|
-
var _pluginInjectionApi$
|
|
102
|
-
result = (_pluginInjectionApi$
|
|
93
|
+
var _pluginInjectionApi$q2, _pluginInjectionApi$q3, _pluginInjectionApi$q4;
|
|
94
|
+
result = (_pluginInjectionApi$q2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q3 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q3 === void 0 ? void 0 : (_pluginInjectionApi$q4 = _pluginInjectionApi$q3.actions.getSuggestions({
|
|
103
95
|
query,
|
|
104
96
|
category
|
|
105
|
-
})) === null || _pluginInjectionApi$
|
|
97
|
+
})) === null || _pluginInjectionApi$q4 === void 0 ? void 0 : _pluginInjectionApi$q4.map(item => (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline' && item.isDisabledOffline ? {
|
|
106
98
|
...item,
|
|
107
99
|
isDisabled: true
|
|
108
|
-
} : item)) !== null && _pluginInjectionApi$
|
|
100
|
+
} : item)) !== null && _pluginInjectionApi$q2 !== void 0 ? _pluginInjectionApi$q2 : [];
|
|
109
101
|
} else {
|
|
110
|
-
var _pluginInjectionApi$
|
|
111
|
-
const featuredQuickInsertSuggestions = (_pluginInjectionApi$
|
|
102
|
+
var _pluginInjectionApi$q5, _pluginInjectionApi$q6, _pluginInjectionApi$q7;
|
|
103
|
+
const featuredQuickInsertSuggestions = (_pluginInjectionApi$q5 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : (_pluginInjectionApi$q7 = _pluginInjectionApi$q6.actions.getSuggestions({
|
|
112
104
|
category,
|
|
113
105
|
featuredItems: true
|
|
114
|
-
})) === null || _pluginInjectionApi$
|
|
106
|
+
})) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.map(item => (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline' && item.isDisabledOffline ? {
|
|
115
107
|
...item,
|
|
116
108
|
isDisabled: true
|
|
117
|
-
} : item)) !== null && _pluginInjectionApi$
|
|
109
|
+
} : item)) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
|
|
118
110
|
result = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
119
111
|
}
|
|
120
112
|
setItemCount(result.length);
|
|
121
113
|
return result;
|
|
122
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
123
|
-
const emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* For insert menu in right rail experiment
|
|
127
|
-
* - Clean up ticket ED-24801
|
|
128
|
-
*
|
|
129
|
-
* The insert menu is not rendered in a popup so need to avoid wrapping it in outer click
|
|
130
|
-
* listeners because it will cause the editor to focus certain extensions (e.g. Jira legacy)
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
134
|
-
return (
|
|
135
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
136
|
-
jsx("div", {
|
|
137
|
-
css: insertMenuWrapper(height, isFullPageAppearance)
|
|
138
|
-
}, jsx(FlexWrapper, null, jsx(ElementBrowser, {
|
|
139
|
-
mode: "inline",
|
|
140
|
-
getItems: getItems,
|
|
141
|
-
emptyStateHandler: emptyStateHandler,
|
|
142
|
-
onInsertItem: onInsertItem,
|
|
143
|
-
showSearch: true,
|
|
144
|
-
showCategories: false
|
|
145
|
-
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
146
|
-
,
|
|
147
|
-
key: quickInsertDropdownItems.length,
|
|
148
|
-
viewMoreItem: viewMoreItem,
|
|
149
|
-
cache: cache
|
|
150
|
-
})))
|
|
151
|
-
);
|
|
152
|
-
}
|
|
114
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.actions, quickInsertDropdownItems, connectivityState]);
|
|
115
|
+
const emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q9 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q9 === void 0 ? void 0 : (_pluginInjectionApi$q10 = _pluginInjectionApi$q9.sharedState.currentState()) === null || _pluginInjectionApi$q10 === void 0 ? void 0 : _pluginInjectionApi$q10.emptyStateHandler;
|
|
153
116
|
return (
|
|
154
117
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
155
118
|
jsx("div", {
|
|
@@ -191,19 +154,6 @@ const getSvgIconForItem = ({
|
|
|
191
154
|
}) : undefined;
|
|
192
155
|
};
|
|
193
156
|
const insertMenuWrapper = (height, isFullPageAppearance) => {
|
|
194
|
-
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
195
|
-
return css({
|
|
196
|
-
display: 'flex',
|
|
197
|
-
flexDirection: 'column',
|
|
198
|
-
width: '314px',
|
|
199
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
200
|
-
height: 'calc(100% - 32px)',
|
|
201
|
-
margin: `0 -12px`,
|
|
202
|
-
backgroundColor: `${`var(--ds-surface-overlay, ${N0})`}`,
|
|
203
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
204
|
-
borderRadius: `${borderRadius()}px`
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
157
|
return css({
|
|
208
158
|
display: 'flex',
|
|
209
159
|
flexDirection: 'column',
|
|
@@ -29,7 +29,7 @@ export const BlockInsertElementBrowser = props => {
|
|
|
29
29
|
"aria-expanded": props.open,
|
|
30
30
|
"aria-haspopup": true,
|
|
31
31
|
handleRef: props.onRef,
|
|
32
|
-
selected: props.open
|
|
32
|
+
selected: props.open,
|
|
33
33
|
disabled: props.disabled,
|
|
34
34
|
onClick: props.onClick,
|
|
35
35
|
onKeyDown: props.onKeyDown,
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
2
|
import { BlockInsertElementBrowser } from './block-insert-element-browser';
|
|
4
3
|
import { DropDownButton } from './dropdown-button';
|
|
5
4
|
export const BlockInsertMenu = props => {
|
|
6
|
-
const {
|
|
7
|
-
insertBlockState
|
|
8
|
-
} = useSharedPluginState(props.pluginInjectionApi, ['insertBlock']);
|
|
9
|
-
const isActive = (insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen) || false;
|
|
10
5
|
if (props.items.length === 0) {
|
|
11
6
|
return null;
|
|
12
7
|
}
|
|
@@ -42,7 +37,6 @@ export const BlockInsertMenu = props => {
|
|
|
42
37
|
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
43
38
|
showElementBrowserLink: props.showElementBrowserLink,
|
|
44
39
|
pluginInjectionApi: props.pluginInjectionApi,
|
|
45
|
-
isFullPageAppearance: props.isFullPageAppearance
|
|
46
|
-
isActive: isActive
|
|
40
|
+
isFullPageAppearance: props.isFullPageAppearance
|
|
47
41
|
});
|
|
48
42
|
};
|
|
@@ -22,8 +22,6 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
|
|
|
22
22
|
// eslint-disable-next-line import/no-namespace
|
|
23
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
24
|
import { N20A, N30A } from '@atlaskit/theme/colors';
|
|
25
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
26
|
-
import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
|
|
27
25
|
import { BlockInsertMenu } from './block-insert-menu';
|
|
28
26
|
import { createItems } from './create-items';
|
|
29
27
|
// Ignored via go/ees005
|
|
@@ -253,61 +251,10 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
253
251
|
}
|
|
254
252
|
});
|
|
255
253
|
_defineProperty(this, "handleClick", () => {
|
|
256
|
-
var _this$props$editorApp;
|
|
257
|
-
/**
|
|
258
|
-
* For insert menu in right rail experiment
|
|
259
|
-
* - Clean up ticket ED-24801
|
|
260
|
-
*/
|
|
261
|
-
if (['full-page', 'full-width'].includes((_this$props$editorApp = this.props.editorAppearance) !== null && _this$props$editorApp !== void 0 ? _this$props$editorApp : '') && editorExperiment('insert-menu-in-right-rail', true, {
|
|
262
|
-
exposure: true
|
|
263
|
-
})) {
|
|
264
|
-
const {
|
|
265
|
-
pluginInjectionApi
|
|
266
|
-
} = this.props;
|
|
267
|
-
if (!pluginInjectionApi) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
pluginInjectionApi.core.actions.execute(({
|
|
271
|
-
tr
|
|
272
|
-
}) => {
|
|
273
|
-
var _pluginInjectionApi$c, _pluginInjectionApi$a;
|
|
274
|
-
toggleInsertMenuRightRail(tr);
|
|
275
|
-
(_pluginInjectionApi$c = pluginInjectionApi.contextPanel) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.applyChange(tr);
|
|
276
|
-
(_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent({
|
|
277
|
-
action: ACTION.CLICKED,
|
|
278
|
-
// @ts-expect-error
|
|
279
|
-
actionSubject: ACTION_SUBJECT.TOOLBAR_BUTTON,
|
|
280
|
-
// @ts-expect-error
|
|
281
|
-
actionSubjectId: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
|
|
282
|
-
eventType: EVENT_TYPE.UI
|
|
283
|
-
})(tr);
|
|
284
|
-
return tr;
|
|
285
|
-
});
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
254
|
this.togglePlusMenuVisibility();
|
|
289
255
|
});
|
|
290
256
|
_defineProperty(this, "handleOpenByKeyboard", event => {
|
|
291
257
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
292
|
-
var _this$props$editorApp2;
|
|
293
|
-
/**
|
|
294
|
-
* For insert menu in right rail experiment
|
|
295
|
-
* - Clean up ticket ED-24801
|
|
296
|
-
*/
|
|
297
|
-
if (['full-page', 'full-width'].includes((_this$props$editorApp2 = this.props.editorAppearance) !== null && _this$props$editorApp2 !== void 0 ? _this$props$editorApp2 : '') && editorExperiment('insert-menu-in-right-rail', true, {
|
|
298
|
-
exposure: true
|
|
299
|
-
})) {
|
|
300
|
-
var _this$props$pluginInj;
|
|
301
|
-
(_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.core.actions.execute(({
|
|
302
|
-
tr
|
|
303
|
-
}) => {
|
|
304
|
-
var _this$props$pluginInj2, _this$props$pluginInj3;
|
|
305
|
-
toggleInsertMenuRightRail(tr);
|
|
306
|
-
(_this$props$pluginInj2 = this.props.pluginInjectionApi) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.contextPanel) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.actions.applyChange(tr);
|
|
307
|
-
return tr;
|
|
308
|
-
});
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
258
|
this.setState({
|
|
312
259
|
...this.state,
|
|
313
260
|
isOpenedByKeyboard: true
|
|
@@ -324,11 +271,11 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
324
271
|
}
|
|
325
272
|
});
|
|
326
273
|
_defineProperty(this, "toggleLinkPanel", inputMethod => {
|
|
327
|
-
var _pluginInjectionApi$
|
|
274
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$h;
|
|
328
275
|
const {
|
|
329
276
|
pluginInjectionApi
|
|
330
277
|
} = this.props;
|
|
331
|
-
return (_pluginInjectionApi$
|
|
278
|
+
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : _pluginInjectionApi$h.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
332
279
|
});
|
|
333
280
|
_defineProperty(this, "insertMention", inputMethod => {
|
|
334
281
|
var _pluginInjectionApi$m3, _pluginInjectionApi$m4, _pluginInjectionApi$m5;
|
|
@@ -376,16 +323,16 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
376
323
|
|
|
377
324
|
// workaround to solve race condition where cursor is not placed correctly inside table
|
|
378
325
|
queueMicrotask(() => {
|
|
379
|
-
var _pluginInjectionApi$
|
|
380
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
326
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$t4;
|
|
327
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t4 = pluginInjectionApi.table) === null || _pluginInjectionApi$t4 === void 0 ? void 0 : _pluginInjectionApi$t4.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
|
|
381
328
|
});
|
|
382
329
|
});
|
|
383
330
|
_defineProperty(this, "createDate", inputMethod => {
|
|
384
|
-
var _pluginInjectionApi$
|
|
331
|
+
var _pluginInjectionApi$c4, _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
385
332
|
const {
|
|
386
333
|
pluginInjectionApi
|
|
387
334
|
} = this.props;
|
|
388
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
335
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.date) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.commands) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.insertDate({
|
|
389
336
|
inputMethod
|
|
390
337
|
}));
|
|
391
338
|
return true;
|
|
@@ -409,11 +356,11 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
409
356
|
return true;
|
|
410
357
|
});
|
|
411
358
|
_defineProperty(this, "createStatus", inputMethod => {
|
|
412
|
-
var _pluginInjectionApi$
|
|
359
|
+
var _pluginInjectionApi$c5, _pluginInjectionApi$s, _pluginInjectionApi$s2;
|
|
413
360
|
const {
|
|
414
361
|
pluginInjectionApi
|
|
415
362
|
} = this.props;
|
|
416
|
-
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
363
|
+
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 ? void 0 : (_pluginInjectionApi$s2 = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.insertStatus(inputMethod)));
|
|
417
364
|
});
|
|
418
365
|
_defineProperty(this, "openMediaPicker", inputMethod => {
|
|
419
366
|
const {
|
|
@@ -492,21 +439,21 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
492
439
|
return true;
|
|
493
440
|
});
|
|
494
441
|
_defineProperty(this, "handleSelectedEmoji", emojiId => {
|
|
495
|
-
var _pluginInjectionApi$
|
|
442
|
+
var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
|
|
496
443
|
const {
|
|
497
444
|
pluginInjectionApi
|
|
498
445
|
} = this.props;
|
|
499
446
|
this.props.editorView.focus();
|
|
500
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
447
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.actions.execute((_pluginInjectionApi$e3 = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
|
|
501
448
|
this.toggleEmojiPicker();
|
|
502
449
|
return true;
|
|
503
450
|
});
|
|
504
451
|
_defineProperty(this, "openElementBrowser", () => {
|
|
505
|
-
var _pluginInjectionApi$
|
|
452
|
+
var _pluginInjectionApi$c7, _pluginInjectionApi$q;
|
|
506
453
|
const {
|
|
507
454
|
pluginInjectionApi
|
|
508
455
|
} = this.props;
|
|
509
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
456
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : _pluginInjectionApi$c7.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
510
457
|
});
|
|
511
458
|
_defineProperty(this, "onItemActivated", ({
|
|
512
459
|
item,
|
|
@@ -700,8 +647,8 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
700
647
|
}
|
|
701
648
|
const onUnmount = () => {
|
|
702
649
|
requestAnimationFrame(() => {
|
|
703
|
-
var _this$props$
|
|
704
|
-
return (_this$props$
|
|
650
|
+
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
|
|
651
|
+
return (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.core) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.actions) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.focus();
|
|
705
652
|
});
|
|
706
653
|
};
|
|
707
654
|
return jsx(Popup, {
|
|
@@ -745,8 +692,8 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
745
692
|
// Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
|
|
746
693
|
// So we can start typing right away.
|
|
747
694
|
const onUnmount = () => {
|
|
748
|
-
var _pluginInjectionApi$
|
|
749
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
695
|
+
var _pluginInjectionApi$c8, _pluginInjectionApi$c9;
|
|
696
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : (_pluginInjectionApi$c9 = _pluginInjectionApi$c8.actions) === null || _pluginInjectionApi$c9 === void 0 ? void 0 : _pluginInjectionApi$c9.focus();
|
|
750
697
|
};
|
|
751
698
|
return jsx(TableSelectorPopup, {
|
|
752
699
|
target: ref,
|
|
@@ -761,7 +708,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
761
708
|
});
|
|
762
709
|
}
|
|
763
710
|
render() {
|
|
764
|
-
var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$plusButtonRef, _this$props$
|
|
711
|
+
var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$plusButtonRef, _this$props$pluginInj4;
|
|
765
712
|
const {
|
|
766
713
|
buttons,
|
|
767
714
|
dropdownItems,
|
|
@@ -872,7 +819,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
872
819
|
editorView: this.props.editorView,
|
|
873
820
|
spacing: this.props.isReducedSpacing ? 'none' : 'default',
|
|
874
821
|
label: this.props.intl.formatMessage(messages.insertMenu),
|
|
875
|
-
open:
|
|
822
|
+
open: this.state.isPlusMenuOpen,
|
|
876
823
|
plusButtonRef: (_this$plusButtonRef = this.plusButtonRef) === null || _this$plusButtonRef === void 0 ? void 0 : _this$plusButtonRef.deref(),
|
|
877
824
|
items: this.state.dropdownItems,
|
|
878
825
|
onRef: this.handleDropDownButtonRef,
|
|
@@ -886,7 +833,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
886
833
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
887
834
|
pluginInjectionApi: this.props.pluginInjectionApi,
|
|
888
835
|
isFullPageAppearance: isFullPageAppearance
|
|
889
|
-
})), !((_this$props$
|
|
836
|
+
})), !((_this$props$pluginInj4 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj4 !== void 0 && _this$props$pluginInj4.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
890
837
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
891
838
|
jsx("span", {
|
|
892
839
|
css: separatorStyles
|
|
@@ -3,14 +3,10 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import { ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
4
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
6
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
8
7
|
import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
|
|
9
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
|
-
import { elementBrowserPmKey, elementBrowserPmPlugin } from './pm-plugins/elementBrowser';
|
|
12
9
|
import { toggleInsertBlockPmKey, toggleInsertBlockPmPlugin } from './pm-plugins/toggleInsertBlock';
|
|
13
|
-
import { InsertMenuRail } from './ui/ElementRail';
|
|
14
10
|
// Ignored via go/ees005
|
|
15
11
|
// eslint-disable-next-line import/no-named-as-default
|
|
16
12
|
import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
|
|
@@ -94,13 +90,10 @@ function delayUntilIdle(cb) {
|
|
|
94
90
|
});
|
|
95
91
|
}
|
|
96
92
|
export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
97
|
-
var _api$primaryToolbar
|
|
93
|
+
var _api$primaryToolbar;
|
|
98
94
|
var _ref$config = _ref.config,
|
|
99
95
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
100
96
|
api = _ref.api;
|
|
101
|
-
var editorViewRef = {
|
|
102
|
-
current: null
|
|
103
|
-
};
|
|
104
97
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
|
|
105
98
|
var editorView = _ref2.editorView,
|
|
106
99
|
editorActions = _ref2.editorActions,
|
|
@@ -159,15 +152,8 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
159
152
|
return;
|
|
160
153
|
}
|
|
161
154
|
var toggleInsertBlockPluginState = toggleInsertBlockPmKey.getState(editorState);
|
|
162
|
-
var elementBrowserPluginState = elementBrowserPmKey.getState(editorState);
|
|
163
155
|
return {
|
|
164
|
-
showElementBrowser: (toggleInsertBlockPluginState === null || toggleInsertBlockPluginState === void 0 ? void 0 : toggleInsertBlockPluginState.showElementBrowser) || false
|
|
165
|
-
/**
|
|
166
|
-
* For insert menu in right rail experiment
|
|
167
|
-
* - Clean up ticket ED-24801
|
|
168
|
-
* Experiment: `insert-menu-in-right-rail`
|
|
169
|
-
*/
|
|
170
|
-
menuBrowserOpen: editorExperiment('insert-menu-in-right-rail', true) ? elementBrowserPluginState === null || elementBrowserPluginState === void 0 ? void 0 : elementBrowserPluginState.menuBrowserOpen : false
|
|
156
|
+
showElementBrowser: (toggleInsertBlockPluginState === null || toggleInsertBlockPluginState === void 0 ? void 0 : toggleInsertBlockPluginState.showElementBrowser) || false
|
|
171
157
|
};
|
|
172
158
|
},
|
|
173
159
|
usePluginHook: function usePluginHook() {
|
|
@@ -186,25 +172,6 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
186
172
|
[];
|
|
187
173
|
}
|
|
188
174
|
var plugins = [];
|
|
189
|
-
if (editorExperiment('insert-menu-in-right-rail', true)) {
|
|
190
|
-
plugins.push({
|
|
191
|
-
name: 'elementBrowserPmPlugin',
|
|
192
|
-
plugin: function plugin() {
|
|
193
|
-
return elementBrowserPmPlugin();
|
|
194
|
-
}
|
|
195
|
-
}, {
|
|
196
|
-
name: 'elementBrowserEditorViewRef',
|
|
197
|
-
plugin: function plugin() {
|
|
198
|
-
return new SafePlugin({
|
|
199
|
-
view: function view(editorView) {
|
|
200
|
-
// Workaround - need reference to editorView for contextPanel component
|
|
201
|
-
editorViewRef.current = editorView;
|
|
202
|
-
return {};
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
175
|
plugins.push({
|
|
209
176
|
name: 'toggleInsertBlockPmPlugin',
|
|
210
177
|
plugin: function plugin() {
|
|
@@ -216,25 +183,6 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
216
183
|
pluginsOptions: {},
|
|
217
184
|
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
|
|
218
185
|
};
|
|
219
|
-
if (
|
|
220
|
-
// @ts-ignore
|
|
221
|
-
['full-page', 'full-width'].includes((_options$appearance3 = options.appearance) !== null && _options$appearance3 !== void 0 ? _options$appearance3 : '') && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
222
|
-
// Ignored via go/ees005
|
|
223
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
224
|
-
plugin.pluginsOptions.contextPanel = function (state) {
|
|
225
|
-
// api.getSharedState() will have an outdated reference to editorState on first mount of this component
|
|
226
|
-
// so instead just rely on plugin key as we don't need to be reactive to changes here
|
|
227
|
-
var pluginState = elementBrowserPmKey.getState(state);
|
|
228
|
-
if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen && editorViewRef.current) {
|
|
229
|
-
return /*#__PURE__*/React.createElement(InsertMenuRail, {
|
|
230
|
-
editorView: editorViewRef.current,
|
|
231
|
-
options: options,
|
|
232
|
-
api: api
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
return;
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
186
|
return plugin;
|
|
239
187
|
};
|
|
240
188
|
function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
@@ -25,10 +25,9 @@ import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as with
|
|
|
25
25
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
26
26
|
import { borderRadius } from '@atlaskit/theme';
|
|
27
27
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
28
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
29
28
|
export var DEFAULT_HEIGHT = 560;
|
|
30
29
|
var InsertMenu = function InsertMenu(_ref) {
|
|
31
|
-
var _pluginInjectionApi$
|
|
30
|
+
var _pluginInjectionApi$q6, _pluginInjectionApi$q7;
|
|
32
31
|
var editorView = _ref.editorView,
|
|
33
32
|
dropdownItems = _ref.dropdownItems,
|
|
34
33
|
showElementBrowserLink = _ref.showElementBrowserLink,
|
|
@@ -92,20 +91,13 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
92
91
|
var quickInsertDropdownItems = dropdownItems.map(transform);
|
|
93
92
|
var viewMoreItem = showElementBrowserLink ? quickInsertDropdownItems.pop() : undefined;
|
|
94
93
|
var onInsertItem = useCallback(function (item) {
|
|
94
|
+
var _pluginInjectionApi$q;
|
|
95
95
|
toggleVisiblity();
|
|
96
96
|
if (!editorView.hasFocus()) {
|
|
97
97
|
editorView.focus();
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 || _pluginInjectionApi$q.actions.insertItem(item,
|
|
102
|
-
// @ts-expect-error
|
|
103
|
-
INPUT_METHOD.INSERT_MENU_RIGHT_RAIL)(editorView.state, editorView.dispatch);
|
|
104
|
-
} else {
|
|
105
|
-
var _pluginInjectionApi$q2;
|
|
106
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q2 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q2 === void 0 || _pluginInjectionApi$q2.actions.insertItem(item, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
107
|
-
}
|
|
108
|
-
}, [editorView, toggleVisiblity, pluginInjectionApi, isFullPageAppearance]);
|
|
99
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 || _pluginInjectionApi$q.actions.insertItem(item, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
100
|
+
}, [editorView, toggleVisiblity, pluginInjectionApi]);
|
|
109
101
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['connectivity']),
|
|
110
102
|
connectivityState = _useSharedPluginState.connectivityState;
|
|
111
103
|
var getItems = useCallback(function (query, category) {
|
|
@@ -117,60 +109,31 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
117
109
|
* @see above transform function for more details.
|
|
118
110
|
*/
|
|
119
111
|
if (query) {
|
|
120
|
-
var _pluginInjectionApi$
|
|
121
|
-
result = (_pluginInjectionApi$
|
|
112
|
+
var _pluginInjectionApi$q2, _pluginInjectionApi$q3;
|
|
113
|
+
result = (_pluginInjectionApi$q2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q3 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q3 === void 0 || (_pluginInjectionApi$q3 = _pluginInjectionApi$q3.actions.getSuggestions({
|
|
122
114
|
query: query,
|
|
123
115
|
category: category
|
|
124
|
-
})) === null || _pluginInjectionApi$
|
|
116
|
+
})) === null || _pluginInjectionApi$q3 === void 0 ? void 0 : _pluginInjectionApi$q3.map(function (item) {
|
|
125
117
|
return (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline' && item.isDisabledOffline ? _objectSpread(_objectSpread({}, item), {}, {
|
|
126
118
|
isDisabled: true
|
|
127
119
|
}) : item;
|
|
128
|
-
})) !== null && _pluginInjectionApi$
|
|
120
|
+
})) !== null && _pluginInjectionApi$q2 !== void 0 ? _pluginInjectionApi$q2 : [];
|
|
129
121
|
} else {
|
|
130
|
-
var _pluginInjectionApi$
|
|
131
|
-
var featuredQuickInsertSuggestions = (_pluginInjectionApi$
|
|
122
|
+
var _pluginInjectionApi$q4, _pluginInjectionApi$q5;
|
|
123
|
+
var featuredQuickInsertSuggestions = (_pluginInjectionApi$q4 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q5 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q5 === void 0 || (_pluginInjectionApi$q5 = _pluginInjectionApi$q5.actions.getSuggestions({
|
|
132
124
|
category: category,
|
|
133
125
|
featuredItems: true
|
|
134
|
-
})) === null || _pluginInjectionApi$
|
|
126
|
+
})) === null || _pluginInjectionApi$q5 === void 0 ? void 0 : _pluginInjectionApi$q5.map(function (item) {
|
|
135
127
|
return (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline' && item.isDisabledOffline ? _objectSpread(_objectSpread({}, item), {}, {
|
|
136
128
|
isDisabled: true
|
|
137
129
|
}) : item;
|
|
138
|
-
})) !== null && _pluginInjectionApi$
|
|
130
|
+
})) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
|
|
139
131
|
result = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
140
132
|
}
|
|
141
133
|
setItemCount(result.length);
|
|
142
134
|
return result;
|
|
143
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
144
|
-
var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* For insert menu in right rail experiment
|
|
148
|
-
* - Clean up ticket ED-24801
|
|
149
|
-
*
|
|
150
|
-
* The insert menu is not rendered in a popup so need to avoid wrapping it in outer click
|
|
151
|
-
* listeners because it will cause the editor to focus certain extensions (e.g. Jira legacy)
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
155
|
-
return (
|
|
156
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
157
|
-
jsx("div", {
|
|
158
|
-
css: insertMenuWrapper(height, isFullPageAppearance)
|
|
159
|
-
}, jsx(FlexWrapper, null, jsx(ElementBrowser, {
|
|
160
|
-
mode: "inline",
|
|
161
|
-
getItems: getItems,
|
|
162
|
-
emptyStateHandler: emptyStateHandler,
|
|
163
|
-
onInsertItem: onInsertItem,
|
|
164
|
-
showSearch: true,
|
|
165
|
-
showCategories: false
|
|
166
|
-
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
167
|
-
,
|
|
168
|
-
key: quickInsertDropdownItems.length,
|
|
169
|
-
viewMoreItem: viewMoreItem,
|
|
170
|
-
cache: cache
|
|
171
|
-
})))
|
|
172
|
-
);
|
|
173
|
-
}
|
|
135
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityState]);
|
|
136
|
+
var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 || (_pluginInjectionApi$q7 = _pluginInjectionApi$q7.sharedState.currentState()) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.emptyStateHandler;
|
|
174
137
|
return (
|
|
175
138
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
176
139
|
jsx("div", {
|
|
@@ -211,19 +174,6 @@ var getSvgIconForItem = function getSvgIconForItem(_ref2) {
|
|
|
211
174
|
}) : undefined;
|
|
212
175
|
};
|
|
213
176
|
var insertMenuWrapper = function insertMenuWrapper(height, isFullPageAppearance) {
|
|
214
|
-
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
215
|
-
return css({
|
|
216
|
-
display: 'flex',
|
|
217
|
-
flexDirection: 'column',
|
|
218
|
-
width: '314px',
|
|
219
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
220
|
-
height: 'calc(100% - 32px)',
|
|
221
|
-
margin: "0 -12px",
|
|
222
|
-
backgroundColor: "".concat("var(--ds-surface-overlay, ".concat(N0, ")")),
|
|
223
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
224
|
-
borderRadius: "".concat(borderRadius(), "px")
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
177
|
return css({
|
|
228
178
|
display: 'flex',
|
|
229
179
|
flexDirection: 'column',
|
|
@@ -29,7 +29,7 @@ export var BlockInsertElementBrowser = function BlockInsertElementBrowser(props)
|
|
|
29
29
|
"aria-expanded": props.open,
|
|
30
30
|
"aria-haspopup": true,
|
|
31
31
|
handleRef: props.onRef,
|
|
32
|
-
selected: props.open
|
|
32
|
+
selected: props.open,
|
|
33
33
|
disabled: props.disabled,
|
|
34
34
|
onClick: props.onClick,
|
|
35
35
|
onKeyDown: props.onKeyDown,
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
2
|
import { BlockInsertElementBrowser } from './block-insert-element-browser';
|
|
4
3
|
import { DropDownButton } from './dropdown-button';
|
|
5
4
|
export var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
6
|
-
var _useSharedPluginState = useSharedPluginState(props.pluginInjectionApi, ['insertBlock']),
|
|
7
|
-
insertBlockState = _useSharedPluginState.insertBlockState;
|
|
8
|
-
var isActive = (insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen) || false;
|
|
9
5
|
if (props.items.length === 0) {
|
|
10
6
|
return null;
|
|
11
7
|
}
|
|
@@ -41,7 +37,6 @@ export var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
|
41
37
|
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
42
38
|
showElementBrowserLink: props.showElementBrowserLink,
|
|
43
39
|
pluginInjectionApi: props.pluginInjectionApi,
|
|
44
|
-
isFullPageAppearance: props.isFullPageAppearance
|
|
45
|
-
isActive: isActive
|
|
40
|
+
isFullPageAppearance: props.isFullPageAppearance
|
|
46
41
|
});
|
|
47
42
|
};
|