@atlaskit/editor-plugin-synced-block 3.11.0 → 4.0.1
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 +9 -3
- package/dist/cjs/syncedBlockPlugin.js +3 -3
- 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/SyncBlockRendererWrapper.js +11 -3
- package/dist/cjs/ui/floating-toolbar.js +2 -9
- package/dist/es2019/nodeviews/syncedBlock.js +6 -3
- package/dist/es2019/syncedBlockPlugin.js +2 -2
- 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/SyncBlockRendererWrapper.js +11 -3
- package/dist/es2019/ui/floating-toolbar.js +2 -5
- package/dist/esm/nodeviews/syncedBlock.js +10 -4
- package/dist/esm/syncedBlockPlugin.js +3 -3
- 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/SyncBlockRendererWrapper.js +11 -3
- package/dist/esm/ui/floating-toolbar.js +2 -9
- package/dist/types/syncedBlockPluginType.d.ts +5 -3
- package/dist/types/ui/SyncBlockLabel.d.ts +7 -1
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +5 -1
- package/dist/types/ui/floating-toolbar.d.ts +2 -3
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +5 -3
- package/dist/types-ts4.5/ui/SyncBlockLabel.d.ts +7 -1
- package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +5 -1
- package/dist/types-ts4.5/ui/floating-toolbar.d.ts +2 -3
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 4.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7e3353721fa66`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7e3353721fa66) -
|
|
8
|
+
[ux] EDITOR-1822 update sync blocks ui to new design
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 4.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [`181018115c031`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/181018115c031) -
|
|
16
|
+
EDITOR-2438 Pass data providers to Synced Block nested renderer
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 3.11.0
|
|
4
23
|
|
|
5
24
|
### Minor 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
|
}
|
|
@@ -40,8 +40,9 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
40
40
|
key: "render",
|
|
41
41
|
value: function render() {
|
|
42
42
|
var _this$options,
|
|
43
|
-
|
|
44
|
-
_this$
|
|
43
|
+
_this$options2,
|
|
44
|
+
_this$options3,
|
|
45
|
+
_this2 = this;
|
|
45
46
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
46
47
|
return null;
|
|
47
48
|
}
|
|
@@ -49,10 +50,15 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
49
50
|
// get document node from data provider
|
|
50
51
|
|
|
51
52
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
53
|
+
localId: this.node.attrs.localId,
|
|
54
|
+
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
55
|
+
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
52
56
|
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
53
57
|
return (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(_this2.syncBlockStore, _this2.node);
|
|
54
58
|
},
|
|
55
|
-
|
|
59
|
+
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
60
|
+
return (0, _editorSyncedBlockProvider.useFetchSyncBlockTitle)(_this2.syncBlockStore, _this2.node);
|
|
61
|
+
}
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
64
|
}, {
|
|
@@ -21,7 +21,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
21
21
|
var _api$blockMenu;
|
|
22
22
|
var config = _ref.config,
|
|
23
23
|
api = _ref.api;
|
|
24
|
-
var syncBlockStore = new _editorSyncedBlockProvider.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.
|
|
24
|
+
var syncBlockStore = new _editorSyncedBlockProvider.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
|
|
25
25
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents((0, _blockMenuComponents.getBlockMenuComponents)(api));
|
|
26
26
|
return {
|
|
27
27
|
name: 'syncedBlock',
|
|
@@ -82,8 +82,8 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
82
82
|
}
|
|
83
83
|
}];
|
|
84
84
|
},
|
|
85
|
-
floatingToolbar: function floatingToolbar(state, intl
|
|
86
|
-
return (0, _floatingToolbar.getToolbarConfig)(state, intl,
|
|
85
|
+
floatingToolbar: function floatingToolbar(state, intl) {
|
|
86
|
+
return (0, _floatingToolbar.getToolbarConfig)(state, intl, api, syncBlockStore);
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
contentComponent: function contentComponent() {
|
|
@@ -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);
|
|
@@ -11,14 +11,22 @@ var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
|
11
11
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
12
12
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
13
13
|
var getSyncedBlockRenderer = _ref.getSyncedBlockRenderer,
|
|
14
|
-
useFetchSyncBlockData = _ref.useFetchSyncBlockData
|
|
15
|
-
|
|
14
|
+
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
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", {
|
|
16
19
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
17
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
18
21
|
,
|
|
19
22
|
className: _syncBlock.SyncBlockSharedCssClassName.renderer
|
|
20
23
|
}, getSyncedBlockRenderer({
|
|
24
|
+
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
21
25
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
22
|
-
}))
|
|
26
|
+
})), /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, {
|
|
27
|
+
isSource: false,
|
|
28
|
+
useFetchSyncBlockTitle: useFetchSyncBlockTitle,
|
|
29
|
+
localId: localId
|
|
30
|
+
}));
|
|
23
31
|
};
|
|
24
32
|
var SyncBlockRendererWrapper = exports.SyncBlockRendererWrapper = /*#__PURE__*/_react.default.memo(SyncBlockRendererWrapperComponent);
|
|
@@ -19,12 +19,8 @@ var _utils2 = require("../pm-plugins/utils/utils");
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
-
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
22
|
+
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore) {
|
|
23
23
|
var _api$decorations;
|
|
24
|
-
var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
25
|
-
var _providerFactory = arguments.length > 3 ? arguments[3] : undefined;
|
|
26
|
-
var api = arguments.length > 4 ? arguments[4] : undefined;
|
|
27
|
-
var syncBlockStore = arguments.length > 5 ? arguments[5] : undefined;
|
|
28
24
|
var syncBlockObject = (0, _utils2.findSyncBlockOrBodiedSyncBlock)(state);
|
|
29
25
|
if (!syncBlockObject) {
|
|
30
26
|
return;
|
|
@@ -49,7 +45,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
49
45
|
appearance: 'subtle',
|
|
50
46
|
icon: _copy.default,
|
|
51
47
|
title: formatMessage(_messages.syncBlockMessages.copySyncBlockLabel),
|
|
52
|
-
showTitle:
|
|
48
|
+
showTitle: false,
|
|
53
49
|
tooltipContent: formatMessage(_messages.syncBlockMessages.copySyncBlockTooltip),
|
|
54
50
|
onClick: (0, _editorCommands.copySyncedBlockReferenceToClipboard)(api)
|
|
55
51
|
}, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
|
|
@@ -74,9 +70,6 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
74
70
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
75
71
|
var testId = 'synced-block-overflow-dropdown-trigger';
|
|
76
72
|
var overflowMenuConfig = [{
|
|
77
|
-
type: 'separator',
|
|
78
|
-
fullHeight: true
|
|
79
|
-
}, {
|
|
80
73
|
type: 'overflow-dropdown',
|
|
81
74
|
testId: testId,
|
|
82
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) {
|
|
@@ -15,7 +15,7 @@ class SyncBlock extends ReactNodeView {
|
|
|
15
15
|
return domRef;
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
|
-
var _this$options, _this$options2;
|
|
18
|
+
var _this$options, _this$options2, _this$options3;
|
|
19
19
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
@@ -23,8 +23,11 @@ class SyncBlock extends ReactNodeView {
|
|
|
23
23
|
// get document node from data provider
|
|
24
24
|
|
|
25
25
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
26
|
+
localId: this.node.attrs.localId,
|
|
27
|
+
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
28
|
+
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
26
29
|
useFetchSyncBlockData: () => useFetchSyncBlockData(this.syncBlockStore, this.node),
|
|
27
|
-
|
|
30
|
+
useFetchSyncBlockTitle: () => useFetchSyncBlockTitle(this.syncBlockStore, this.node)
|
|
28
31
|
});
|
|
29
32
|
}
|
|
30
33
|
destroy() {
|
|
@@ -15,7 +15,7 @@ export const syncedBlockPlugin = ({
|
|
|
15
15
|
api
|
|
16
16
|
}) => {
|
|
17
17
|
var _api$blockMenu;
|
|
18
|
-
const syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.
|
|
18
|
+
const syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
|
|
19
19
|
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(getBlockMenuComponents(api));
|
|
20
20
|
return {
|
|
21
21
|
name: 'syncedBlock',
|
|
@@ -68,7 +68,7 @@ export const syncedBlockPlugin = ({
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}],
|
|
71
|
-
floatingToolbar: (state, intl
|
|
71
|
+
floatingToolbar: (state, intl) => getToolbarConfig(state, intl, api, syncBlockStore)
|
|
72
72
|
},
|
|
73
73
|
contentComponent: () => {
|
|
74
74
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SyncBlockRefresher, {
|
|
@@ -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);
|
|
@@ -4,15 +4,23 @@ import { SyncBlockLabel } from './SyncBlockLabel';
|
|
|
4
4
|
const SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
5
5
|
const SyncBlockRendererWrapperComponent = ({
|
|
6
6
|
getSyncedBlockRenderer,
|
|
7
|
-
useFetchSyncBlockData
|
|
7
|
+
useFetchSyncBlockData,
|
|
8
|
+
syncBlockRendererDataProviders,
|
|
9
|
+
localId,
|
|
10
|
+
useFetchSyncBlockTitle
|
|
8
11
|
}) => {
|
|
9
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
10
13
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
11
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
12
15
|
,
|
|
13
16
|
className: SyncBlockSharedCssClassName.renderer
|
|
14
17
|
}, getSyncedBlockRenderer({
|
|
18
|
+
syncBlockRendererDataProviders,
|
|
15
19
|
useFetchSyncBlockData
|
|
16
|
-
}))
|
|
20
|
+
})), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
21
|
+
isSource: false,
|
|
22
|
+
useFetchSyncBlockTitle: useFetchSyncBlockTitle,
|
|
23
|
+
localId: localId
|
|
24
|
+
}));
|
|
17
25
|
};
|
|
18
26
|
export const SyncBlockRendererWrapper = /*#__PURE__*/React.memo(SyncBlockRendererWrapperComponent);
|
|
@@ -7,7 +7,7 @@ import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
|
7
7
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
8
8
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
9
9
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
10
|
-
export const getToolbarConfig = (state, intl,
|
|
10
|
+
export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
11
11
|
var _api$decorations;
|
|
12
12
|
const syncBlockObject = findSyncBlockOrBodiedSyncBlock(state);
|
|
13
13
|
if (!syncBlockObject) {
|
|
@@ -39,7 +39,7 @@ export const getToolbarConfig = (state, intl, _options = {}, _providerFactory, a
|
|
|
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, _options = {}, _providerFactory, a
|
|
|
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) {
|
|
@@ -33,8 +33,9 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
33
33
|
key: "render",
|
|
34
34
|
value: function render() {
|
|
35
35
|
var _this$options,
|
|
36
|
-
|
|
37
|
-
_this$
|
|
36
|
+
_this$options2,
|
|
37
|
+
_this$options3,
|
|
38
|
+
_this2 = this;
|
|
38
39
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
39
40
|
return null;
|
|
40
41
|
}
|
|
@@ -42,10 +43,15 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
42
43
|
// get document node from data provider
|
|
43
44
|
|
|
44
45
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
46
|
+
localId: this.node.attrs.localId,
|
|
47
|
+
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
48
|
+
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
45
49
|
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
46
50
|
return _useFetchSyncBlockData(_this2.syncBlockStore, _this2.node);
|
|
47
51
|
},
|
|
48
|
-
|
|
52
|
+
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
53
|
+
return _useFetchSyncBlockTitle(_this2.syncBlockStore, _this2.node);
|
|
54
|
+
}
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
}, {
|
|
@@ -14,7 +14,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
|
|
|
14
14
|
var _api$blockMenu;
|
|
15
15
|
var config = _ref.config,
|
|
16
16
|
api = _ref.api;
|
|
17
|
-
var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.
|
|
17
|
+
var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
|
|
18
18
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(getBlockMenuComponents(api));
|
|
19
19
|
return {
|
|
20
20
|
name: 'syncedBlock',
|
|
@@ -75,8 +75,8 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
|
|
|
75
75
|
}
|
|
76
76
|
}];
|
|
77
77
|
},
|
|
78
|
-
floatingToolbar: function floatingToolbar(state, intl
|
|
79
|
-
return getToolbarConfig(state, intl,
|
|
78
|
+
floatingToolbar: function floatingToolbar(state, intl) {
|
|
79
|
+
return getToolbarConfig(state, intl, api, syncBlockStore);
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
contentComponent: function contentComponent() {
|
|
@@ -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);
|
|
@@ -4,14 +4,22 @@ import { SyncBlockLabel } from './SyncBlockLabel';
|
|
|
4
4
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
5
5
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
6
6
|
var getSyncedBlockRenderer = _ref.getSyncedBlockRenderer,
|
|
7
|
-
useFetchSyncBlockData = _ref.useFetchSyncBlockData
|
|
8
|
-
|
|
7
|
+
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
8
|
+
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders,
|
|
9
|
+
localId = _ref.localId,
|
|
10
|
+
useFetchSyncBlockTitle = _ref.useFetchSyncBlockTitle;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
9
12
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
10
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
11
14
|
,
|
|
12
15
|
className: SyncBlockSharedCssClassName.renderer
|
|
13
16
|
}, getSyncedBlockRenderer({
|
|
17
|
+
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
14
18
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
15
|
-
}))
|
|
19
|
+
})), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
20
|
+
isSource: false,
|
|
21
|
+
useFetchSyncBlockTitle: useFetchSyncBlockTitle,
|
|
22
|
+
localId: localId
|
|
23
|
+
}));
|
|
16
24
|
};
|
|
17
25
|
export var SyncBlockRendererWrapper = /*#__PURE__*/React.memo(SyncBlockRendererWrapperComponent);
|
|
@@ -10,12 +10,8 @@ import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
|
10
10
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
11
11
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
12
12
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
13
|
-
export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
13
|
+
export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore) {
|
|
14
14
|
var _api$decorations;
|
|
15
|
-
var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
16
|
-
var _providerFactory = arguments.length > 3 ? arguments[3] : undefined;
|
|
17
|
-
var api = arguments.length > 4 ? arguments[4] : undefined;
|
|
18
|
-
var syncBlockStore = arguments.length > 5 ? arguments[5] : undefined;
|
|
19
15
|
var syncBlockObject = findSyncBlockOrBodiedSyncBlock(state);
|
|
20
16
|
if (!syncBlockObject) {
|
|
21
17
|
return;
|
|
@@ -40,7 +36,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
|
40
36
|
appearance: 'subtle',
|
|
41
37
|
icon: CopyIcon,
|
|
42
38
|
title: formatMessage(messages.copySyncBlockLabel),
|
|
43
|
-
showTitle:
|
|
39
|
+
showTitle: false,
|
|
44
40
|
tooltipContent: formatMessage(messages.copySyncBlockTooltip),
|
|
45
41
|
onClick: copySyncedBlockReferenceToClipboard(api)
|
|
46
42
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
|
|
@@ -65,9 +61,6 @@ export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
|
65
61
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
66
62
|
var testId = 'synced-block-overflow-dropdown-trigger';
|
|
67
63
|
var overflowMenuConfig = [{
|
|
68
|
-
type: 'separator',
|
|
69
|
-
fullHeight: true
|
|
70
|
-
}, {
|
|
71
64
|
type: 'overflow-dropdown',
|
|
72
65
|
testId: testId,
|
|
73
66
|
options: [_objectSpread({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -32,12 +33,13 @@ export type SyncedBlockEditorProps = {
|
|
|
32
33
|
popupsMountPoint: HTMLElement;
|
|
33
34
|
};
|
|
34
35
|
export type SyncedBlockRendererProps = {
|
|
36
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
35
37
|
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
36
38
|
};
|
|
37
39
|
export type SyncedBlockPluginOptions = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
|
+
syncBlockDataProvider: SyncBlockDataProvider;
|
|
42
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
41
43
|
};
|
|
42
44
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
43
45
|
actions: {
|
|
@@ -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,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
3
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
5
|
type Props = {
|
|
5
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
|
+
localId: string;
|
|
8
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
6
9
|
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
10
|
+
useFetchSyncBlockTitle: () => string | undefined;
|
|
7
11
|
};
|
|
8
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, }: Props) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
9
13
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import type { SyncedBlockPlugin
|
|
7
|
-
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape,
|
|
5
|
+
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
6
|
+
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, syncBlockStore: SyncBlockStoreManager) => FloatingToolbarConfig | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -32,12 +33,13 @@ export type SyncedBlockEditorProps = {
|
|
|
32
33
|
popupsMountPoint: HTMLElement;
|
|
33
34
|
};
|
|
34
35
|
export type SyncedBlockRendererProps = {
|
|
36
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
35
37
|
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
36
38
|
};
|
|
37
39
|
export type SyncedBlockPluginOptions = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
|
+
syncBlockDataProvider: SyncBlockDataProvider;
|
|
42
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
41
43
|
};
|
|
42
44
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
43
45
|
actions: {
|
|
@@ -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,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
3
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
5
|
type Props = {
|
|
5
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
|
+
localId: string;
|
|
8
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
6
9
|
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
10
|
+
useFetchSyncBlockTitle: () => string | undefined;
|
|
7
11
|
};
|
|
8
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, }: Props) => React.JSX.Element>;
|
|
12
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
9
13
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import type { SyncedBlockPlugin
|
|
7
|
-
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape,
|
|
5
|
+
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
6
|
+
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, syncBlockStore: SyncBlockStoreManager) => FloatingToolbarConfig | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,12 @@
|
|
|
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
|
},
|