@atlaskit/editor-plugin-synced-block 4.0.0 → 4.1.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 +19 -0
- package/afm-cc/tsconfig.json +15 -0
- package/afm-jira/tsconfig.json +15 -0
- package/afm-products/tsconfig.json +15 -0
- package/dist/cjs/nodeviews/syncedBlock.js +11 -5
- package/dist/cjs/ui/BodiedSyncBlockWrapper.js +4 -1
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +8 -1
- package/dist/cjs/ui/SyncBlockLabel.js +36 -4
- package/dist/cjs/ui/SyncBlockRefresher.js +3 -3
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +9 -3
- package/dist/cjs/ui/floating-toolbar.js +1 -4
- package/dist/es2019/nodeviews/syncedBlock.js +11 -6
- package/dist/es2019/ui/BodiedSyncBlockWrapper.js +4 -1
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +8 -1
- package/dist/es2019/ui/SyncBlockLabel.js +37 -4
- package/dist/es2019/ui/SyncBlockRefresher.js +2 -2
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +9 -3
- package/dist/es2019/ui/floating-toolbar.js +1 -4
- package/dist/esm/nodeviews/syncedBlock.js +12 -6
- package/dist/esm/ui/BodiedSyncBlockWrapper.js +4 -1
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +8 -1
- package/dist/esm/ui/SyncBlockLabel.js +36 -4
- package/dist/esm/ui/SyncBlockRefresher.js +2 -2
- package/dist/esm/ui/SyncBlockRendererWrapper.js +9 -3
- package/dist/esm/ui/floating-toolbar.js +1 -4
- package/dist/types/syncedBlockPluginType.d.ts +2 -2
- package/dist/types/ui/SyncBlockLabel.d.ts +7 -1
- package/dist/types/ui/SyncBlockRefresher.d.ts +1 -0
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +5 -3
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +2 -2
- package/dist/types-ts4.5/ui/SyncBlockLabel.d.ts +7 -1
- package/dist/types-ts4.5/ui/SyncBlockRefresher.d.ts +1 -0
- package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +5 -3
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`261fa27c56fd0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/261fa27c56fd0) -
|
|
8
|
+
EDITOR-2533 implement retry function for sync-block renderer
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 4.0.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`7e3353721fa66`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7e3353721fa66) -
|
|
19
|
+
[ux] EDITOR-1822 update sync blocks ui to new design
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 4.0.0
|
|
4
23
|
|
|
5
24
|
### Major Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -58,9 +58,24 @@
|
|
|
58
58
|
{
|
|
59
59
|
"path": "../../../design-system/icon/afm-cc/tsconfig.json"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"path": "../../../design-system/logo/afm-cc/tsconfig.json"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"path": "../../../design-system/lozenge/afm-cc/tsconfig.json"
|
|
66
|
+
},
|
|
61
67
|
{
|
|
62
68
|
"path": "../../../design-system/modal-dialog/afm-cc/tsconfig.json"
|
|
63
69
|
},
|
|
70
|
+
{
|
|
71
|
+
"path": "../../../design-system/primitives/afm-cc/tsconfig.json"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "../../../design-system/tooltip/afm-cc/tsconfig.json"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"path": "../../../design-system/visually-hidden/afm-cc/tsconfig.json"
|
|
78
|
+
},
|
|
64
79
|
{
|
|
65
80
|
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
66
81
|
}
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -58,9 +58,24 @@
|
|
|
58
58
|
{
|
|
59
59
|
"path": "../../../design-system/icon/afm-jira/tsconfig.json"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"path": "../../../design-system/logo/afm-jira/tsconfig.json"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"path": "../../../design-system/lozenge/afm-jira/tsconfig.json"
|
|
66
|
+
},
|
|
61
67
|
{
|
|
62
68
|
"path": "../../../design-system/modal-dialog/afm-jira/tsconfig.json"
|
|
63
69
|
},
|
|
70
|
+
{
|
|
71
|
+
"path": "../../../design-system/primitives/afm-jira/tsconfig.json"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "../../../design-system/tooltip/afm-jira/tsconfig.json"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"path": "../../../design-system/visually-hidden/afm-jira/tsconfig.json"
|
|
78
|
+
},
|
|
64
79
|
{
|
|
65
80
|
"path": "../../editor-common/afm-jira/tsconfig.json"
|
|
66
81
|
}
|
|
@@ -58,9 +58,24 @@
|
|
|
58
58
|
{
|
|
59
59
|
"path": "../../../design-system/icon/afm-products/tsconfig.json"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"path": "../../../design-system/logo/afm-products/tsconfig.json"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"path": "../../../design-system/lozenge/afm-products/tsconfig.json"
|
|
66
|
+
},
|
|
61
67
|
{
|
|
62
68
|
"path": "../../../design-system/modal-dialog/afm-products/tsconfig.json"
|
|
63
69
|
},
|
|
70
|
+
{
|
|
71
|
+
"path": "../../../design-system/primitives/afm-products/tsconfig.json"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "../../../design-system/tooltip/afm-products/tsconfig.json"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"path": "../../../design-system/visually-hidden/afm-products/tsconfig.json"
|
|
78
|
+
},
|
|
64
79
|
{
|
|
65
80
|
"path": "../../editor-common/afm-products/tsconfig.json"
|
|
66
81
|
}
|
|
@@ -46,14 +46,23 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
46
46
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
+
var _this$node$attrs = this.node.attrs,
|
|
50
|
+
resourceId = _this$node$attrs.resourceId,
|
|
51
|
+
localId = _this$node$attrs.localId;
|
|
52
|
+
if (!resourceId || !localId) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
49
55
|
|
|
50
56
|
// get document node from data provider
|
|
51
|
-
|
|
52
57
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
58
|
+
localId: this.node.attrs.localId,
|
|
53
59
|
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
54
60
|
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
61
|
+
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
62
|
+
return (0, _editorSyncedBlockProvider.useFetchSyncBlockTitle)(_this2.syncBlockStore, _this2.node);
|
|
63
|
+
},
|
|
55
64
|
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
56
|
-
return (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(_this2.syncBlockStore,
|
|
65
|
+
return (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(_this2.syncBlockStore, resourceId, localId);
|
|
57
66
|
}
|
|
58
67
|
});
|
|
59
68
|
}
|
|
@@ -61,9 +70,6 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
61
70
|
key: "destroy",
|
|
62
71
|
value: function destroy() {
|
|
63
72
|
var _this$unsubscribe;
|
|
64
|
-
if (this.fetchIntervalId) {
|
|
65
|
-
window.clearInterval(this.fetchIntervalId);
|
|
66
|
-
}
|
|
67
73
|
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
|
|
68
74
|
_superPropGet(SyncBlock, "destroy", this, 3)([]);
|
|
69
75
|
}
|
|
@@ -13,8 +13,11 @@ var BodiedSyncBlockWrapper = exports.BodiedSyncBlockWrapper = /*#__PURE__*/_reac
|
|
|
13
13
|
syncBlockStore = _ref.syncBlockStore;
|
|
14
14
|
// TODO: EDITOR-2429 - this should be debounced (either here or in the data provider) to avoid excessive API writes
|
|
15
15
|
(0, _editorSyncedBlockProvider.useHandleContentChanges)(syncBlockStore, node);
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
17
17
|
"data-testid": "bodied-sync-block-wrapper",
|
|
18
18
|
ref: ref
|
|
19
|
+
}), /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, {
|
|
20
|
+
isSource: true,
|
|
21
|
+
localId: node.attrs.localId
|
|
19
22
|
}));
|
|
20
23
|
});
|
|
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
+
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
13
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
12
14
|
var _utils = require("../pm-plugins/utils/utils");
|
|
13
15
|
var CreateSyncedBlockDropdownItem = exports.CreateSyncedBlockDropdownItem = function CreateSyncedBlockDropdownItem(_ref) {
|
|
14
16
|
var _api$selection;
|
|
@@ -42,5 +44,10 @@ var CreateSyncedBlockDropdownItem = exports.CreateSyncedBlockDropdownItem = func
|
|
|
42
44
|
label: ""
|
|
43
45
|
}),
|
|
44
46
|
onClick: onClick
|
|
45
|
-
},
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
gap: "space.050"
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, null, selection !== null && selection !== void 0 && selection.empty ? formatMessage(_messages.blockMenuMessages.createSyncedBlock) : formatMessage(_messages.blockMenuMessages.convertToSyncedBlock)), /*#__PURE__*/_react.default.createElement(_lozenge.default, {
|
|
51
|
+
appearance: "new"
|
|
52
|
+
}, formatMessage(_messages.blockMenuMessages.newLozenge))));
|
|
46
53
|
};
|
|
@@ -9,15 +9,47 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
12
|
+
var _logo = require("@atlaskit/logo");
|
|
13
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
15
|
+
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
12
16
|
var SyncBlockLabelDataId = 'sync-block-label';
|
|
13
|
-
var SyncBlockLabelComponent = function SyncBlockLabelComponent() {
|
|
17
|
+
var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
18
|
+
var isSource = _ref.isSource,
|
|
19
|
+
useFetchSyncBlockTitle = _ref.useFetchSyncBlockTitle,
|
|
20
|
+
localId = _ref.localId;
|
|
14
21
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
15
22
|
formatMessage = _useIntl.formatMessage;
|
|
16
|
-
|
|
23
|
+
var title = useFetchSyncBlockTitle === null || useFetchSyncBlockTitle === void 0 ? void 0 : useFetchSyncBlockTitle();
|
|
24
|
+
var tooltipContent = isSource ? formatMessage(_messages.syncBlockMessages.sourceSyncBlockTooltip) : title ? formatMessage(_messages.syncBlockMessages.referenceSyncBlockTooltip, {
|
|
25
|
+
title: title
|
|
26
|
+
}) : formatMessage(_messages.syncBlockMessages.defaultSyncBlockTooltip);
|
|
27
|
+
var ariaDescribedById = "sync-block-label-description-".concat(localId);
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
29
|
+
position: "top",
|
|
30
|
+
content: tooltipContent
|
|
31
|
+
// workaround because tooltip adds aria-describedby with a new id every time the tooltip is opened
|
|
32
|
+
// this causes an infinite rerender loop because of the forwardRef from the node view we are inside in bodiedSyncBlock
|
|
33
|
+
// tooltip content is available for screen readers in visually hidden content after the label
|
|
34
|
+
,
|
|
35
|
+
isScreenReaderAnnouncementDisabled: true
|
|
36
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
17
37
|
"data-testid": SyncBlockLabelDataId
|
|
18
38
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
19
39
|
,
|
|
20
|
-
className: _syncBlock.SyncBlockLabelSharedCssClassName.labelClassName
|
|
21
|
-
|
|
40
|
+
className: _syncBlock.SyncBlockLabelSharedCssClassName.labelClassName,
|
|
41
|
+
"aria-describedby": ariaDescribedById
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_logo.ConfluenceIcon, {
|
|
43
|
+
size: "xsmall",
|
|
44
|
+
appearance: "neutral",
|
|
45
|
+
shouldUseNewLogoDesign: true
|
|
46
|
+
}), isSource || !title ? /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
47
|
+
size: "small"
|
|
48
|
+
}, formatMessage(_messages.syncBlockMessages.syncedBlockLabel)) : /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
49
|
+
maxLines: 1,
|
|
50
|
+
size: "small"
|
|
51
|
+
}, title)), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
|
|
52
|
+
id: ariaDescribedById
|
|
53
|
+
}, tooltipContent));
|
|
22
54
|
};
|
|
23
55
|
var SyncBlockLabel = exports.SyncBlockLabel = /*#__PURE__*/_react.default.memo(SyncBlockLabelComponent);
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SyncBlockRefresher = void 0;
|
|
6
|
+
exports.SyncBlockRefresher = exports.SYNC_BLOCK_FETCH_INTERVAL = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
8
|
+
var SYNC_BLOCK_FETCH_INTERVAL = exports.SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
9
9
|
|
|
10
10
|
// Component that refreshes synced block subscriptions at regular intervals
|
|
11
11
|
// this is a workaround for the subscription mechanism not being real-time
|
|
@@ -18,7 +18,7 @@ var SyncBlockRefresher = exports.SyncBlockRefresher = function SyncBlockRefreshe
|
|
|
18
18
|
if (((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) === 'visible') {
|
|
19
19
|
syncBlockStoreManager.refreshSubscriptions();
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, SYNC_BLOCK_FETCH_INTERVAL);
|
|
22
22
|
return function () {
|
|
23
23
|
window.clearInterval(interval);
|
|
24
24
|
};
|
|
@@ -12,8 +12,10 @@ var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
|
12
12
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
13
13
|
var getSyncedBlockRenderer = _ref.getSyncedBlockRenderer,
|
|
14
14
|
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
15
|
-
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders
|
|
16
|
-
|
|
15
|
+
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders,
|
|
16
|
+
localId = _ref.localId,
|
|
17
|
+
useFetchSyncBlockTitle = _ref.useFetchSyncBlockTitle;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
17
19
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
18
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
19
21
|
,
|
|
@@ -21,6 +23,10 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
21
23
|
}, getSyncedBlockRenderer({
|
|
22
24
|
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
23
25
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
24
|
-
}))
|
|
26
|
+
})), /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, {
|
|
27
|
+
isSource: false,
|
|
28
|
+
useFetchSyncBlockTitle: useFetchSyncBlockTitle,
|
|
29
|
+
localId: localId
|
|
30
|
+
}));
|
|
25
31
|
};
|
|
26
32
|
var SyncBlockRendererWrapper = exports.SyncBlockRendererWrapper = /*#__PURE__*/_react.default.memo(SyncBlockRendererWrapperComponent);
|
|
@@ -45,7 +45,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
45
45
|
appearance: 'subtle',
|
|
46
46
|
icon: _copy.default,
|
|
47
47
|
title: formatMessage(_messages.syncBlockMessages.copySyncBlockLabel),
|
|
48
|
-
showTitle:
|
|
48
|
+
showTitle: false,
|
|
49
49
|
tooltipContent: formatMessage(_messages.syncBlockMessages.copySyncBlockTooltip),
|
|
50
50
|
onClick: (0, _editorCommands.copySyncedBlockReferenceToClipboard)(api)
|
|
51
51
|
}, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
|
|
@@ -70,9 +70,6 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
70
70
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
71
71
|
var testId = 'synced-block-overflow-dropdown-trigger';
|
|
72
72
|
var overflowMenuConfig = [{
|
|
73
|
-
type: 'separator',
|
|
74
|
-
fullHeight: true
|
|
75
|
-
}, {
|
|
76
73
|
type: 'overflow-dropdown',
|
|
77
74
|
testId: testId,
|
|
78
75
|
options: [_objectSpread({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
3
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
4
|
-
import { useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
|
|
4
|
+
import { useFetchSyncBlockData, useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
|
|
5
5
|
import { SyncBlockRendererWrapper } from '../ui/SyncBlockRendererWrapper';
|
|
6
6
|
class SyncBlock extends ReactNodeView {
|
|
7
7
|
constructor(props) {
|
|
@@ -19,20 +19,25 @@ class SyncBlock extends ReactNodeView {
|
|
|
19
19
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
+
const {
|
|
23
|
+
resourceId,
|
|
24
|
+
localId
|
|
25
|
+
} = this.node.attrs;
|
|
26
|
+
if (!resourceId || !localId) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
22
29
|
|
|
23
30
|
// get document node from data provider
|
|
24
|
-
|
|
25
31
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
32
|
+
localId: this.node.attrs.localId,
|
|
26
33
|
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
27
34
|
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
28
|
-
|
|
35
|
+
useFetchSyncBlockTitle: () => useFetchSyncBlockTitle(this.syncBlockStore, this.node),
|
|
36
|
+
useFetchSyncBlockData: () => useFetchSyncBlockData(this.syncBlockStore, resourceId, localId)
|
|
29
37
|
});
|
|
30
38
|
}
|
|
31
39
|
destroy() {
|
|
32
40
|
var _this$unsubscribe;
|
|
33
|
-
if (this.fetchIntervalId) {
|
|
34
|
-
window.clearInterval(this.fetchIntervalId);
|
|
35
|
-
}
|
|
36
41
|
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
|
|
37
42
|
super.destroy();
|
|
38
43
|
}
|
|
@@ -7,8 +7,11 @@ export const BodiedSyncBlockWrapper = /*#__PURE__*/React.forwardRef(({
|
|
|
7
7
|
}, ref) => {
|
|
8
8
|
// TODO: EDITOR-2429 - this should be debounced (either here or in the data provider) to avoid excessive API writes
|
|
9
9
|
useHandleContentChanges(syncBlockStore, node);
|
|
10
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
11
11
|
"data-testid": "bodied-sync-block-wrapper",
|
|
12
12
|
ref: ref
|
|
13
|
+
}), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
14
|
+
isSource: true,
|
|
15
|
+
localId: node.attrs.localId
|
|
13
16
|
}));
|
|
14
17
|
});
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { SyncBlocksIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
6
|
+
import { Flex, Text } from '@atlaskit/primitives/compiled';
|
|
5
7
|
import { canBeConvertedToSyncBlock } from '../pm-plugins/utils/utils';
|
|
6
8
|
export const CreateSyncedBlockDropdownItem = ({
|
|
7
9
|
api
|
|
@@ -38,5 +40,10 @@ export const CreateSyncedBlockDropdownItem = ({
|
|
|
38
40
|
label: ""
|
|
39
41
|
}),
|
|
40
42
|
onClick: onClick
|
|
41
|
-
},
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: "space.050"
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Text, null, selection !== null && selection !== void 0 && selection.empty ? formatMessage(blockMenuMessages.createSyncedBlock) : formatMessage(blockMenuMessages.convertToSyncedBlock)), /*#__PURE__*/React.createElement(Lozenge, {
|
|
47
|
+
appearance: "new"
|
|
48
|
+
}, formatMessage(blockMenuMessages.newLozenge))));
|
|
42
49
|
};
|
|
@@ -2,16 +2,49 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { SyncBlockLabelSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
5
|
+
import { ConfluenceIcon } from '@atlaskit/logo';
|
|
6
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
7
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
5
9
|
const SyncBlockLabelDataId = 'sync-block-label';
|
|
6
|
-
const SyncBlockLabelComponent = (
|
|
10
|
+
const SyncBlockLabelComponent = ({
|
|
11
|
+
isSource,
|
|
12
|
+
useFetchSyncBlockTitle,
|
|
13
|
+
localId
|
|
14
|
+
}) => {
|
|
7
15
|
const {
|
|
8
16
|
formatMessage
|
|
9
17
|
} = useIntl();
|
|
10
|
-
|
|
18
|
+
const title = useFetchSyncBlockTitle === null || useFetchSyncBlockTitle === void 0 ? void 0 : useFetchSyncBlockTitle();
|
|
19
|
+
const tooltipContent = isSource ? formatMessage(messages.sourceSyncBlockTooltip) : title ? formatMessage(messages.referenceSyncBlockTooltip, {
|
|
20
|
+
title
|
|
21
|
+
}) : formatMessage(messages.defaultSyncBlockTooltip);
|
|
22
|
+
const ariaDescribedById = `sync-block-label-description-${localId}`;
|
|
23
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
24
|
+
position: "top",
|
|
25
|
+
content: tooltipContent
|
|
26
|
+
// workaround because tooltip adds aria-describedby with a new id every time the tooltip is opened
|
|
27
|
+
// this causes an infinite rerender loop because of the forwardRef from the node view we are inside in bodiedSyncBlock
|
|
28
|
+
// tooltip content is available for screen readers in visually hidden content after the label
|
|
29
|
+
,
|
|
30
|
+
isScreenReaderAnnouncementDisabled: true
|
|
31
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11
32
|
"data-testid": SyncBlockLabelDataId
|
|
12
33
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
13
34
|
,
|
|
14
|
-
className: SyncBlockLabelSharedCssClassName.labelClassName
|
|
15
|
-
|
|
35
|
+
className: SyncBlockLabelSharedCssClassName.labelClassName,
|
|
36
|
+
"aria-describedby": ariaDescribedById
|
|
37
|
+
}, /*#__PURE__*/React.createElement(ConfluenceIcon, {
|
|
38
|
+
size: "xsmall",
|
|
39
|
+
appearance: "neutral",
|
|
40
|
+
shouldUseNewLogoDesign: true
|
|
41
|
+
}), isSource || !title ? /*#__PURE__*/React.createElement(Text, {
|
|
42
|
+
size: "small"
|
|
43
|
+
}, formatMessage(messages.syncedBlockLabel)) : /*#__PURE__*/React.createElement(Text, {
|
|
44
|
+
maxLines: 1,
|
|
45
|
+
size: "small"
|
|
46
|
+
}, title)), /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
47
|
+
id: ariaDescribedById
|
|
48
|
+
}, tooltipContent));
|
|
16
49
|
};
|
|
17
50
|
export const SyncBlockLabel = /*#__PURE__*/React.memo(SyncBlockLabelComponent);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
const
|
|
2
|
+
export const SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
3
3
|
|
|
4
4
|
// Component that refreshes synced block subscriptions at regular intervals
|
|
5
5
|
// this is a workaround for the subscription mechanism not being real-time
|
|
@@ -13,7 +13,7 @@ export const SyncBlockRefresher = ({
|
|
|
13
13
|
if (((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) === 'visible') {
|
|
14
14
|
syncBlockStoreManager.refreshSubscriptions();
|
|
15
15
|
}
|
|
16
|
-
},
|
|
16
|
+
}, SYNC_BLOCK_FETCH_INTERVAL);
|
|
17
17
|
return () => {
|
|
18
18
|
window.clearInterval(interval);
|
|
19
19
|
};
|
|
@@ -5,9 +5,11 @@ const SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
|
5
5
|
const SyncBlockRendererWrapperComponent = ({
|
|
6
6
|
getSyncedBlockRenderer,
|
|
7
7
|
useFetchSyncBlockData,
|
|
8
|
-
syncBlockRendererDataProviders
|
|
8
|
+
syncBlockRendererDataProviders,
|
|
9
|
+
localId,
|
|
10
|
+
useFetchSyncBlockTitle
|
|
9
11
|
}) => {
|
|
10
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
11
13
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
12
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
13
15
|
,
|
|
@@ -15,6 +17,10 @@ const SyncBlockRendererWrapperComponent = ({
|
|
|
15
17
|
}, getSyncedBlockRenderer({
|
|
16
18
|
syncBlockRendererDataProviders,
|
|
17
19
|
useFetchSyncBlockData
|
|
18
|
-
}))
|
|
20
|
+
})), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
21
|
+
isSource: false,
|
|
22
|
+
useFetchSyncBlockTitle: useFetchSyncBlockTitle,
|
|
23
|
+
localId: localId
|
|
24
|
+
}));
|
|
19
25
|
};
|
|
20
26
|
export const SyncBlockRendererWrapper = /*#__PURE__*/React.memo(SyncBlockRendererWrapperComponent);
|
|
@@ -39,7 +39,7 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
|
39
39
|
appearance: 'subtle',
|
|
40
40
|
icon: CopyIcon,
|
|
41
41
|
title: formatMessage(messages.copySyncBlockLabel),
|
|
42
|
-
showTitle:
|
|
42
|
+
showTitle: false,
|
|
43
43
|
tooltipContent: formatMessage(messages.copySyncBlockTooltip),
|
|
44
44
|
onClick: copySyncedBlockReferenceToClipboard(api),
|
|
45
45
|
...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
|
|
@@ -66,9 +66,6 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
|
66
66
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
67
67
|
const testId = 'synced-block-overflow-dropdown-trigger';
|
|
68
68
|
const overflowMenuConfig = [{
|
|
69
|
-
type: 'separator',
|
|
70
|
-
fullHeight: true
|
|
71
|
-
}, {
|
|
72
69
|
type: 'overflow-dropdown',
|
|
73
70
|
testId,
|
|
74
71
|
options: [{
|
|
@@ -10,7 +10,7 @@ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prot
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
12
12
|
import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
13
|
-
import { useFetchSyncBlockData as _useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
|
|
13
|
+
import { useFetchSyncBlockData as _useFetchSyncBlockData, useFetchSyncBlockTitle as _useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
|
|
14
14
|
import { SyncBlockRendererWrapper } from '../ui/SyncBlockRendererWrapper';
|
|
15
15
|
var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
16
16
|
function SyncBlock(props) {
|
|
@@ -39,14 +39,23 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
39
39
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
|
+
var _this$node$attrs = this.node.attrs,
|
|
43
|
+
resourceId = _this$node$attrs.resourceId,
|
|
44
|
+
localId = _this$node$attrs.localId;
|
|
45
|
+
if (!resourceId || !localId) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
42
48
|
|
|
43
49
|
// get document node from data provider
|
|
44
|
-
|
|
45
50
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
51
|
+
localId: this.node.attrs.localId,
|
|
46
52
|
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
47
53
|
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
54
|
+
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
55
|
+
return _useFetchSyncBlockTitle(_this2.syncBlockStore, _this2.node);
|
|
56
|
+
},
|
|
48
57
|
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
49
|
-
return _useFetchSyncBlockData(_this2.syncBlockStore,
|
|
58
|
+
return _useFetchSyncBlockData(_this2.syncBlockStore, resourceId, localId);
|
|
50
59
|
}
|
|
51
60
|
});
|
|
52
61
|
}
|
|
@@ -54,9 +63,6 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
54
63
|
key: "destroy",
|
|
55
64
|
value: function destroy() {
|
|
56
65
|
var _this$unsubscribe;
|
|
57
|
-
if (this.fetchIntervalId) {
|
|
58
|
-
window.clearInterval(this.fetchIntervalId);
|
|
59
|
-
}
|
|
60
66
|
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
|
|
61
67
|
_superPropGet(SyncBlock, "destroy", this, 3)([]);
|
|
62
68
|
}
|
|
@@ -6,8 +6,11 @@ export var BodiedSyncBlockWrapper = /*#__PURE__*/React.forwardRef(function (_ref
|
|
|
6
6
|
syncBlockStore = _ref.syncBlockStore;
|
|
7
7
|
// TODO: EDITOR-2429 - this should be debounced (either here or in the data provider) to avoid excessive API writes
|
|
8
8
|
useHandleContentChanges(syncBlockStore, node);
|
|
9
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
10
10
|
"data-testid": "bodied-sync-block-wrapper",
|
|
11
11
|
ref: ref
|
|
12
|
+
}), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
13
|
+
isSource: true,
|
|
14
|
+
localId: node.attrs.localId
|
|
12
15
|
}));
|
|
13
16
|
});
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { SyncBlocksIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
6
|
+
import { Flex, Text } from '@atlaskit/primitives/compiled';
|
|
5
7
|
import { canBeConvertedToSyncBlock } from '../pm-plugins/utils/utils';
|
|
6
8
|
export var CreateSyncedBlockDropdownItem = function CreateSyncedBlockDropdownItem(_ref) {
|
|
7
9
|
var _api$selection;
|
|
@@ -35,5 +37,10 @@ export var CreateSyncedBlockDropdownItem = function CreateSyncedBlockDropdownIte
|
|
|
35
37
|
label: ""
|
|
36
38
|
}),
|
|
37
39
|
onClick: onClick
|
|
38
|
-
},
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
gap: "space.050"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Text, null, selection !== null && selection !== void 0 && selection.empty ? formatMessage(blockMenuMessages.createSyncedBlock) : formatMessage(blockMenuMessages.convertToSyncedBlock)), /*#__PURE__*/React.createElement(Lozenge, {
|
|
44
|
+
appearance: "new"
|
|
45
|
+
}, formatMessage(blockMenuMessages.newLozenge))));
|
|
39
46
|
};
|
|
@@ -2,15 +2,47 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { SyncBlockLabelSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
5
|
+
import { ConfluenceIcon } from '@atlaskit/logo';
|
|
6
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
7
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
5
9
|
var SyncBlockLabelDataId = 'sync-block-label';
|
|
6
|
-
var SyncBlockLabelComponent = function SyncBlockLabelComponent() {
|
|
10
|
+
var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
11
|
+
var isSource = _ref.isSource,
|
|
12
|
+
useFetchSyncBlockTitle = _ref.useFetchSyncBlockTitle,
|
|
13
|
+
localId = _ref.localId;
|
|
7
14
|
var _useIntl = useIntl(),
|
|
8
15
|
formatMessage = _useIntl.formatMessage;
|
|
9
|
-
|
|
16
|
+
var title = useFetchSyncBlockTitle === null || useFetchSyncBlockTitle === void 0 ? void 0 : useFetchSyncBlockTitle();
|
|
17
|
+
var tooltipContent = isSource ? formatMessage(messages.sourceSyncBlockTooltip) : title ? formatMessage(messages.referenceSyncBlockTooltip, {
|
|
18
|
+
title: title
|
|
19
|
+
}) : formatMessage(messages.defaultSyncBlockTooltip);
|
|
20
|
+
var ariaDescribedById = "sync-block-label-description-".concat(localId);
|
|
21
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
22
|
+
position: "top",
|
|
23
|
+
content: tooltipContent
|
|
24
|
+
// workaround because tooltip adds aria-describedby with a new id every time the tooltip is opened
|
|
25
|
+
// this causes an infinite rerender loop because of the forwardRef from the node view we are inside in bodiedSyncBlock
|
|
26
|
+
// tooltip content is available for screen readers in visually hidden content after the label
|
|
27
|
+
,
|
|
28
|
+
isScreenReaderAnnouncementDisabled: true
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
10
30
|
"data-testid": SyncBlockLabelDataId
|
|
11
31
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
12
32
|
,
|
|
13
|
-
className: SyncBlockLabelSharedCssClassName.labelClassName
|
|
14
|
-
|
|
33
|
+
className: SyncBlockLabelSharedCssClassName.labelClassName,
|
|
34
|
+
"aria-describedby": ariaDescribedById
|
|
35
|
+
}, /*#__PURE__*/React.createElement(ConfluenceIcon, {
|
|
36
|
+
size: "xsmall",
|
|
37
|
+
appearance: "neutral",
|
|
38
|
+
shouldUseNewLogoDesign: true
|
|
39
|
+
}), isSource || !title ? /*#__PURE__*/React.createElement(Text, {
|
|
40
|
+
size: "small"
|
|
41
|
+
}, formatMessage(messages.syncedBlockLabel)) : /*#__PURE__*/React.createElement(Text, {
|
|
42
|
+
maxLines: 1,
|
|
43
|
+
size: "small"
|
|
44
|
+
}, title)), /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
45
|
+
id: ariaDescribedById
|
|
46
|
+
}, tooltipContent));
|
|
15
47
|
};
|
|
16
48
|
export var SyncBlockLabel = /*#__PURE__*/React.memo(SyncBlockLabelComponent);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
var
|
|
2
|
+
export var SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
3
3
|
|
|
4
4
|
// Component that refreshes synced block subscriptions at regular intervals
|
|
5
5
|
// this is a workaround for the subscription mechanism not being real-time
|
|
@@ -12,7 +12,7 @@ export var SyncBlockRefresher = function SyncBlockRefresher(_ref) {
|
|
|
12
12
|
if (((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) === 'visible') {
|
|
13
13
|
syncBlockStoreManager.refreshSubscriptions();
|
|
14
14
|
}
|
|
15
|
-
},
|
|
15
|
+
}, SYNC_BLOCK_FETCH_INTERVAL);
|
|
16
16
|
return function () {
|
|
17
17
|
window.clearInterval(interval);
|
|
18
18
|
};
|
|
@@ -5,8 +5,10 @@ var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
|
5
5
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
6
6
|
var getSyncedBlockRenderer = _ref.getSyncedBlockRenderer,
|
|
7
7
|
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
8
|
-
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders
|
|
9
|
-
|
|
8
|
+
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders,
|
|
9
|
+
localId = _ref.localId,
|
|
10
|
+
useFetchSyncBlockTitle = _ref.useFetchSyncBlockTitle;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
10
12
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
11
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
12
14
|
,
|
|
@@ -14,6 +16,10 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
14
16
|
}, getSyncedBlockRenderer({
|
|
15
17
|
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
16
18
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
17
|
-
}))
|
|
19
|
+
})), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
20
|
+
isSource: false,
|
|
21
|
+
useFetchSyncBlockTitle: useFetchSyncBlockTitle,
|
|
22
|
+
localId: localId
|
|
23
|
+
}));
|
|
18
24
|
};
|
|
19
25
|
export var SyncBlockRendererWrapper = /*#__PURE__*/React.memo(SyncBlockRendererWrapperComponent);
|
|
@@ -36,7 +36,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
36
36
|
appearance: 'subtle',
|
|
37
37
|
icon: CopyIcon,
|
|
38
38
|
title: formatMessage(messages.copySyncBlockLabel),
|
|
39
|
-
showTitle:
|
|
39
|
+
showTitle: false,
|
|
40
40
|
tooltipContent: formatMessage(messages.copySyncBlockTooltip),
|
|
41
41
|
onClick: copySyncedBlockReferenceToClipboard(api)
|
|
42
42
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
|
|
@@ -61,9 +61,6 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
61
61
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
62
62
|
var testId = 'synced-block-overflow-dropdown-trigger';
|
|
63
63
|
var overflowMenuConfig = [{
|
|
64
|
-
type: 'separator',
|
|
65
|
-
fullHeight: true
|
|
66
|
-
}, {
|
|
67
64
|
type: 'overflow-dropdown',
|
|
68
65
|
testId: testId,
|
|
69
66
|
options: [_objectSpread({
|
|
@@ -9,7 +9,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
9
9
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
10
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
12
|
-
import type {
|
|
12
|
+
import type { SyncBlockDataProvider, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
13
13
|
export type SyncedBlockEditorProps = {
|
|
14
14
|
defaultDocument: JSONDocNode;
|
|
15
15
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -34,7 +34,7 @@ export type SyncedBlockEditorProps = {
|
|
|
34
34
|
};
|
|
35
35
|
export type SyncedBlockRendererProps = {
|
|
36
36
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
|
-
useFetchSyncBlockData: () =>
|
|
37
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
38
38
|
};
|
|
39
39
|
export type SyncedBlockPluginOptions = {
|
|
40
40
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type SyncBlockLabelProps = {
|
|
3
|
+
isSource: boolean;
|
|
4
|
+
localId: string;
|
|
5
|
+
useFetchSyncBlockTitle?: () => string | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const SyncBlockLabel: React.MemoExoticComponent<({ isSource, useFetchSyncBlockTitle, localId, }: SyncBlockLabelProps) => React.JSX.Element>;
|
|
8
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
2
|
+
export declare const SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
2
3
|
export declare const SyncBlockRefresher: ({ syncBlockStoreManager, }: {
|
|
3
4
|
syncBlockStoreManager: SyncBlockStoreManager;
|
|
4
5
|
}) => null;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
|
+
localId: string;
|
|
7
8
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
8
|
-
useFetchSyncBlockData: () =>
|
|
9
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
10
|
+
useFetchSyncBlockTitle: () => string | undefined;
|
|
9
11
|
};
|
|
10
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, }: Props) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
11
13
|
export {};
|
|
@@ -9,7 +9,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
9
9
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
10
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
12
|
-
import type {
|
|
12
|
+
import type { SyncBlockDataProvider, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
13
13
|
export type SyncedBlockEditorProps = {
|
|
14
14
|
defaultDocument: JSONDocNode;
|
|
15
15
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -34,7 +34,7 @@ export type SyncedBlockEditorProps = {
|
|
|
34
34
|
};
|
|
35
35
|
export type SyncedBlockRendererProps = {
|
|
36
36
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
|
-
useFetchSyncBlockData: () =>
|
|
37
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
38
38
|
};
|
|
39
39
|
export type SyncedBlockPluginOptions = {
|
|
40
40
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type SyncBlockLabelProps = {
|
|
3
|
+
isSource: boolean;
|
|
4
|
+
localId: string;
|
|
5
|
+
useFetchSyncBlockTitle?: () => string | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const SyncBlockLabel: React.MemoExoticComponent<({ isSource, useFetchSyncBlockTitle, localId, }: SyncBlockLabelProps) => React.JSX.Element>;
|
|
8
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
2
|
+
export declare const SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
2
3
|
export declare const SyncBlockRefresher: ({ syncBlockStoreManager, }: {
|
|
3
4
|
syncBlockStoreManager: SyncBlockStoreManager;
|
|
4
5
|
}) => null;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
|
+
localId: string;
|
|
7
8
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
8
|
-
useFetchSyncBlockData: () =>
|
|
9
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
10
|
+
useFetchSyncBlockTitle: () => string | undefined;
|
|
9
11
|
};
|
|
10
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, }: Props) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
11
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,16 +38,21 @@
|
|
|
38
38
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.8.0",
|
|
41
|
-
"@atlaskit/editor-synced-block-provider": "^2.
|
|
41
|
+
"@atlaskit/editor-synced-block-provider": "^2.6.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
43
|
"@atlaskit/editor-toolbar": "^0.17.0",
|
|
44
44
|
"@atlaskit/icon": "28.5.3",
|
|
45
|
+
"@atlaskit/logo": "^19.9.0",
|
|
46
|
+
"@atlaskit/lozenge": "^13.0.0",
|
|
45
47
|
"@atlaskit/modal-dialog": "^14.6.0",
|
|
48
|
+
"@atlaskit/primitives": "^16.1.0",
|
|
49
|
+
"@atlaskit/tooltip": "^20.7.0",
|
|
50
|
+
"@atlaskit/visually-hidden": "^3.0.0",
|
|
46
51
|
"@babel/runtime": "^7.0.0",
|
|
47
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
48
53
|
},
|
|
49
54
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^110.
|
|
55
|
+
"@atlaskit/editor-common": "^110.22.0",
|
|
51
56
|
"react": "^18.2.0"
|
|
52
57
|
},
|
|
53
58
|
"devDependencies": {
|