@atlaskit/editor-plugin-synced-block 8.3.15 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/ui/SyncedLocationDropdown.js +137 -35
- package/dist/cjs/ui/floating-toolbar.js +3 -2
- package/dist/es2019/ui/SyncedLocationDropdown.js +109 -10
- package/dist/es2019/ui/floating-toolbar.js +3 -2
- package/dist/esm/ui/SyncedLocationDropdown.js +138 -36
- package/dist/esm/ui/floating-toolbar.js +3 -2
- package/dist/types/ui/SyncedLocationDropdown.d.ts +3 -2
- package/dist/types-ts4.5/ui/SyncedLocationDropdown.d.ts +3 -2
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6644994a61d9c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6644994a61d9c) -
|
|
8
|
+
Add editor-positioned dropdown support for custom floating toolbar items
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 8.3.15
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -22,6 +22,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
22
22
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
23
23
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
24
24
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
25
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
25
26
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
26
27
|
var _icon = require("@atlaskit/icon");
|
|
27
28
|
var _pageLiveDoc = _interopRequireDefault(require("@atlaskit/icon-lab/core/page-live-doc"));
|
|
@@ -36,6 +37,7 @@ var _subtasks = _interopRequireDefault(require("@atlaskit/icon/core/subtasks"));
|
|
|
36
37
|
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
37
38
|
var _logo = require("@atlaskit/logo");
|
|
38
39
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
40
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
39
41
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
40
42
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
41
43
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
@@ -50,6 +52,7 @@ var dropdownItemStyles = null;
|
|
|
50
52
|
|
|
51
53
|
// logo icon does not fit in ADS IconTile, hence we need custom styles to match with other icons
|
|
52
54
|
var logoTileStyles = null;
|
|
55
|
+
var SYNCED_LOCATIONS_DROPDOWN_TEST_ID = 'synced-block-synced-locations-dropdown';
|
|
53
56
|
var styles = {
|
|
54
57
|
title: "_1reo15vq _18m915vq _syazazsu _1bto1l2s _o5721q9c",
|
|
55
58
|
note: "_syaz1rpy _o5721q9c",
|
|
@@ -305,27 +308,133 @@ var SyncedLocationDropdown = exports.SyncedLocationDropdown = function SyncedLoc
|
|
|
305
308
|
intl = _ref4.intl,
|
|
306
309
|
isSource = _ref4.isSource,
|
|
307
310
|
localId = _ref4.localId,
|
|
308
|
-
api = _ref4.api
|
|
311
|
+
api = _ref4.api,
|
|
312
|
+
floatingToolbarRenderContext = _ref4.floatingToolbarRenderContext;
|
|
313
|
+
if ((0, _platformFeatureFlags.fg)('platform_synced_block_patch_13')) {
|
|
314
|
+
return /*#__PURE__*/React.createElement(EditorPositionedSyncedLocationDropdown, {
|
|
315
|
+
syncBlockStore: syncBlockStore,
|
|
316
|
+
resourceId: resourceId,
|
|
317
|
+
intl: intl,
|
|
318
|
+
isSource: isSource,
|
|
319
|
+
localId: localId,
|
|
320
|
+
api: api,
|
|
321
|
+
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
return /*#__PURE__*/React.createElement(LegacySyncedLocationDropdown, {
|
|
325
|
+
syncBlockStore: syncBlockStore,
|
|
326
|
+
resourceId: resourceId,
|
|
327
|
+
intl: intl,
|
|
328
|
+
isSource: isSource,
|
|
329
|
+
localId: localId,
|
|
330
|
+
api: api
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
var EditorPositionedSyncedLocationDropdown = function EditorPositionedSyncedLocationDropdown(_ref5) {
|
|
334
|
+
var syncBlockStore = _ref5.syncBlockStore,
|
|
335
|
+
resourceId = _ref5.resourceId,
|
|
336
|
+
intl = _ref5.intl,
|
|
337
|
+
isSource = _ref5.isSource,
|
|
338
|
+
localId = _ref5.localId,
|
|
339
|
+
api = _ref5.api,
|
|
340
|
+
floatingToolbarRenderContext = _ref5.floatingToolbarRenderContext;
|
|
309
341
|
var formatMessage = intl.formatMessage;
|
|
310
342
|
var triggerTitle = formatMessage(_messages.syncBlockMessages.syncedLocationDropdownTitle);
|
|
311
343
|
var _useState = (0, _react.useState)(false),
|
|
312
344
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
313
345
|
isOpen = _useState2[0],
|
|
314
346
|
setIsOpen = _useState2[1];
|
|
347
|
+
var content = isOpen ? /*#__PURE__*/React.createElement(DropdownContent, {
|
|
348
|
+
syncBlockStore: syncBlockStore,
|
|
349
|
+
resourceId: resourceId,
|
|
350
|
+
intl: intl,
|
|
351
|
+
isSource: isSource,
|
|
352
|
+
localId: localId,
|
|
353
|
+
api: api
|
|
354
|
+
}) : null;
|
|
355
|
+
var toggleOpen = (0, _react.useCallback)(function () {
|
|
356
|
+
setIsOpen(function (currentIsOpen) {
|
|
357
|
+
return !currentIsOpen;
|
|
358
|
+
});
|
|
359
|
+
}, []);
|
|
360
|
+
var closeDropdown = (0, _react.useCallback)(function () {
|
|
361
|
+
setIsOpen(false);
|
|
362
|
+
}, []);
|
|
363
|
+
var setDisableParentScroll = floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.setDisableParentScroll;
|
|
364
|
+
(0, _react.useEffect)(function () {
|
|
365
|
+
if (!isOpen) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
setDisableParentScroll === null || setDisableParentScroll === void 0 || setDisableParentScroll(true);
|
|
369
|
+
return function () {
|
|
370
|
+
setDisableParentScroll === null || setDisableParentScroll === void 0 || setDisableParentScroll(false);
|
|
371
|
+
};
|
|
372
|
+
}, [isOpen, setDisableParentScroll]);
|
|
373
|
+
var trigger = (0, _react.useMemo)(function () {
|
|
374
|
+
return /*#__PURE__*/React.createElement(_ui.FloatingToolbarButton, {
|
|
375
|
+
areAnyNewToolbarFlagsEnabled: true,
|
|
376
|
+
selected: isOpen,
|
|
377
|
+
iconAfter: /*#__PURE__*/React.createElement(_chevronDown.default, {
|
|
378
|
+
color: "currentColor",
|
|
379
|
+
spacing: "spacious",
|
|
380
|
+
label: "",
|
|
381
|
+
size: "small"
|
|
382
|
+
}),
|
|
383
|
+
onClick: toggleOpen,
|
|
384
|
+
ariaHasPopup: true
|
|
385
|
+
}, triggerTitle);
|
|
386
|
+
}, [isOpen, toggleOpen, triggerTitle]);
|
|
387
|
+
return /*#__PURE__*/React.createElement(_uiMenu.DropdownContainer, {
|
|
388
|
+
testId: SYNCED_LOCATIONS_DROPDOWN_TEST_ID,
|
|
389
|
+
isOpen: isOpen,
|
|
390
|
+
trigger: trigger,
|
|
391
|
+
handleClickOutside: closeDropdown,
|
|
392
|
+
handleEscapeKeydown: closeDropdown,
|
|
393
|
+
mountTo: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsMountPoint,
|
|
394
|
+
boundariesElement: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsBoundariesElement,
|
|
395
|
+
scrollableElement: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsScrollableElement
|
|
396
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
397
|
+
,
|
|
398
|
+
arrowKeyNavigationProviderOptions: {
|
|
399
|
+
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
400
|
+
}
|
|
401
|
+
}, content);
|
|
402
|
+
};
|
|
403
|
+
var LegacySyncedLocationDropdown = function LegacySyncedLocationDropdown(_ref6) {
|
|
404
|
+
var syncBlockStore = _ref6.syncBlockStore,
|
|
405
|
+
resourceId = _ref6.resourceId,
|
|
406
|
+
intl = _ref6.intl,
|
|
407
|
+
isSource = _ref6.isSource,
|
|
408
|
+
localId = _ref6.localId,
|
|
409
|
+
api = _ref6.api;
|
|
410
|
+
var formatMessage = intl.formatMessage;
|
|
411
|
+
var triggerTitle = formatMessage(_messages.syncBlockMessages.syncedLocationDropdownTitle);
|
|
412
|
+
var _useState3 = (0, _react.useState)(false),
|
|
413
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
414
|
+
isOpen = _useState4[0],
|
|
415
|
+
setIsOpen = _useState4[1];
|
|
416
|
+
var content = isOpen ? /*#__PURE__*/React.createElement(DropdownContent, {
|
|
417
|
+
syncBlockStore: syncBlockStore,
|
|
418
|
+
resourceId: resourceId,
|
|
419
|
+
intl: intl,
|
|
420
|
+
isSource: isSource,
|
|
421
|
+
localId: localId,
|
|
422
|
+
api: api
|
|
423
|
+
}) : null;
|
|
315
424
|
return /*#__PURE__*/React.createElement(_dropdownMenu.default, {
|
|
316
425
|
isOpen: isOpen
|
|
317
426
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
318
427
|
,
|
|
319
|
-
onOpenChange: function onOpenChange(
|
|
320
|
-
var isOpen =
|
|
428
|
+
onOpenChange: function onOpenChange(_ref7) {
|
|
429
|
+
var isOpen = _ref7.isOpen;
|
|
321
430
|
return setIsOpen(isOpen);
|
|
322
431
|
},
|
|
323
|
-
testId:
|
|
432
|
+
testId: SYNCED_LOCATIONS_DROPDOWN_TEST_ID
|
|
324
433
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
325
434
|
,
|
|
326
|
-
trigger: function trigger(
|
|
327
|
-
var triggerRef =
|
|
328
|
-
triggerProps = (0, _objectWithoutProperties2.default)(
|
|
435
|
+
trigger: function trigger(_ref8) {
|
|
436
|
+
var triggerRef = _ref8.triggerRef,
|
|
437
|
+
triggerProps = (0, _objectWithoutProperties2.default)(_ref8, _excluded);
|
|
329
438
|
return /*#__PURE__*/React.createElement(_ui.FloatingToolbarButton, (0, _extends2.default)({
|
|
330
439
|
ref: triggerRef,
|
|
331
440
|
areAnyNewToolbarFlagsEnabled: true,
|
|
@@ -339,35 +448,28 @@ var SyncedLocationDropdown = exports.SyncedLocationDropdown = function SyncedLoc
|
|
|
339
448
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
340
449
|
}, triggerProps), triggerTitle);
|
|
341
450
|
}
|
|
342
|
-
},
|
|
343
|
-
syncBlockStore: syncBlockStore,
|
|
344
|
-
resourceId: resourceId,
|
|
345
|
-
intl: intl,
|
|
346
|
-
isSource: isSource,
|
|
347
|
-
localId: localId,
|
|
348
|
-
api: api
|
|
349
|
-
}));
|
|
451
|
+
}, content);
|
|
350
452
|
};
|
|
351
|
-
var DropdownContent = function DropdownContent(
|
|
352
|
-
var syncBlockStore =
|
|
353
|
-
resourceId =
|
|
354
|
-
intl =
|
|
355
|
-
isSource =
|
|
356
|
-
localId =
|
|
357
|
-
api =
|
|
453
|
+
var DropdownContent = function DropdownContent(_ref9) {
|
|
454
|
+
var syncBlockStore = _ref9.syncBlockStore,
|
|
455
|
+
resourceId = _ref9.resourceId,
|
|
456
|
+
intl = _ref9.intl,
|
|
457
|
+
isSource = _ref9.isSource,
|
|
458
|
+
localId = _ref9.localId,
|
|
459
|
+
api = _ref9.api;
|
|
358
460
|
var formatMessage = intl.formatMessage;
|
|
359
|
-
var
|
|
360
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
361
|
-
fetchStatus = _useState4[0],
|
|
362
|
-
setFetchStatus = _useState4[1];
|
|
363
|
-
var _useState5 = (0, _react.useState)([]),
|
|
461
|
+
var _useState5 = (0, _react.useState)('none'),
|
|
364
462
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
365
|
-
|
|
366
|
-
|
|
463
|
+
fetchStatus = _useState6[0],
|
|
464
|
+
setFetchStatus = _useState6[1];
|
|
465
|
+
var _useState7 = (0, _react.useState)([]),
|
|
466
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
467
|
+
referenceData = _useState8[0],
|
|
468
|
+
setReferenceData = _useState8[1];
|
|
367
469
|
(0, _react.useEffect)(function () {
|
|
368
470
|
setFetchStatus('loading');
|
|
369
471
|
var getReferenceData = /*#__PURE__*/function () {
|
|
370
|
-
var
|
|
472
|
+
var _ref0 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
371
473
|
var response;
|
|
372
474
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
373
475
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -392,7 +494,7 @@ var DropdownContent = function DropdownContent(_ref7) {
|
|
|
392
494
|
}, _callee);
|
|
393
495
|
}));
|
|
394
496
|
return function getReferenceData() {
|
|
395
|
-
return
|
|
497
|
+
return _ref0.apply(this, arguments);
|
|
396
498
|
};
|
|
397
499
|
}();
|
|
398
500
|
getReferenceData();
|
|
@@ -470,8 +572,8 @@ var DropdownContent = function DropdownContent(_ref7) {
|
|
|
470
572
|
var LoadingScreen = function LoadingScreen() {
|
|
471
573
|
return /*#__PURE__*/React.createElement(_compiled.Box, null, /*#__PURE__*/React.createElement(_spinner.default, null));
|
|
472
574
|
};
|
|
473
|
-
var ErrorScreen = function ErrorScreen(
|
|
474
|
-
var formatMessage =
|
|
575
|
+
var ErrorScreen = function ErrorScreen(_ref1) {
|
|
576
|
+
var formatMessage = _ref1.formatMessage;
|
|
475
577
|
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
476
578
|
xcss: styles.errorContainer,
|
|
477
579
|
testId: "synced-locations-dropdown-content-error"
|
|
@@ -487,8 +589,8 @@ var ErrorScreen = function ErrorScreen(_ref9) {
|
|
|
487
589
|
size: "medium"
|
|
488
590
|
}, formatMessage(_messages.syncBlockMessages.syncedLocationDropdownError)));
|
|
489
591
|
};
|
|
490
|
-
var NoResultScreen = function NoResultScreen(
|
|
491
|
-
var formatMessage =
|
|
592
|
+
var NoResultScreen = function NoResultScreen(_ref10) {
|
|
593
|
+
var formatMessage = _ref10.formatMessage;
|
|
492
594
|
return /*#__PURE__*/React.createElement(_compiled.Stack, {
|
|
493
595
|
xcss: styles.noResultsContainer,
|
|
494
596
|
space: "space.100",
|
|
@@ -69,14 +69,15 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
69
69
|
var syncedLocation = {
|
|
70
70
|
type: 'custom',
|
|
71
71
|
fallback: [],
|
|
72
|
-
render: function render() {
|
|
72
|
+
render: function render(_view, _idx, _dispatchAnalyticsEvent, floatingToolbarRenderContext) {
|
|
73
73
|
return /*#__PURE__*/_react.default.createElement(_SyncedLocationDropdown.SyncedLocationDropdown, {
|
|
74
74
|
syncBlockStore: syncBlockStore,
|
|
75
75
|
resourceId: resourceId,
|
|
76
76
|
localId: localId,
|
|
77
77
|
intl: intl,
|
|
78
78
|
isSource: isBodiedSyncBlock,
|
|
79
|
-
api: api
|
|
79
|
+
api: api,
|
|
80
|
+
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
};
|
|
@@ -3,13 +3,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import "./SyncedLocationDropdown.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
6
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { cx } from '@compiled/react';
|
|
8
8
|
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
9
9
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { SYNCED_BLOCKS_DOCUMENTATION_URL } from '@atlaskit/editor-common/sync-block';
|
|
12
12
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
13
|
+
import { ArrowKeyNavigationType, DropdownContainer } from '@atlaskit/editor-common/ui-menu';
|
|
13
14
|
import { getPageIdAndTypeFromConfluencePageAri } from '@atlaskit/editor-synced-block-provider';
|
|
14
15
|
import { IconTile } from '@atlaskit/icon';
|
|
15
16
|
import PageLiveDocIcon from '@atlaskit/icon-lab/core/page-live-doc';
|
|
@@ -24,6 +25,7 @@ import SubtaskIcon from '@atlaskit/icon/core/subtasks';
|
|
|
24
25
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
25
26
|
import { ConfluenceIcon, JiraIcon, AtlassianIcon } from '@atlaskit/logo';
|
|
26
27
|
import Lozenge from '@atlaskit/lozenge';
|
|
28
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
29
|
import { Box, Text, Inline, Anchor, Stack } from '@atlaskit/primitives/compiled';
|
|
28
30
|
import Spinner from '@atlaskit/spinner';
|
|
29
31
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -33,6 +35,7 @@ const dropdownItemStyles = null;
|
|
|
33
35
|
|
|
34
36
|
// logo icon does not fit in ADS IconTile, hence we need custom styles to match with other icons
|
|
35
37
|
const logoTileStyles = null;
|
|
38
|
+
const SYNCED_LOCATIONS_DROPDOWN_TEST_ID = 'synced-block-synced-locations-dropdown';
|
|
36
39
|
const styles = {
|
|
37
40
|
title: "_1reo15vq _18m915vq _syazazsu _1bto1l2s _o5721q9c",
|
|
38
41
|
note: "_syaz1rpy _o5721q9c",
|
|
@@ -278,6 +281,101 @@ export const processReferenceData = (referenceData, intl) => {
|
|
|
278
281
|
return sortedReferences;
|
|
279
282
|
};
|
|
280
283
|
export const SyncedLocationDropdown = ({
|
|
284
|
+
syncBlockStore,
|
|
285
|
+
resourceId,
|
|
286
|
+
intl,
|
|
287
|
+
isSource,
|
|
288
|
+
localId,
|
|
289
|
+
api,
|
|
290
|
+
floatingToolbarRenderContext
|
|
291
|
+
}) => {
|
|
292
|
+
if (fg('platform_synced_block_patch_13')) {
|
|
293
|
+
return /*#__PURE__*/React.createElement(EditorPositionedSyncedLocationDropdown, {
|
|
294
|
+
syncBlockStore: syncBlockStore,
|
|
295
|
+
resourceId: resourceId,
|
|
296
|
+
intl: intl,
|
|
297
|
+
isSource: isSource,
|
|
298
|
+
localId: localId,
|
|
299
|
+
api: api,
|
|
300
|
+
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
return /*#__PURE__*/React.createElement(LegacySyncedLocationDropdown, {
|
|
304
|
+
syncBlockStore: syncBlockStore,
|
|
305
|
+
resourceId: resourceId,
|
|
306
|
+
intl: intl,
|
|
307
|
+
isSource: isSource,
|
|
308
|
+
localId: localId,
|
|
309
|
+
api: api
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
const EditorPositionedSyncedLocationDropdown = ({
|
|
313
|
+
syncBlockStore,
|
|
314
|
+
resourceId,
|
|
315
|
+
intl,
|
|
316
|
+
isSource,
|
|
317
|
+
localId,
|
|
318
|
+
api,
|
|
319
|
+
floatingToolbarRenderContext
|
|
320
|
+
}) => {
|
|
321
|
+
const {
|
|
322
|
+
formatMessage
|
|
323
|
+
} = intl;
|
|
324
|
+
const triggerTitle = formatMessage(messages.syncedLocationDropdownTitle);
|
|
325
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
326
|
+
const content = isOpen ? /*#__PURE__*/React.createElement(DropdownContent, {
|
|
327
|
+
syncBlockStore: syncBlockStore,
|
|
328
|
+
resourceId: resourceId,
|
|
329
|
+
intl: intl,
|
|
330
|
+
isSource: isSource,
|
|
331
|
+
localId: localId,
|
|
332
|
+
api: api
|
|
333
|
+
}) : null;
|
|
334
|
+
const toggleOpen = useCallback(() => {
|
|
335
|
+
setIsOpen(currentIsOpen => !currentIsOpen);
|
|
336
|
+
}, []);
|
|
337
|
+
const closeDropdown = useCallback(() => {
|
|
338
|
+
setIsOpen(false);
|
|
339
|
+
}, []);
|
|
340
|
+
const setDisableParentScroll = floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.setDisableParentScroll;
|
|
341
|
+
useEffect(() => {
|
|
342
|
+
if (!isOpen) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
setDisableParentScroll === null || setDisableParentScroll === void 0 ? void 0 : setDisableParentScroll(true);
|
|
346
|
+
return () => {
|
|
347
|
+
setDisableParentScroll === null || setDisableParentScroll === void 0 ? void 0 : setDisableParentScroll(false);
|
|
348
|
+
};
|
|
349
|
+
}, [isOpen, setDisableParentScroll]);
|
|
350
|
+
const trigger = useMemo(() => /*#__PURE__*/React.createElement(Button, {
|
|
351
|
+
areAnyNewToolbarFlagsEnabled: true,
|
|
352
|
+
selected: isOpen,
|
|
353
|
+
iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
354
|
+
color: "currentColor",
|
|
355
|
+
spacing: "spacious",
|
|
356
|
+
label: "",
|
|
357
|
+
size: "small"
|
|
358
|
+
}),
|
|
359
|
+
onClick: toggleOpen,
|
|
360
|
+
ariaHasPopup: true
|
|
361
|
+
}, triggerTitle), [isOpen, toggleOpen, triggerTitle]);
|
|
362
|
+
return /*#__PURE__*/React.createElement(DropdownContainer, {
|
|
363
|
+
testId: SYNCED_LOCATIONS_DROPDOWN_TEST_ID,
|
|
364
|
+
isOpen: isOpen,
|
|
365
|
+
trigger: trigger,
|
|
366
|
+
handleClickOutside: closeDropdown,
|
|
367
|
+
handleEscapeKeydown: closeDropdown,
|
|
368
|
+
mountTo: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsMountPoint,
|
|
369
|
+
boundariesElement: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsBoundariesElement,
|
|
370
|
+
scrollableElement: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsScrollableElement
|
|
371
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
372
|
+
,
|
|
373
|
+
arrowKeyNavigationProviderOptions: {
|
|
374
|
+
type: ArrowKeyNavigationType.MENU
|
|
375
|
+
}
|
|
376
|
+
}, content);
|
|
377
|
+
};
|
|
378
|
+
const LegacySyncedLocationDropdown = ({
|
|
281
379
|
syncBlockStore,
|
|
282
380
|
resourceId,
|
|
283
381
|
intl,
|
|
@@ -290,6 +388,14 @@ export const SyncedLocationDropdown = ({
|
|
|
290
388
|
} = intl;
|
|
291
389
|
const triggerTitle = formatMessage(messages.syncedLocationDropdownTitle);
|
|
292
390
|
const [isOpen, setIsOpen] = useState(false);
|
|
391
|
+
const content = isOpen ? /*#__PURE__*/React.createElement(DropdownContent, {
|
|
392
|
+
syncBlockStore: syncBlockStore,
|
|
393
|
+
resourceId: resourceId,
|
|
394
|
+
intl: intl,
|
|
395
|
+
isSource: isSource,
|
|
396
|
+
localId: localId,
|
|
397
|
+
api: api
|
|
398
|
+
}) : null;
|
|
293
399
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
294
400
|
isOpen: isOpen
|
|
295
401
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -297,7 +403,7 @@ export const SyncedLocationDropdown = ({
|
|
|
297
403
|
onOpenChange: ({
|
|
298
404
|
isOpen
|
|
299
405
|
}) => setIsOpen(isOpen),
|
|
300
|
-
testId:
|
|
406
|
+
testId: SYNCED_LOCATIONS_DROPDOWN_TEST_ID
|
|
301
407
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
302
408
|
,
|
|
303
409
|
trigger: ({
|
|
@@ -315,14 +421,7 @@ export const SyncedLocationDropdown = ({
|
|
|
315
421
|
})
|
|
316
422
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
317
423
|
}, triggerProps), triggerTitle)
|
|
318
|
-
},
|
|
319
|
-
syncBlockStore: syncBlockStore,
|
|
320
|
-
resourceId: resourceId,
|
|
321
|
-
intl: intl,
|
|
322
|
-
isSource: isSource,
|
|
323
|
-
localId: localId,
|
|
324
|
-
api: api
|
|
325
|
-
}));
|
|
424
|
+
}, content);
|
|
326
425
|
};
|
|
327
426
|
const DropdownContent = ({
|
|
328
427
|
syncBlockStore,
|
|
@@ -65,14 +65,15 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
|
65
65
|
const syncedLocation = {
|
|
66
66
|
type: 'custom',
|
|
67
67
|
fallback: [],
|
|
68
|
-
render: () => {
|
|
68
|
+
render: (_view, _idx, _dispatchAnalyticsEvent, floatingToolbarRenderContext) => {
|
|
69
69
|
return /*#__PURE__*/React.createElement(SyncedLocationDropdown, {
|
|
70
70
|
syncBlockStore: syncBlockStore,
|
|
71
71
|
resourceId: resourceId,
|
|
72
72
|
localId: localId,
|
|
73
73
|
intl: intl,
|
|
74
74
|
isSource: isBodiedSyncBlock,
|
|
75
|
-
api: api
|
|
75
|
+
api: api,
|
|
76
|
+
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
};
|
|
@@ -11,13 +11,14 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
11
11
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
12
12
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
13
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
-
import { useEffect, useState } from 'react';
|
|
14
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
15
15
|
import { cx } from '@compiled/react';
|
|
16
16
|
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
17
17
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
18
18
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
19
19
|
import { SYNCED_BLOCKS_DOCUMENTATION_URL } from '@atlaskit/editor-common/sync-block';
|
|
20
20
|
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
21
|
+
import { ArrowKeyNavigationType, DropdownContainer } from '@atlaskit/editor-common/ui-menu';
|
|
21
22
|
import { getPageIdAndTypeFromConfluencePageAri } from '@atlaskit/editor-synced-block-provider';
|
|
22
23
|
import { IconTile } from '@atlaskit/icon';
|
|
23
24
|
import PageLiveDocIcon from '@atlaskit/icon-lab/core/page-live-doc';
|
|
@@ -32,6 +33,7 @@ import SubtaskIcon from '@atlaskit/icon/core/subtasks';
|
|
|
32
33
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
33
34
|
import { ConfluenceIcon, JiraIcon, AtlassianIcon } from '@atlaskit/logo';
|
|
34
35
|
import Lozenge from '@atlaskit/lozenge';
|
|
36
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
35
37
|
import { Box, Text, Inline, Anchor, Stack } from '@atlaskit/primitives/compiled';
|
|
36
38
|
import Spinner from '@atlaskit/spinner';
|
|
37
39
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -41,6 +43,7 @@ var dropdownItemStyles = null;
|
|
|
41
43
|
|
|
42
44
|
// logo icon does not fit in ADS IconTile, hence we need custom styles to match with other icons
|
|
43
45
|
var logoTileStyles = null;
|
|
46
|
+
var SYNCED_LOCATIONS_DROPDOWN_TEST_ID = 'synced-block-synced-locations-dropdown';
|
|
44
47
|
var styles = {
|
|
45
48
|
title: "_1reo15vq _18m915vq _syazazsu _1bto1l2s _o5721q9c",
|
|
46
49
|
note: "_syaz1rpy _o5721q9c",
|
|
@@ -296,27 +299,133 @@ export var SyncedLocationDropdown = function SyncedLocationDropdown(_ref4) {
|
|
|
296
299
|
intl = _ref4.intl,
|
|
297
300
|
isSource = _ref4.isSource,
|
|
298
301
|
localId = _ref4.localId,
|
|
299
|
-
api = _ref4.api
|
|
302
|
+
api = _ref4.api,
|
|
303
|
+
floatingToolbarRenderContext = _ref4.floatingToolbarRenderContext;
|
|
304
|
+
if (fg('platform_synced_block_patch_13')) {
|
|
305
|
+
return /*#__PURE__*/React.createElement(EditorPositionedSyncedLocationDropdown, {
|
|
306
|
+
syncBlockStore: syncBlockStore,
|
|
307
|
+
resourceId: resourceId,
|
|
308
|
+
intl: intl,
|
|
309
|
+
isSource: isSource,
|
|
310
|
+
localId: localId,
|
|
311
|
+
api: api,
|
|
312
|
+
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
return /*#__PURE__*/React.createElement(LegacySyncedLocationDropdown, {
|
|
316
|
+
syncBlockStore: syncBlockStore,
|
|
317
|
+
resourceId: resourceId,
|
|
318
|
+
intl: intl,
|
|
319
|
+
isSource: isSource,
|
|
320
|
+
localId: localId,
|
|
321
|
+
api: api
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
var EditorPositionedSyncedLocationDropdown = function EditorPositionedSyncedLocationDropdown(_ref5) {
|
|
325
|
+
var syncBlockStore = _ref5.syncBlockStore,
|
|
326
|
+
resourceId = _ref5.resourceId,
|
|
327
|
+
intl = _ref5.intl,
|
|
328
|
+
isSource = _ref5.isSource,
|
|
329
|
+
localId = _ref5.localId,
|
|
330
|
+
api = _ref5.api,
|
|
331
|
+
floatingToolbarRenderContext = _ref5.floatingToolbarRenderContext;
|
|
300
332
|
var formatMessage = intl.formatMessage;
|
|
301
333
|
var triggerTitle = formatMessage(messages.syncedLocationDropdownTitle);
|
|
302
334
|
var _useState = useState(false),
|
|
303
335
|
_useState2 = _slicedToArray(_useState, 2),
|
|
304
336
|
isOpen = _useState2[0],
|
|
305
337
|
setIsOpen = _useState2[1];
|
|
338
|
+
var content = isOpen ? /*#__PURE__*/React.createElement(DropdownContent, {
|
|
339
|
+
syncBlockStore: syncBlockStore,
|
|
340
|
+
resourceId: resourceId,
|
|
341
|
+
intl: intl,
|
|
342
|
+
isSource: isSource,
|
|
343
|
+
localId: localId,
|
|
344
|
+
api: api
|
|
345
|
+
}) : null;
|
|
346
|
+
var toggleOpen = useCallback(function () {
|
|
347
|
+
setIsOpen(function (currentIsOpen) {
|
|
348
|
+
return !currentIsOpen;
|
|
349
|
+
});
|
|
350
|
+
}, []);
|
|
351
|
+
var closeDropdown = useCallback(function () {
|
|
352
|
+
setIsOpen(false);
|
|
353
|
+
}, []);
|
|
354
|
+
var setDisableParentScroll = floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.setDisableParentScroll;
|
|
355
|
+
useEffect(function () {
|
|
356
|
+
if (!isOpen) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
setDisableParentScroll === null || setDisableParentScroll === void 0 || setDisableParentScroll(true);
|
|
360
|
+
return function () {
|
|
361
|
+
setDisableParentScroll === null || setDisableParentScroll === void 0 || setDisableParentScroll(false);
|
|
362
|
+
};
|
|
363
|
+
}, [isOpen, setDisableParentScroll]);
|
|
364
|
+
var trigger = useMemo(function () {
|
|
365
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
366
|
+
areAnyNewToolbarFlagsEnabled: true,
|
|
367
|
+
selected: isOpen,
|
|
368
|
+
iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
369
|
+
color: "currentColor",
|
|
370
|
+
spacing: "spacious",
|
|
371
|
+
label: "",
|
|
372
|
+
size: "small"
|
|
373
|
+
}),
|
|
374
|
+
onClick: toggleOpen,
|
|
375
|
+
ariaHasPopup: true
|
|
376
|
+
}, triggerTitle);
|
|
377
|
+
}, [isOpen, toggleOpen, triggerTitle]);
|
|
378
|
+
return /*#__PURE__*/React.createElement(DropdownContainer, {
|
|
379
|
+
testId: SYNCED_LOCATIONS_DROPDOWN_TEST_ID,
|
|
380
|
+
isOpen: isOpen,
|
|
381
|
+
trigger: trigger,
|
|
382
|
+
handleClickOutside: closeDropdown,
|
|
383
|
+
handleEscapeKeydown: closeDropdown,
|
|
384
|
+
mountTo: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsMountPoint,
|
|
385
|
+
boundariesElement: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsBoundariesElement,
|
|
386
|
+
scrollableElement: floatingToolbarRenderContext === null || floatingToolbarRenderContext === void 0 ? void 0 : floatingToolbarRenderContext.popupsScrollableElement
|
|
387
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
388
|
+
,
|
|
389
|
+
arrowKeyNavigationProviderOptions: {
|
|
390
|
+
type: ArrowKeyNavigationType.MENU
|
|
391
|
+
}
|
|
392
|
+
}, content);
|
|
393
|
+
};
|
|
394
|
+
var LegacySyncedLocationDropdown = function LegacySyncedLocationDropdown(_ref6) {
|
|
395
|
+
var syncBlockStore = _ref6.syncBlockStore,
|
|
396
|
+
resourceId = _ref6.resourceId,
|
|
397
|
+
intl = _ref6.intl,
|
|
398
|
+
isSource = _ref6.isSource,
|
|
399
|
+
localId = _ref6.localId,
|
|
400
|
+
api = _ref6.api;
|
|
401
|
+
var formatMessage = intl.formatMessage;
|
|
402
|
+
var triggerTitle = formatMessage(messages.syncedLocationDropdownTitle);
|
|
403
|
+
var _useState3 = useState(false),
|
|
404
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
405
|
+
isOpen = _useState4[0],
|
|
406
|
+
setIsOpen = _useState4[1];
|
|
407
|
+
var content = isOpen ? /*#__PURE__*/React.createElement(DropdownContent, {
|
|
408
|
+
syncBlockStore: syncBlockStore,
|
|
409
|
+
resourceId: resourceId,
|
|
410
|
+
intl: intl,
|
|
411
|
+
isSource: isSource,
|
|
412
|
+
localId: localId,
|
|
413
|
+
api: api
|
|
414
|
+
}) : null;
|
|
306
415
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
307
416
|
isOpen: isOpen
|
|
308
417
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
309
418
|
,
|
|
310
|
-
onOpenChange: function onOpenChange(
|
|
311
|
-
var isOpen =
|
|
419
|
+
onOpenChange: function onOpenChange(_ref7) {
|
|
420
|
+
var isOpen = _ref7.isOpen;
|
|
312
421
|
return setIsOpen(isOpen);
|
|
313
422
|
},
|
|
314
|
-
testId:
|
|
423
|
+
testId: SYNCED_LOCATIONS_DROPDOWN_TEST_ID
|
|
315
424
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
316
425
|
,
|
|
317
|
-
trigger: function trigger(
|
|
318
|
-
var triggerRef =
|
|
319
|
-
triggerProps = _objectWithoutProperties(
|
|
426
|
+
trigger: function trigger(_ref8) {
|
|
427
|
+
var triggerRef = _ref8.triggerRef,
|
|
428
|
+
triggerProps = _objectWithoutProperties(_ref8, _excluded);
|
|
320
429
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
321
430
|
ref: triggerRef,
|
|
322
431
|
areAnyNewToolbarFlagsEnabled: true,
|
|
@@ -330,35 +439,28 @@ export var SyncedLocationDropdown = function SyncedLocationDropdown(_ref4) {
|
|
|
330
439
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
331
440
|
}, triggerProps), triggerTitle);
|
|
332
441
|
}
|
|
333
|
-
},
|
|
334
|
-
syncBlockStore: syncBlockStore,
|
|
335
|
-
resourceId: resourceId,
|
|
336
|
-
intl: intl,
|
|
337
|
-
isSource: isSource,
|
|
338
|
-
localId: localId,
|
|
339
|
-
api: api
|
|
340
|
-
}));
|
|
442
|
+
}, content);
|
|
341
443
|
};
|
|
342
|
-
var DropdownContent = function DropdownContent(
|
|
343
|
-
var syncBlockStore =
|
|
344
|
-
resourceId =
|
|
345
|
-
intl =
|
|
346
|
-
isSource =
|
|
347
|
-
localId =
|
|
348
|
-
api =
|
|
444
|
+
var DropdownContent = function DropdownContent(_ref9) {
|
|
445
|
+
var syncBlockStore = _ref9.syncBlockStore,
|
|
446
|
+
resourceId = _ref9.resourceId,
|
|
447
|
+
intl = _ref9.intl,
|
|
448
|
+
isSource = _ref9.isSource,
|
|
449
|
+
localId = _ref9.localId,
|
|
450
|
+
api = _ref9.api;
|
|
349
451
|
var formatMessage = intl.formatMessage;
|
|
350
|
-
var
|
|
351
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
352
|
-
fetchStatus = _useState4[0],
|
|
353
|
-
setFetchStatus = _useState4[1];
|
|
354
|
-
var _useState5 = useState([]),
|
|
452
|
+
var _useState5 = useState('none'),
|
|
355
453
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
356
|
-
|
|
357
|
-
|
|
454
|
+
fetchStatus = _useState6[0],
|
|
455
|
+
setFetchStatus = _useState6[1];
|
|
456
|
+
var _useState7 = useState([]),
|
|
457
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
458
|
+
referenceData = _useState8[0],
|
|
459
|
+
setReferenceData = _useState8[1];
|
|
358
460
|
useEffect(function () {
|
|
359
461
|
setFetchStatus('loading');
|
|
360
462
|
var getReferenceData = /*#__PURE__*/function () {
|
|
361
|
-
var
|
|
463
|
+
var _ref0 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
362
464
|
var response;
|
|
363
465
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
364
466
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -383,7 +485,7 @@ var DropdownContent = function DropdownContent(_ref7) {
|
|
|
383
485
|
}, _callee);
|
|
384
486
|
}));
|
|
385
487
|
return function getReferenceData() {
|
|
386
|
-
return
|
|
488
|
+
return _ref0.apply(this, arguments);
|
|
387
489
|
};
|
|
388
490
|
}();
|
|
389
491
|
getReferenceData();
|
|
@@ -461,8 +563,8 @@ var DropdownContent = function DropdownContent(_ref7) {
|
|
|
461
563
|
var LoadingScreen = function LoadingScreen() {
|
|
462
564
|
return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Spinner, null));
|
|
463
565
|
};
|
|
464
|
-
var ErrorScreen = function ErrorScreen(
|
|
465
|
-
var formatMessage =
|
|
566
|
+
var ErrorScreen = function ErrorScreen(_ref1) {
|
|
567
|
+
var formatMessage = _ref1.formatMessage;
|
|
466
568
|
return /*#__PURE__*/React.createElement(Box, {
|
|
467
569
|
xcss: styles.errorContainer,
|
|
468
570
|
testId: "synced-locations-dropdown-content-error"
|
|
@@ -478,8 +580,8 @@ var ErrorScreen = function ErrorScreen(_ref9) {
|
|
|
478
580
|
size: "medium"
|
|
479
581
|
}, formatMessage(messages.syncedLocationDropdownError)));
|
|
480
582
|
};
|
|
481
|
-
var NoResultScreen = function NoResultScreen(
|
|
482
|
-
var formatMessage =
|
|
583
|
+
var NoResultScreen = function NoResultScreen(_ref10) {
|
|
584
|
+
var formatMessage = _ref10.formatMessage;
|
|
483
585
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
484
586
|
xcss: styles.noResultsContainer,
|
|
485
587
|
space: "space.100",
|
|
@@ -60,14 +60,15 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
60
60
|
var syncedLocation = {
|
|
61
61
|
type: 'custom',
|
|
62
62
|
fallback: [],
|
|
63
|
-
render: function render() {
|
|
63
|
+
render: function render(_view, _idx, _dispatchAnalyticsEvent, floatingToolbarRenderContext) {
|
|
64
64
|
return /*#__PURE__*/React.createElement(SyncedLocationDropdown, {
|
|
65
65
|
syncBlockStore: syncBlockStore,
|
|
66
66
|
resourceId: resourceId,
|
|
67
67
|
localId: localId,
|
|
68
68
|
intl: intl,
|
|
69
69
|
isSource: isBodiedSyncBlock,
|
|
70
|
-
api: api
|
|
70
|
+
api: api,
|
|
71
|
+
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI, FloatingToolbarCustomRenderContext } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { SyncBlockSourceInfo, SyncBlockStoreManager, ReferencesSourceInfo } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
5
5
|
interface Props {
|
|
6
6
|
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
7
|
+
floatingToolbarRenderContext?: FloatingToolbarCustomRenderContext;
|
|
7
8
|
intl: IntlShape;
|
|
8
9
|
isSource: boolean;
|
|
9
10
|
localId: string;
|
|
@@ -11,5 +12,5 @@ interface Props {
|
|
|
11
12
|
syncBlockStore: SyncBlockStoreManager;
|
|
12
13
|
}
|
|
13
14
|
export declare const processReferenceData: (referenceData: ReferencesSourceInfo["references"], intl: IntlShape) => SyncBlockSourceInfo[];
|
|
14
|
-
export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, api, }: Props) => JSX.Element;
|
|
15
|
+
export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, api, floatingToolbarRenderContext, }: Props) => JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI, FloatingToolbarCustomRenderContext } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { SyncBlockSourceInfo, SyncBlockStoreManager, ReferencesSourceInfo } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
5
5
|
interface Props {
|
|
6
6
|
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
|
|
7
|
+
floatingToolbarRenderContext?: FloatingToolbarCustomRenderContext;
|
|
7
8
|
intl: IntlShape;
|
|
8
9
|
isSource: boolean;
|
|
9
10
|
localId: string;
|
|
@@ -11,5 +12,5 @@ interface Props {
|
|
|
11
12
|
syncBlockStore: SyncBlockStoreManager;
|
|
12
13
|
}
|
|
13
14
|
export declare const processReferenceData: (referenceData: ReferencesSourceInfo["references"], intl: IntlShape) => SyncBlockSourceInfo[];
|
|
14
|
-
export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, api, }: Props) => JSX.Element;
|
|
15
|
+
export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, api, floatingToolbarRenderContext, }: Props) => JSX.Element;
|
|
15
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-connectivity": "10.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-format": "^4.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^10.1.0",
|
|
40
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^12.
|
|
40
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^12.2.0",
|
|
41
41
|
"@atlaskit/editor-plugin-focus": "^9.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-selection": "^10.1.0",
|
|
43
43
|
"@atlaskit/editor-plugin-user-intent": "^8.2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
55
55
|
"@atlaskit/primitives": "^19.0.0",
|
|
56
56
|
"@atlaskit/spinner": "19.1.2",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^82.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^82.4.0",
|
|
58
58
|
"@atlaskit/tokens": "13.0.4",
|
|
59
59
|
"@atlaskit/tooltip": "^22.2.0",
|
|
60
60
|
"@atlaskit/visually-hidden": "^3.1.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"date-fns": "^2.17.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@atlaskit/editor-common": "^114.
|
|
67
|
+
"@atlaskit/editor-common": "^114.42.0",
|
|
68
68
|
"react": "^18.2.0",
|
|
69
69
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
70
70
|
},
|
|
@@ -115,6 +115,9 @@
|
|
|
115
115
|
},
|
|
116
116
|
"platform_synced_block_patch_12": {
|
|
117
117
|
"type": "boolean"
|
|
118
|
+
},
|
|
119
|
+
"platform_synced_block_patch_13": {
|
|
120
|
+
"type": "boolean"
|
|
118
121
|
}
|
|
119
122
|
}
|
|
120
123
|
}
|