@atlaskit/editor-plugin-type-ahead 1.13.2 → 1.13.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 +23 -0
- package/dist/cjs/ui/modern/TypeAheadPopup.js +14 -20
- package/dist/cjs/ui/modern/ViewAllButton.js +76 -0
- package/dist/es2019/ui/modern/TypeAheadPopup.js +12 -20
- package/dist/es2019/ui/modern/ViewAllButton.js +66 -0
- package/dist/esm/ui/modern/TypeAheadPopup.js +14 -20
- package/dist/esm/ui/modern/ViewAllButton.js +66 -0
- package/dist/types/typeAheadPluginType.d.ts +3 -1
- package/dist/types/ui/modern/ViewAllButton.d.ts +13 -0
- package/dist/types-ts4.5/typeAheadPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/modern/ViewAllButton.d.ts +13 -0
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 1.13.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.13.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#115416](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115416)
|
|
14
|
+
[`7be1394d86a9c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7be1394d86a9c) -
|
|
15
|
+
Fixes undeclared dependency on @atlaskit/icon in package.json dependencies from version 1.13.3.
|
|
16
|
+
|
|
17
|
+
## 1.13.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#114119](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114119)
|
|
22
|
+
[`32771ea219498`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/32771ea219498) -
|
|
23
|
+
[ux] Opens right rail from the QuickInsert menu via context panel plugin's action
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 1.13.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -14,10 +14,10 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
14
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
15
|
var _editorElementBrowser = require("@atlaskit/editor-element-browser");
|
|
16
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
|
-
var _primitives = require("@atlaskit/primitives");
|
|
18
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
18
|
var _constants = require("../../pm-plugins/constants");
|
|
20
19
|
var _TypeAheadErrorFallback = require("../TypeAheadErrorFallback");
|
|
20
|
+
var _ViewAllButton = require("./ViewAllButton");
|
|
21
21
|
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); }
|
|
22
22
|
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; }
|
|
23
23
|
/**
|
|
@@ -46,21 +46,6 @@ var typeAheadContent = (0, _react2.css)({
|
|
|
46
46
|
// maxHeight: `${DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW}px`,
|
|
47
47
|
// });
|
|
48
48
|
|
|
49
|
-
var viewAllButtonStyles = (0, _primitives.xcss)({
|
|
50
|
-
background: "var(--ds-background-input-pressed, #FFFFFF)",
|
|
51
|
-
position: 'sticky',
|
|
52
|
-
bottom: '-4px',
|
|
53
|
-
width: '100%',
|
|
54
|
-
height: '40px',
|
|
55
|
-
color: 'color.text.subtle',
|
|
56
|
-
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
57
|
-
':hover': {
|
|
58
|
-
textDecoration: 'underline'
|
|
59
|
-
},
|
|
60
|
-
':active': {
|
|
61
|
-
color: 'color.text'
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
49
|
var OFFSET = [0, 8];
|
|
65
50
|
var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
|
|
66
51
|
var triggerHandler = props.triggerHandler,
|
|
@@ -250,6 +235,13 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
250
235
|
element === null || element === void 0 || element.removeEventListener('keydown', escape);
|
|
251
236
|
};
|
|
252
237
|
}, [ref, cancel]);
|
|
238
|
+
var handlePanelOpen = (0, _react.useCallback)(function () {
|
|
239
|
+
return cancel({
|
|
240
|
+
addPrefixTrigger: true,
|
|
241
|
+
setSelectionAt: _constants.CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
242
|
+
forceFocusOnEditor: true
|
|
243
|
+
});
|
|
244
|
+
}, [cancel]);
|
|
253
245
|
return (0, _react2.jsx)(_ui.Popup, {
|
|
254
246
|
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
255
247
|
target: anchorElement,
|
|
@@ -274,9 +266,11 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
274
266
|
items: items,
|
|
275
267
|
onItemInsert: onItemInsert,
|
|
276
268
|
query: query
|
|
277
|
-
}), (0, _react2.jsx)(
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
269
|
+
}), (api === null || api === void 0 ? void 0 : api.contextPanel) && (0, _react2.jsx)(_ViewAllButton.ViewAllButton, {
|
|
270
|
+
items: items,
|
|
271
|
+
editorApi: api,
|
|
272
|
+
onItemInsert: onItemInsert,
|
|
273
|
+
onPanelOpen: handlePanelOpen
|
|
274
|
+
}))));
|
|
281
275
|
});
|
|
282
276
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
};
|
|
@@ -11,10 +11,10 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/anal
|
|
|
11
11
|
import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
13
13
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
14
|
-
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
15
14
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
16
15
|
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../../pm-plugins/constants';
|
|
17
16
|
import { TypeAheadErrorFallback } from '../TypeAheadErrorFallback';
|
|
17
|
+
import { ViewAllButton } from './ViewAllButton';
|
|
18
18
|
const DEFAULT_TYPEAHEAD_MENU_HEIGHT = 520;
|
|
19
19
|
// const DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
20
20
|
|
|
@@ -34,21 +34,6 @@ const typeAheadContent = css({
|
|
|
34
34
|
// maxHeight: `${DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW}px`,
|
|
35
35
|
// });
|
|
36
36
|
|
|
37
|
-
const viewAllButtonStyles = xcss({
|
|
38
|
-
background: "var(--ds-background-input-pressed, #FFFFFF)",
|
|
39
|
-
position: 'sticky',
|
|
40
|
-
bottom: '-4px',
|
|
41
|
-
width: '100%',
|
|
42
|
-
height: '40px',
|
|
43
|
-
color: 'color.text.subtle',
|
|
44
|
-
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
45
|
-
':hover': {
|
|
46
|
-
textDecoration: 'underline'
|
|
47
|
-
},
|
|
48
|
-
':active': {
|
|
49
|
-
color: 'color.text'
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
37
|
const OFFSET = [0, 8];
|
|
53
38
|
export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
54
39
|
const {
|
|
@@ -243,6 +228,11 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
243
228
|
element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', escape);
|
|
244
229
|
};
|
|
245
230
|
}, [ref, cancel]);
|
|
231
|
+
const handlePanelOpen = useCallback(() => cancel({
|
|
232
|
+
addPrefixTrigger: true,
|
|
233
|
+
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
234
|
+
forceFocusOnEditor: true
|
|
235
|
+
}), [cancel]);
|
|
246
236
|
return jsx(Popup, {
|
|
247
237
|
zIndex: akEditorFloatingDialogZIndex,
|
|
248
238
|
target: anchorElement,
|
|
@@ -267,9 +257,11 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
267
257
|
items: items,
|
|
268
258
|
onItemInsert: onItemInsert,
|
|
269
259
|
query: query
|
|
270
|
-
}), jsx(
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
260
|
+
}), (api === null || api === void 0 ? void 0 : api.contextPanel) && jsx(ViewAllButton, {
|
|
261
|
+
items: items,
|
|
262
|
+
editorApi: api,
|
|
263
|
+
onItemInsert: onItemInsert,
|
|
264
|
+
onPanelOpen: handlePanelOpen
|
|
265
|
+
}))));
|
|
274
266
|
});
|
|
275
267
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
};
|
|
@@ -12,10 +12,10 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/anal
|
|
|
12
12
|
import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
|
|
13
13
|
import { QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
14
14
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
15
|
-
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
16
15
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
17
16
|
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../../pm-plugins/constants';
|
|
18
17
|
import { TypeAheadErrorFallback } from '../TypeAheadErrorFallback';
|
|
18
|
+
import { ViewAllButton } from './ViewAllButton';
|
|
19
19
|
var DEFAULT_TYPEAHEAD_MENU_HEIGHT = 520;
|
|
20
20
|
// const DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
21
21
|
|
|
@@ -35,21 +35,6 @@ var typeAheadContent = css({
|
|
|
35
35
|
// maxHeight: `${DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW}px`,
|
|
36
36
|
// });
|
|
37
37
|
|
|
38
|
-
var viewAllButtonStyles = xcss({
|
|
39
|
-
background: "var(--ds-background-input-pressed, #FFFFFF)",
|
|
40
|
-
position: 'sticky',
|
|
41
|
-
bottom: '-4px',
|
|
42
|
-
width: '100%',
|
|
43
|
-
height: '40px',
|
|
44
|
-
color: 'color.text.subtle',
|
|
45
|
-
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
46
|
-
':hover': {
|
|
47
|
-
textDecoration: 'underline'
|
|
48
|
-
},
|
|
49
|
-
':active': {
|
|
50
|
-
color: 'color.text'
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
38
|
var OFFSET = [0, 8];
|
|
54
39
|
export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
55
40
|
var triggerHandler = props.triggerHandler,
|
|
@@ -239,6 +224,13 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
239
224
|
element === null || element === void 0 || element.removeEventListener('keydown', escape);
|
|
240
225
|
};
|
|
241
226
|
}, [ref, cancel]);
|
|
227
|
+
var handlePanelOpen = useCallback(function () {
|
|
228
|
+
return cancel({
|
|
229
|
+
addPrefixTrigger: true,
|
|
230
|
+
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
231
|
+
forceFocusOnEditor: true
|
|
232
|
+
});
|
|
233
|
+
}, [cancel]);
|
|
242
234
|
return jsx(Popup, {
|
|
243
235
|
zIndex: akEditorFloatingDialogZIndex,
|
|
244
236
|
target: anchorElement,
|
|
@@ -263,9 +255,11 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
263
255
|
items: items,
|
|
264
256
|
onItemInsert: onItemInsert,
|
|
265
257
|
query: query
|
|
266
|
-
}), jsx(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
258
|
+
}), (api === null || api === void 0 ? void 0 : api.contextPanel) && jsx(ViewAllButton, {
|
|
259
|
+
items: items,
|
|
260
|
+
editorApi: api,
|
|
261
|
+
onItemInsert: onItemInsert,
|
|
262
|
+
onPanelOpen: handlePanelOpen
|
|
263
|
+
}))));
|
|
270
264
|
});
|
|
271
265
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
};
|
|
@@ -2,6 +2,7 @@ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
|
2
2
|
import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
5
|
+
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
6
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
6
7
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
7
8
|
import { type TypeAheadInputMethod, type TypeAheadPluginOptions, type TypeAheadPluginSharedState } from './types';
|
|
@@ -30,7 +31,8 @@ export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
|
30
31
|
dependencies: [
|
|
31
32
|
OptionalPlugin<AnalyticsPlugin>,
|
|
32
33
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
33
|
-
OptionalPlugin<ConnectivityPlugin
|
|
34
|
+
OptionalPlugin<ConnectivityPlugin>,
|
|
35
|
+
OptionalPlugin<ContextPanelPlugin>
|
|
34
36
|
];
|
|
35
37
|
sharedState: TypeAheadPluginSharedState;
|
|
36
38
|
actions: {
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
|
@@ -2,6 +2,7 @@ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
|
2
2
|
import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
5
|
+
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
6
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
6
7
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
7
8
|
import { type TypeAheadInputMethod, type TypeAheadPluginOptions, type TypeAheadPluginSharedState } from './types';
|
|
@@ -30,7 +31,8 @@ export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
|
30
31
|
dependencies: [
|
|
31
32
|
OptionalPlugin<AnalyticsPlugin>,
|
|
32
33
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
33
|
-
OptionalPlugin<ConnectivityPlugin
|
|
34
|
+
OptionalPlugin<ConnectivityPlugin>,
|
|
35
|
+
OptionalPlugin<ContextPanelPlugin>
|
|
34
36
|
];
|
|
35
37
|
sharedState: TypeAheadPluginSharedState;
|
|
36
38
|
actions: {
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.5",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,18 +32,20 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.2.1",
|
|
35
|
-
"@atlaskit/editor-common": "^99.
|
|
36
|
-
"@atlaskit/editor-element-browser": "^0.0.
|
|
35
|
+
"@atlaskit/editor-common": "^99.17.0",
|
|
36
|
+
"@atlaskit/editor-element-browser": "^0.0.2",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
38
38
|
"@atlaskit/editor-plugin-connectivity": "^1.3.0",
|
|
39
|
+
"@atlaskit/editor-plugin-context-panel": "^2.1.0",
|
|
39
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
41
|
+
"@atlaskit/editor-shared-styles": "^3.3.0",
|
|
41
42
|
"@atlaskit/heading": "^4.1.0",
|
|
43
|
+
"@atlaskit/icon": "^23.9.0",
|
|
42
44
|
"@atlaskit/menu": "^2.14.0",
|
|
43
|
-
"@atlaskit/platform-feature-flags": "^1.
|
|
45
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
46
|
"@atlaskit/primitives": "^13.5.0",
|
|
45
47
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
46
|
-
"@atlaskit/theme": "^
|
|
48
|
+
"@atlaskit/theme": "^16.0.0",
|
|
47
49
|
"@atlaskit/tmp-editor-statsig": "^2.46.0",
|
|
48
50
|
"@atlaskit/tokens": "^3.3.0",
|
|
49
51
|
"@babel/runtime": "^7.0.0",
|