@atlaskit/editor-plugin-type-ahead 2.0.4 → 2.0.5
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 +9 -0
- package/dist/cjs/ui/modern/TypeAheadPopup.js +38 -10
- package/dist/es2019/ui/modern/TypeAheadPopup.js +45 -15
- package/dist/esm/ui/modern/TypeAheadPopup.js +42 -13
- package/package.json +2 -2
- package/dist/cjs/ui/modern/ViewAllButton.js +0 -76
- package/dist/es2019/ui/modern/ViewAllButton.js +0 -66
- package/dist/esm/ui/modern/ViewAllButton.js +0 -66
- package/dist/types/ui/modern/ViewAllButton.d.ts +0 -13
- package/dist/types-ts4.5/ui/modern/ViewAllButton.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 2.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#121049](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121049)
|
|
8
|
+
[`0c8ca53dace33`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0c8ca53dace33) -
|
|
9
|
+
[ux] Uses ViewAllButtonItem from the editor-element-browser package instead of custom Pressable
|
|
10
|
+
button
|
|
11
|
+
|
|
3
12
|
## 2.0.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -10,17 +10,20 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
13
|
+
var _reactIntlNext = require("react-intl-next");
|
|
13
14
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
15
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
16
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
17
|
var _editorElementBrowser = require("@atlaskit/editor-element-browser");
|
|
16
18
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
|
+
var _add = _interopRequireDefault(require("@atlaskit/icon/core/add"));
|
|
17
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
21
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
22
|
var _constants = require("../../pm-plugins/constants");
|
|
20
23
|
var _TypeAheadErrorFallback = require("../TypeAheadErrorFallback");
|
|
21
|
-
var _ViewAllButton = require("./ViewAllButton");
|
|
22
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled */
|
|
24
27
|
/**
|
|
25
28
|
* @jsxRuntime classic
|
|
26
29
|
* @jsx jsx
|
|
@@ -32,6 +35,7 @@ var DEFAULT_TYPEAHEAD_MENU_HEIGHT = 520;
|
|
|
32
35
|
// const DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
33
36
|
|
|
34
37
|
var ITEM_PADDING = 12;
|
|
38
|
+
var INSERT_PANEL_WIDTH = 320;
|
|
35
39
|
var typeAheadContent = (0, _react2.css)({
|
|
36
40
|
background: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
37
41
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
@@ -63,6 +67,8 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
63
67
|
query = props.query,
|
|
64
68
|
setSelectedItem = props.setSelectedItem;
|
|
65
69
|
var ref = (0, _react.useRef)(null);
|
|
70
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
71
|
+
formatMessage = _useIntl.formatMessage;
|
|
66
72
|
var defaultMenuHeight = DEFAULT_TYPEAHEAD_MENU_HEIGHT;
|
|
67
73
|
var startTime = (0, _react.useMemo)(function () {
|
|
68
74
|
return performance.now();
|
|
@@ -264,13 +270,39 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
264
270
|
element === null || element === void 0 || element.removeEventListener('keydown', escape);
|
|
265
271
|
};
|
|
266
272
|
}, [ref, cancel]);
|
|
267
|
-
var
|
|
268
|
-
|
|
273
|
+
var handleViewAllItemsClick = (0, _react.useCallback)(function () {
|
|
274
|
+
var _api$contextPanel;
|
|
275
|
+
var showContextPanel = api === null || api === void 0 || (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 || (_api$contextPanel = _api$contextPanel.actions) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.showPanel;
|
|
276
|
+
if (!showContextPanel || !items) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Opens main editor controls side panel
|
|
281
|
+
showContextPanel({
|
|
282
|
+
id: 'editor-element-insert-sidebar-panel',
|
|
283
|
+
headerComponentElements: {
|
|
284
|
+
headerLabel: _messages.elementInsertSidePanel.title,
|
|
285
|
+
HeaderIcon: function HeaderIcon() {
|
|
286
|
+
return (0, _react2.jsx)(_add.default, {
|
|
287
|
+
label: formatMessage(_messages.elementInsertSidePanel.title)
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
BodyComponent: function BodyComponent() {
|
|
292
|
+
return (0, _react2.jsx)(_editorElementBrowser.SideInsertPanel, {
|
|
293
|
+
items: items,
|
|
294
|
+
onItemInsert: onItemInsert
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}, 'push', INSERT_PANEL_WIDTH);
|
|
298
|
+
|
|
299
|
+
// Closes typeahead
|
|
300
|
+
cancel({
|
|
269
301
|
addPrefixTrigger: true,
|
|
270
302
|
setSelectionAt: _constants.CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
271
303
|
forceFocusOnEditor: true
|
|
272
304
|
});
|
|
273
|
-
}, [cancel]);
|
|
305
|
+
}, [api, cancel, formatMessage, items, onItemInsert]);
|
|
274
306
|
return (0, _react2.jsx)(_ui.Popup, {
|
|
275
307
|
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
276
308
|
target: anchorElement,
|
|
@@ -295,12 +327,8 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
295
327
|
items: items,
|
|
296
328
|
onItemInsert: onItemInsert,
|
|
297
329
|
query: query,
|
|
298
|
-
setSelectedItem: setSelectedItem
|
|
299
|
-
|
|
300
|
-
items: items,
|
|
301
|
-
editorApi: api,
|
|
302
|
-
onItemInsert: onItemInsert,
|
|
303
|
-
onPanelOpen: handlePanelOpen
|
|
330
|
+
setSelectedItem: setSelectedItem,
|
|
331
|
+
onViewAllItemsClick: Boolean(api === null || api === void 0 ? void 0 : api.contextPanel) ? handleViewAllItemsClick : undefined
|
|
304
332
|
}))));
|
|
305
333
|
});
|
|
306
334
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled */
|
|
1
2
|
/**
|
|
2
3
|
* @jsxRuntime classic
|
|
3
4
|
* @jsx jsx
|
|
4
5
|
*/
|
|
5
6
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
7
|
import { css, jsx } from '@emotion/react';
|
|
9
8
|
import rafSchedule from 'raf-schd';
|
|
9
|
+
import { useIntl } from 'react-intl-next';
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
|
+
|
|
10
13
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
14
|
+
import { elementInsertSidePanel } from '@atlaskit/editor-common/messages';
|
|
11
15
|
import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
|
|
12
|
-
import { QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
16
|
+
import { SideInsertPanel, QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
13
17
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
18
|
+
import AddIcon from '@atlaskit/icon/core/add';
|
|
14
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
20
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
16
21
|
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../../pm-plugins/constants';
|
|
17
22
|
import { TypeAheadErrorFallback } from '../TypeAheadErrorFallback';
|
|
18
|
-
import { ViewAllButton } from './ViewAllButton';
|
|
19
23
|
const DEFAULT_TYPEAHEAD_MENU_HEIGHT = 520;
|
|
20
24
|
// const DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
21
25
|
|
|
22
26
|
const ITEM_PADDING = 12;
|
|
27
|
+
const INSERT_PANEL_WIDTH = 320;
|
|
23
28
|
const typeAheadContent = css({
|
|
24
29
|
background: `var(--ds-surface-overlay, ${N0})`,
|
|
25
30
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
@@ -53,6 +58,9 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
53
58
|
setSelectedItem
|
|
54
59
|
} = props;
|
|
55
60
|
const ref = useRef(null);
|
|
61
|
+
const {
|
|
62
|
+
formatMessage
|
|
63
|
+
} = useIntl();
|
|
56
64
|
const defaultMenuHeight = DEFAULT_TYPEAHEAD_MENU_HEIGHT;
|
|
57
65
|
const startTime = useMemo(() => performance.now(),
|
|
58
66
|
// In case those props changes
|
|
@@ -257,11 +265,37 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
257
265
|
element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', escape);
|
|
258
266
|
};
|
|
259
267
|
}, [ref, cancel]);
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
268
|
+
const handleViewAllItemsClick = useCallback(() => {
|
|
269
|
+
var _api$contextPanel, _api$contextPanel$act;
|
|
270
|
+
const showContextPanel = api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : (_api$contextPanel$act = _api$contextPanel.actions) === null || _api$contextPanel$act === void 0 ? void 0 : _api$contextPanel$act.showPanel;
|
|
271
|
+
if (!showContextPanel || !items) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Opens main editor controls side panel
|
|
276
|
+
showContextPanel({
|
|
277
|
+
id: 'editor-element-insert-sidebar-panel',
|
|
278
|
+
headerComponentElements: {
|
|
279
|
+
headerLabel: elementInsertSidePanel.title,
|
|
280
|
+
HeaderIcon: () => jsx(AddIcon, {
|
|
281
|
+
label: formatMessage(elementInsertSidePanel.title)
|
|
282
|
+
})
|
|
283
|
+
},
|
|
284
|
+
BodyComponent: () => {
|
|
285
|
+
return jsx(SideInsertPanel, {
|
|
286
|
+
items: items,
|
|
287
|
+
onItemInsert: onItemInsert
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}, 'push', INSERT_PANEL_WIDTH);
|
|
291
|
+
|
|
292
|
+
// Closes typeahead
|
|
293
|
+
cancel({
|
|
294
|
+
addPrefixTrigger: true,
|
|
295
|
+
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
296
|
+
forceFocusOnEditor: true
|
|
297
|
+
});
|
|
298
|
+
}, [api, cancel, formatMessage, items, onItemInsert]);
|
|
265
299
|
return jsx(Popup, {
|
|
266
300
|
zIndex: akEditorFloatingDialogZIndex,
|
|
267
301
|
target: anchorElement,
|
|
@@ -286,12 +320,8 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
286
320
|
items: items,
|
|
287
321
|
onItemInsert: onItemInsert,
|
|
288
322
|
query: query,
|
|
289
|
-
setSelectedItem: setSelectedItem
|
|
290
|
-
|
|
291
|
-
items: items,
|
|
292
|
-
editorApi: api,
|
|
293
|
-
onItemInsert: onItemInsert,
|
|
294
|
-
onPanelOpen: handlePanelOpen
|
|
323
|
+
setSelectedItem: setSelectedItem,
|
|
324
|
+
onViewAllItemsClick: Boolean(api === null || api === void 0 ? void 0 : api.contextPanel) ? handleViewAllItemsClick : undefined
|
|
295
325
|
}))));
|
|
296
326
|
});
|
|
297
327
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled */
|
|
2
3
|
/**
|
|
3
4
|
* @jsxRuntime classic
|
|
4
5
|
* @jsx jsx
|
|
5
6
|
*/
|
|
6
7
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
8
|
import { css, jsx } from '@emotion/react';
|
|
10
9
|
import rafSchedule from 'raf-schd';
|
|
10
|
+
import { useIntl } from 'react-intl-next';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
|
+
|
|
11
14
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
15
|
+
import { elementInsertSidePanel } from '@atlaskit/editor-common/messages';
|
|
12
16
|
import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
|
|
13
|
-
import { QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
17
|
+
import { SideInsertPanel, QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
14
18
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
19
|
+
import AddIcon from '@atlaskit/icon/core/add';
|
|
15
20
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
21
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
17
22
|
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../../pm-plugins/constants';
|
|
18
23
|
import { TypeAheadErrorFallback } from '../TypeAheadErrorFallback';
|
|
19
|
-
import { ViewAllButton } from './ViewAllButton';
|
|
20
24
|
var DEFAULT_TYPEAHEAD_MENU_HEIGHT = 520;
|
|
21
25
|
// const DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
22
26
|
|
|
23
27
|
var ITEM_PADDING = 12;
|
|
28
|
+
var INSERT_PANEL_WIDTH = 320;
|
|
24
29
|
var typeAheadContent = css({
|
|
25
30
|
background: "var(--ds-surface-overlay, ".concat(N0, ")"),
|
|
26
31
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
@@ -52,6 +57,8 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
52
57
|
query = props.query,
|
|
53
58
|
setSelectedItem = props.setSelectedItem;
|
|
54
59
|
var ref = useRef(null);
|
|
60
|
+
var _useIntl = useIntl(),
|
|
61
|
+
formatMessage = _useIntl.formatMessage;
|
|
55
62
|
var defaultMenuHeight = DEFAULT_TYPEAHEAD_MENU_HEIGHT;
|
|
56
63
|
var startTime = useMemo(function () {
|
|
57
64
|
return performance.now();
|
|
@@ -253,13 +260,39 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
253
260
|
element === null || element === void 0 || element.removeEventListener('keydown', escape);
|
|
254
261
|
};
|
|
255
262
|
}, [ref, cancel]);
|
|
256
|
-
var
|
|
257
|
-
|
|
263
|
+
var handleViewAllItemsClick = useCallback(function () {
|
|
264
|
+
var _api$contextPanel;
|
|
265
|
+
var showContextPanel = api === null || api === void 0 || (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 || (_api$contextPanel = _api$contextPanel.actions) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.showPanel;
|
|
266
|
+
if (!showContextPanel || !items) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Opens main editor controls side panel
|
|
271
|
+
showContextPanel({
|
|
272
|
+
id: 'editor-element-insert-sidebar-panel',
|
|
273
|
+
headerComponentElements: {
|
|
274
|
+
headerLabel: elementInsertSidePanel.title,
|
|
275
|
+
HeaderIcon: function HeaderIcon() {
|
|
276
|
+
return jsx(AddIcon, {
|
|
277
|
+
label: formatMessage(elementInsertSidePanel.title)
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
BodyComponent: function BodyComponent() {
|
|
282
|
+
return jsx(SideInsertPanel, {
|
|
283
|
+
items: items,
|
|
284
|
+
onItemInsert: onItemInsert
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}, 'push', INSERT_PANEL_WIDTH);
|
|
288
|
+
|
|
289
|
+
// Closes typeahead
|
|
290
|
+
cancel({
|
|
258
291
|
addPrefixTrigger: true,
|
|
259
292
|
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
260
293
|
forceFocusOnEditor: true
|
|
261
294
|
});
|
|
262
|
-
}, [cancel]);
|
|
295
|
+
}, [api, cancel, formatMessage, items, onItemInsert]);
|
|
263
296
|
return jsx(Popup, {
|
|
264
297
|
zIndex: akEditorFloatingDialogZIndex,
|
|
265
298
|
target: anchorElement,
|
|
@@ -284,12 +317,8 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
284
317
|
items: items,
|
|
285
318
|
onItemInsert: onItemInsert,
|
|
286
319
|
query: query,
|
|
287
|
-
setSelectedItem: setSelectedItem
|
|
288
|
-
|
|
289
|
-
items: items,
|
|
290
|
-
editorApi: api,
|
|
291
|
-
onItemInsert: onItemInsert,
|
|
292
|
-
onPanelOpen: handlePanelOpen
|
|
320
|
+
setSelectedItem: setSelectedItem,
|
|
321
|
+
onViewAllItemsClick: Boolean(api === null || api === void 0 ? void 0 : api.contextPanel) ? handleViewAllItemsClick : undefined
|
|
293
322
|
}))));
|
|
294
323
|
});
|
|
295
324
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
50
50
|
"@atlaskit/theme": "^17.0.0",
|
|
51
51
|
"@atlaskit/tmp-editor-statsig": "^3.3.0",
|
|
52
|
-
"@atlaskit/tokens": "^4.
|
|
52
|
+
"@atlaskit/tokens": "^4.3.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.ViewAllButton = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactIntlNext = require("react-intl-next");
|
|
11
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
-
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
13
|
-
var _editorElementBrowser = require("@atlaskit/editor-element-browser");
|
|
14
|
-
var _add = _interopRequireDefault(require("@atlaskit/icon/core/add"));
|
|
15
|
-
var _primitives = require("@atlaskit/primitives");
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
-
var viewAllButtonStyles = (0, _primitives.xcss)({
|
|
19
|
-
background: "var(--ds-background-input-pressed, #FFFFFF)",
|
|
20
|
-
position: 'sticky',
|
|
21
|
-
bottom: '-4px',
|
|
22
|
-
width: '100%',
|
|
23
|
-
height: '40px',
|
|
24
|
-
color: 'color.text.subtle',
|
|
25
|
-
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
26
|
-
':hover': {
|
|
27
|
-
textDecoration: 'underline'
|
|
28
|
-
},
|
|
29
|
-
':active': {
|
|
30
|
-
color: 'color.text'
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
var INSERT_PANEL_WIDTH = 320;
|
|
34
|
-
var ViewAllButton = exports.ViewAllButton = function ViewAllButton(_ref) {
|
|
35
|
-
var items = _ref.items,
|
|
36
|
-
editorApi = _ref.editorApi,
|
|
37
|
-
onItemInsert = _ref.onItemInsert,
|
|
38
|
-
onPanelOpen = _ref.onPanelOpen;
|
|
39
|
-
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
40
|
-
formatMessage = _useIntl.formatMessage;
|
|
41
|
-
var handleClick = (0, _react.useCallback)(function () {
|
|
42
|
-
var _editorApi$contextPan;
|
|
43
|
-
var showContextPanel = editorApi === null || editorApi === void 0 || (_editorApi$contextPan = editorApi.contextPanel) === null || _editorApi$contextPan === void 0 || (_editorApi$contextPan = _editorApi$contextPan.actions) === null || _editorApi$contextPan === void 0 ? void 0 : _editorApi$contextPan.showPanel;
|
|
44
|
-
if (!showContextPanel || !items) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Opens main editor controls side panel
|
|
49
|
-
showContextPanel({
|
|
50
|
-
id: 'editor-element-insert-sidebar-panel',
|
|
51
|
-
headerComponentElements: {
|
|
52
|
-
headerLabel: _messages.elementInsertSidePanel.title,
|
|
53
|
-
HeaderIcon: function HeaderIcon() {
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(_add.default, {
|
|
55
|
-
label: formatMessage(_messages.elementInsertSidePanel.title)
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
BodyComponent: function BodyComponent() {
|
|
60
|
-
return /*#__PURE__*/_react.default.createElement(_editorElementBrowser.SideInsertPanel, {
|
|
61
|
-
items: items,
|
|
62
|
-
onItemInsert: onItemInsert
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}, 'push', INSERT_PANEL_WIDTH);
|
|
66
|
-
|
|
67
|
-
// Closes typeahead
|
|
68
|
-
if (onPanelOpen) {
|
|
69
|
-
onPanelOpen();
|
|
70
|
-
}
|
|
71
|
-
}, [editorApi, formatMessage, items, onItemInsert, onPanelOpen]);
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
|
|
73
|
-
xcss: viewAllButtonStyles,
|
|
74
|
-
onClick: handleClick
|
|
75
|
-
}, formatMessage(_typeAhead.typeAheadListMessages.viewAllInserts));
|
|
76
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { elementInsertSidePanel } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
5
|
-
import { SideInsertPanel } from '@atlaskit/editor-element-browser';
|
|
6
|
-
import AddIcon from '@atlaskit/icon/core/add';
|
|
7
|
-
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
8
|
-
const viewAllButtonStyles = xcss({
|
|
9
|
-
background: "var(--ds-background-input-pressed, #FFFFFF)",
|
|
10
|
-
position: 'sticky',
|
|
11
|
-
bottom: '-4px',
|
|
12
|
-
width: '100%',
|
|
13
|
-
height: '40px',
|
|
14
|
-
color: 'color.text.subtle',
|
|
15
|
-
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
16
|
-
':hover': {
|
|
17
|
-
textDecoration: 'underline'
|
|
18
|
-
},
|
|
19
|
-
':active': {
|
|
20
|
-
color: 'color.text'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const INSERT_PANEL_WIDTH = 320;
|
|
24
|
-
export const ViewAllButton = ({
|
|
25
|
-
items,
|
|
26
|
-
editorApi,
|
|
27
|
-
onItemInsert,
|
|
28
|
-
onPanelOpen
|
|
29
|
-
}) => {
|
|
30
|
-
const {
|
|
31
|
-
formatMessage
|
|
32
|
-
} = useIntl();
|
|
33
|
-
const handleClick = useCallback(() => {
|
|
34
|
-
var _editorApi$contextPan, _editorApi$contextPan2;
|
|
35
|
-
const showContextPanel = editorApi === null || editorApi === void 0 ? void 0 : (_editorApi$contextPan = editorApi.contextPanel) === null || _editorApi$contextPan === void 0 ? void 0 : (_editorApi$contextPan2 = _editorApi$contextPan.actions) === null || _editorApi$contextPan2 === void 0 ? void 0 : _editorApi$contextPan2.showPanel;
|
|
36
|
-
if (!showContextPanel || !items) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Opens main editor controls side panel
|
|
41
|
-
showContextPanel({
|
|
42
|
-
id: 'editor-element-insert-sidebar-panel',
|
|
43
|
-
headerComponentElements: {
|
|
44
|
-
headerLabel: elementInsertSidePanel.title,
|
|
45
|
-
HeaderIcon: () => /*#__PURE__*/React.createElement(AddIcon, {
|
|
46
|
-
label: formatMessage(elementInsertSidePanel.title)
|
|
47
|
-
})
|
|
48
|
-
},
|
|
49
|
-
BodyComponent: () => {
|
|
50
|
-
return /*#__PURE__*/React.createElement(SideInsertPanel, {
|
|
51
|
-
items: items,
|
|
52
|
-
onItemInsert: onItemInsert
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}, 'push', INSERT_PANEL_WIDTH);
|
|
56
|
-
|
|
57
|
-
// Closes typeahead
|
|
58
|
-
if (onPanelOpen) {
|
|
59
|
-
onPanelOpen();
|
|
60
|
-
}
|
|
61
|
-
}, [editorApi, formatMessage, items, onItemInsert, onPanelOpen]);
|
|
62
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
63
|
-
xcss: viewAllButtonStyles,
|
|
64
|
-
onClick: handleClick
|
|
65
|
-
}, formatMessage(typeAheadListMessages.viewAllInserts));
|
|
66
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import { elementInsertSidePanel } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
5
|
-
import { SideInsertPanel } from '@atlaskit/editor-element-browser';
|
|
6
|
-
import AddIcon from '@atlaskit/icon/core/add';
|
|
7
|
-
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
8
|
-
var viewAllButtonStyles = xcss({
|
|
9
|
-
background: "var(--ds-background-input-pressed, #FFFFFF)",
|
|
10
|
-
position: 'sticky',
|
|
11
|
-
bottom: '-4px',
|
|
12
|
-
width: '100%',
|
|
13
|
-
height: '40px',
|
|
14
|
-
color: 'color.text.subtle',
|
|
15
|
-
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
16
|
-
':hover': {
|
|
17
|
-
textDecoration: 'underline'
|
|
18
|
-
},
|
|
19
|
-
':active': {
|
|
20
|
-
color: 'color.text'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
var INSERT_PANEL_WIDTH = 320;
|
|
24
|
-
export var ViewAllButton = function ViewAllButton(_ref) {
|
|
25
|
-
var items = _ref.items,
|
|
26
|
-
editorApi = _ref.editorApi,
|
|
27
|
-
onItemInsert = _ref.onItemInsert,
|
|
28
|
-
onPanelOpen = _ref.onPanelOpen;
|
|
29
|
-
var _useIntl = useIntl(),
|
|
30
|
-
formatMessage = _useIntl.formatMessage;
|
|
31
|
-
var handleClick = useCallback(function () {
|
|
32
|
-
var _editorApi$contextPan;
|
|
33
|
-
var showContextPanel = editorApi === null || editorApi === void 0 || (_editorApi$contextPan = editorApi.contextPanel) === null || _editorApi$contextPan === void 0 || (_editorApi$contextPan = _editorApi$contextPan.actions) === null || _editorApi$contextPan === void 0 ? void 0 : _editorApi$contextPan.showPanel;
|
|
34
|
-
if (!showContextPanel || !items) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Opens main editor controls side panel
|
|
39
|
-
showContextPanel({
|
|
40
|
-
id: 'editor-element-insert-sidebar-panel',
|
|
41
|
-
headerComponentElements: {
|
|
42
|
-
headerLabel: elementInsertSidePanel.title,
|
|
43
|
-
HeaderIcon: function HeaderIcon() {
|
|
44
|
-
return /*#__PURE__*/React.createElement(AddIcon, {
|
|
45
|
-
label: formatMessage(elementInsertSidePanel.title)
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
BodyComponent: function BodyComponent() {
|
|
50
|
-
return /*#__PURE__*/React.createElement(SideInsertPanel, {
|
|
51
|
-
items: items,
|
|
52
|
-
onItemInsert: onItemInsert
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}, 'push', INSERT_PANEL_WIDTH);
|
|
56
|
-
|
|
57
|
-
// Closes typeahead
|
|
58
|
-
if (onPanelOpen) {
|
|
59
|
-
onPanelOpen();
|
|
60
|
-
}
|
|
61
|
-
}, [editorApi, formatMessage, items, onItemInsert, onPanelOpen]);
|
|
62
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
63
|
-
xcss: viewAllButtonStyles,
|
|
64
|
-
onClick: handleClick
|
|
65
|
-
}, formatMessage(typeAheadListMessages.viewAllInserts));
|
|
66
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
|
-
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { SideInsertPanelItem } from '@atlaskit/editor-element-browser';
|
|
5
|
-
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
6
|
-
type ViewAllButtonProps = {
|
|
7
|
-
items: SideInsertPanelItem[];
|
|
8
|
-
onItemInsert: (mode: SelectItemMode, index: number) => void;
|
|
9
|
-
onPanelOpen?: () => void;
|
|
10
|
-
editorApi?: PublicPluginAPI<ContextPanelPlugin>;
|
|
11
|
-
};
|
|
12
|
-
export declare const ViewAllButton: ({ items, editorApi, onItemInsert, onPanelOpen, }: ViewAllButtonProps) => React.JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
|
-
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { SideInsertPanelItem } from '@atlaskit/editor-element-browser';
|
|
5
|
-
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
6
|
-
type ViewAllButtonProps = {
|
|
7
|
-
items: SideInsertPanelItem[];
|
|
8
|
-
onItemInsert: (mode: SelectItemMode, index: number) => void;
|
|
9
|
-
onPanelOpen?: () => void;
|
|
10
|
-
editorApi?: PublicPluginAPI<ContextPanelPlugin>;
|
|
11
|
-
};
|
|
12
|
-
export declare const ViewAllButton: ({ items, editorApi, onItemInsert, onPanelOpen, }: ViewAllButtonProps) => React.JSX.Element;
|
|
13
|
-
export {};
|