@atlaskit/editor-plugin-synced-block 24.0.5 → 24.0.7
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 +16 -0
- package/dist/cjs/editor-commands/index.js +60 -60
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +6 -6
- package/dist/cjs/nodeviews/syncedBlock.js +5 -4
- package/dist/cjs/pm-plugins/main.js +21 -21
- package/dist/cjs/pm-plugins/menu-and-toolbar-experiences.js +41 -37
- package/dist/cjs/pm-plugins/utils/selection-decorations.js +1 -1
- package/dist/cjs/pm-plugins/utils/utils.js +7 -7
- package/dist/cjs/syncedBlockPlugin.js +4 -4
- package/dist/cjs/ui/CreateSyncedBlockButton.js +12 -11
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +22 -20
- package/dist/cjs/ui/DeleteConfirmationModal.js +22 -22
- package/dist/cjs/ui/Flag.js +35 -35
- package/dist/cjs/ui/SourceSyncBlockPlaceholder.js +3 -3
- package/dist/cjs/ui/SyncBlockLabel.js +13 -13
- package/dist/cjs/ui/SyncBlockRefresher.js +4 -4
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +7 -5
- package/dist/cjs/ui/SyncBlockSSRReactContextsProvider.js +2 -2
- package/dist/cjs/ui/SyncedLocationDropdown.js +63 -55
- package/dist/cjs/ui/block-menu-components.js +5 -4
- package/dist/cjs/ui/floating-toolbar.js +28 -26
- package/dist/cjs/ui/quick-insert/SyncedBlockQuickInsertMenuItem.js +9 -9
- package/dist/cjs/ui/quick-insert/getSyncedBlockQuickInsertComponents.js +3 -3
- package/dist/cjs/ui/quick-insert.js +9 -9
- package/dist/cjs/ui/toolbar-components.js +16 -14
- package/dist/es2019/editor-commands/index.js +2 -2
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +3 -3
- package/dist/es2019/nodeviews/syncedBlock.js +3 -2
- package/dist/es2019/pm-plugins/main.js +6 -6
- package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +6 -2
- package/dist/es2019/pm-plugins/utils/selection-decorations.js +1 -1
- package/dist/es2019/pm-plugins/utils/utils.js +1 -1
- package/dist/es2019/syncedBlockPlugin.js +2 -2
- package/dist/es2019/ui/CreateSyncedBlockButton.js +6 -5
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +7 -5
- package/dist/es2019/ui/DeleteConfirmationModal.js +3 -3
- package/dist/es2019/ui/Flag.js +4 -4
- package/dist/es2019/ui/SourceSyncBlockPlaceholder.js +2 -2
- package/dist/es2019/ui/SyncBlockLabel.js +2 -2
- package/dist/es2019/ui/SyncBlockRefresher.js +2 -2
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +4 -2
- package/dist/es2019/ui/SyncBlockSSRReactContextsProvider.js +1 -1
- package/dist/es2019/ui/SyncedLocationDropdown.js +15 -9
- package/dist/es2019/ui/block-menu-components.js +2 -1
- package/dist/es2019/ui/floating-toolbar.js +10 -6
- package/dist/es2019/ui/quick-insert/SyncedBlockQuickInsertMenuItem.js +3 -3
- package/dist/es2019/ui/quick-insert/getSyncedBlockQuickInsertComponents.js +1 -1
- package/dist/es2019/ui/quick-insert.js +3 -3
- package/dist/es2019/ui/toolbar-components.js +4 -2
- package/dist/esm/editor-commands/index.js +2 -2
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +3 -3
- package/dist/esm/nodeviews/syncedBlock.js +3 -2
- package/dist/esm/pm-plugins/main.js +6 -6
- package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +6 -2
- package/dist/esm/pm-plugins/utils/selection-decorations.js +1 -1
- package/dist/esm/pm-plugins/utils/utils.js +1 -1
- package/dist/esm/syncedBlockPlugin.js +2 -2
- package/dist/esm/ui/CreateSyncedBlockButton.js +6 -5
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +7 -5
- package/dist/esm/ui/DeleteConfirmationModal.js +3 -3
- package/dist/esm/ui/Flag.js +4 -4
- package/dist/esm/ui/SourceSyncBlockPlaceholder.js +2 -2
- package/dist/esm/ui/SyncBlockLabel.js +2 -2
- package/dist/esm/ui/SyncBlockRefresher.js +2 -2
- package/dist/esm/ui/SyncBlockRendererWrapper.js +4 -2
- package/dist/esm/ui/SyncBlockSSRReactContextsProvider.js +1 -1
- package/dist/esm/ui/SyncedLocationDropdown.js +24 -16
- package/dist/esm/ui/block-menu-components.js +2 -1
- package/dist/esm/ui/floating-toolbar.js +10 -6
- package/dist/esm/ui/quick-insert/SyncedBlockQuickInsertMenuItem.js +3 -3
- package/dist/esm/ui/quick-insert/getSyncedBlockQuickInsertComponents.js +1 -1
- package/dist/esm/ui/quick-insert.js +3 -3
- package/dist/esm/ui/toolbar-components.js +4 -2
- package/dist/types/editor-actions/index.d.ts +1 -1
- package/dist/types/editor-commands/index.d.ts +7 -3
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +6 -5
- package/dist/types/nodeviews/lazySyncedBlock.d.ts +1 -1
- package/dist/types/nodeviews/syncedBlock.d.ts +7 -5
- package/dist/types/pm-plugins/main.d.ts +4 -3
- package/dist/types/pm-plugins/menu-and-toolbar-experiences.d.ts +1 -1
- package/dist/types/pm-plugins/utils/handle-bodied-sync-block-creation.d.ts +1 -1
- package/dist/types/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +2 -2
- package/dist/types/pm-plugins/utils/ignore-dom-event.d.ts +1 -1
- package/dist/types/syncedBlockPluginType.d.ts +21 -18
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/ui/CreateSyncedBlockButton.d.ts +1 -1
- package/dist/types/ui/CreateSyncedBlockDropdownItem.d.ts +1 -1
- package/dist/types/ui/DeleteConfirmationModal.d.ts +2 -2
- package/dist/types/ui/Flag.d.ts +1 -1
- package/dist/types/ui/SyncBlockRefresher.d.ts +2 -2
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +2 -2
- package/dist/types/ui/SyncedLocationDropdown.d.ts +8 -3
- package/dist/types/ui/block-menu-components.d.ts +2 -2
- package/dist/types/ui/floating-toolbar.d.ts +3 -2
- package/dist/types/ui/getUnpublishedSourceType.d.ts +1 -1
- package/dist/types/ui/quick-insert/SyncedBlockQuickInsertMenuItem.d.ts +2 -2
- package/dist/types/ui/quick-insert/getSyncedBlockQuickInsertComponents.d.ts +2 -2
- package/dist/types/ui/quick-insert.d.ts +3 -3
- package/dist/types/ui/toolbar-components.d.ts +2 -2
- package/docs/0-intro.tsx +1 -1
- package/package.json +4 -4
package/dist/cjs/ui/Flag.js
CHANGED
|
@@ -12,10 +12,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _reactIntl = require("react-intl");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
15
|
+
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
16
|
+
var _syncBlock = require("@atlaskit/editor-common/messages/syncBlock");
|
|
17
|
+
var _constants = require("@atlaskit/editor-common/sync-block/constants");
|
|
18
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
19
19
|
var _autoDismissFlag = _interopRequireDefault(require("@atlaskit/flag/auto-dismiss-flag"));
|
|
20
20
|
var _flag = _interopRequireDefault(require("@atlaskit/flag/flag"));
|
|
21
21
|
var _flagGroup = require("@atlaskit/flag/flag-group");
|
|
@@ -31,47 +31,47 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
31
31
|
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; }
|
|
32
32
|
var feedbackFlagStyles = null;
|
|
33
33
|
var flagMap = (_flagMap = {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_flagMap, _types.FLAG_ID.CANNOT_DELETE_WHEN_OFFLINE, {
|
|
34
|
-
title:
|
|
35
|
-
description:
|
|
34
|
+
title: _syncBlock.syncBlockMessages.failToDeleteTitle,
|
|
35
|
+
description: _syncBlock.syncBlockMessages.failToDeleteWhenOfflineDescription,
|
|
36
36
|
type: 'error'
|
|
37
37
|
}), _types.FLAG_ID.CANNOT_EDIT_WHEN_OFFLINE, {
|
|
38
|
-
title:
|
|
39
|
-
description:
|
|
38
|
+
title: _syncBlock.syncBlockMessages.failToEditTitle,
|
|
39
|
+
description: _syncBlock.syncBlockMessages.failToEditWhenOfflineDescription,
|
|
40
40
|
type: 'error'
|
|
41
41
|
}), _types.FLAG_ID.CANNOT_CREATE_WHEN_OFFLINE, {
|
|
42
|
-
title:
|
|
43
|
-
description:
|
|
42
|
+
title: _syncBlock.syncBlockMessages.failToCreateTitle,
|
|
43
|
+
description: _syncBlock.syncBlockMessages.failToCreateWhenOfflineDescription,
|
|
44
44
|
type: 'error'
|
|
45
45
|
}), _types.FLAG_ID.FAIL_TO_DELETE, {
|
|
46
|
-
title:
|
|
47
|
-
description:
|
|
46
|
+
title: _syncBlock.syncBlockMessages.cannotDeleteTitle,
|
|
47
|
+
description: _syncBlock.syncBlockMessages.cannotDeleteDescription,
|
|
48
48
|
type: 'error'
|
|
49
49
|
}), _types.FLAG_ID.SYNC_BLOCK_COPIED, {
|
|
50
|
-
title:
|
|
50
|
+
title: _syncBlock.syncBlockMessages.syncBlockCopiedTitle,
|
|
51
51
|
type: 'info'
|
|
52
52
|
}), _types.FLAG_ID.UNPUBLISHED_SYNC_BLOCK_PASTED, {
|
|
53
|
-
title:
|
|
54
|
-
description:
|
|
53
|
+
title: _syncBlock.syncBlockMessages.unpublishedSyncBlockPastedTitle,
|
|
54
|
+
description: _syncBlock.syncBlockMessages.unpublishedSyncBlockPastedDescription,
|
|
55
55
|
type: 'info'
|
|
56
56
|
}), _types.FLAG_ID.CANNOT_CREATE_SYNC_BLOCK, {
|
|
57
|
-
title:
|
|
58
|
-
description:
|
|
57
|
+
title: _syncBlock.syncBlockMessages.cannotCreateSyncBlockTitle,
|
|
58
|
+
description: _syncBlock.syncBlockMessages.CannotCreateSyncBlockDescription,
|
|
59
59
|
type: 'error'
|
|
60
60
|
}), _types.FLAG_ID.EXTENSION_IN_SYNC_BLOCK, {
|
|
61
|
-
title:
|
|
62
|
-
description:
|
|
61
|
+
title: _syncBlock.syncBlockMessages.extensionInSyncBlockTitle,
|
|
62
|
+
description: _syncBlock.syncBlockMessages.extensionInSyncBlockDescription,
|
|
63
63
|
type: 'error'
|
|
64
64
|
}), _types.FLAG_ID.INLINE_EXTENSION_IN_SYNC_BLOCK, {
|
|
65
|
-
title:
|
|
66
|
-
description:
|
|
65
|
+
title: _syncBlock.syncBlockMessages.inlineExtensionInSyncBlockTitle,
|
|
66
|
+
description: _syncBlock.syncBlockMessages.inlineExtensionInSyncBlockDescription,
|
|
67
67
|
type: 'error'
|
|
68
68
|
}), _types.FLAG_ID.DUPLICATE_SOURCE_SYNC_BLOCK, {
|
|
69
|
-
title:
|
|
70
|
-
description:
|
|
69
|
+
title: _syncBlock.syncBlockMessages.duplicateSourceSyncBlockTitle,
|
|
70
|
+
description: _syncBlock.syncBlockMessages.duplicateSourceSyncBlockDescription,
|
|
71
71
|
type: 'error'
|
|
72
72
|
}), (0, _defineProperty2.default)(_flagMap, _types.FLAG_ID.SYNC_BLOCK_FEEDBACK_PROMPT, {
|
|
73
|
-
title:
|
|
74
|
-
description:
|
|
73
|
+
title: _syncBlock.syncBlockMessages.feedbackFlagTitle,
|
|
74
|
+
description: _syncBlock.syncBlockMessages.feedbackFlagDescription,
|
|
75
75
|
type: 'feedback'
|
|
76
76
|
}));
|
|
77
77
|
var getSyncBlockCopiedDescription = exports.getSyncBlockCopiedDescription = function getSyncBlockCopiedDescription(activeFlag, isCopiedDescriptionEnabled) {
|
|
@@ -79,12 +79,12 @@ var getSyncBlockCopiedDescription = exports.getSyncBlockCopiedDescription = func
|
|
|
79
79
|
return undefined;
|
|
80
80
|
}
|
|
81
81
|
if (activeFlag.sourceProduct === 'jira-work-item') {
|
|
82
|
-
return activeFlag.isSourceContentUnpublished ?
|
|
82
|
+
return activeFlag.isSourceContentUnpublished ? _syncBlock.syncBlockMessages.syncBlockCopiedJiraUnsavedFieldDescription : _syncBlock.syncBlockMessages.syncBlockCopiedLivePageDescription;
|
|
83
83
|
}
|
|
84
84
|
if (activeFlag.sourceProduct !== 'confluence-page') {
|
|
85
85
|
return undefined;
|
|
86
86
|
}
|
|
87
|
-
return activeFlag.isLivePage || !activeFlag.isSourceContentUnpublished ?
|
|
87
|
+
return activeFlag.isLivePage || !activeFlag.isSourceContentUnpublished ? _syncBlock.syncBlockMessages.syncBlockCopiedLivePageDescription : _syncBlock.syncBlockMessages.syncBlockCopiedUnpublishedDescription;
|
|
88
88
|
};
|
|
89
89
|
var useSyncBlockSourceUrl = function useSyncBlockSourceUrl(syncBlockStore, resourceId) {
|
|
90
90
|
var _React$useState = _react.default.useState(),
|
|
@@ -118,7 +118,7 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
118
118
|
var api = _ref.api,
|
|
119
119
|
onFeedbackPromptShown = _ref.onFeedbackPromptShown,
|
|
120
120
|
onGiveFeedback = _ref.onGiveFeedback;
|
|
121
|
-
var _useSharedPluginState = (0,
|
|
121
|
+
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['syncedBlock', 'connectivity'], function (states) {
|
|
122
122
|
var _states$syncedBlockSt, _states$connectivityS, _states$syncedBlockSt2;
|
|
123
123
|
return {
|
|
124
124
|
activeFlag: (_states$syncedBlockSt = states.syncedBlockState) === null || _states$syncedBlockSt === void 0 ? void 0 : _states$syncedBlockSt.activeFlag,
|
|
@@ -158,8 +158,8 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
158
158
|
var isCopiedFlag = activeFlag.id === _types.FLAG_ID.SYNC_BLOCK_COPIED;
|
|
159
159
|
var isCopiedDescriptionEnabled = isCopiedFlag && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_blocks_patch_11') || activeFlag.sourceProduct === 'confluence-page');
|
|
160
160
|
var copiedDescription = getSyncBlockCopiedDescription(activeFlag, isCopiedDescriptionEnabled);
|
|
161
|
-
var title = isJiraUnpublishedPaste ?
|
|
162
|
-
var description = copiedDescription !== null && copiedDescription !== void 0 ? copiedDescription : isJiraUnpublishedPaste ?
|
|
161
|
+
var title = isJiraUnpublishedPaste ? _syncBlock.syncBlockMessages.unpublishedSyncBlockPastedTitleJiraWorkItem : defaultTitle;
|
|
162
|
+
var description = copiedDescription !== null && copiedDescription !== void 0 ? copiedDescription : isJiraUnpublishedPaste ? _syncBlock.syncBlockMessages.unpublishedSyncBlockPastedDescriptionJiraWorkItem : defaultDescription;
|
|
163
163
|
var descriptionContent = description ? formatMessage(description, {
|
|
164
164
|
link: function link(chunks) {
|
|
165
165
|
return sourceUrl ? /*#__PURE__*/_react.default.createElement(_anchor.Anchor, {
|
|
@@ -171,7 +171,7 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
171
171
|
}) : undefined;
|
|
172
172
|
|
|
173
173
|
// Retry button often involves network request, hence we dismiss the flag in offline mode to avoid retry
|
|
174
|
-
if ((0,
|
|
174
|
+
if ((0, _isOfflineMode.isOfflineMode)(mode) && !!onRetry) {
|
|
175
175
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
176
176
|
var tr = _ref2.tr;
|
|
177
177
|
tr.setMeta(_main.syncedBlockPluginKey, {
|
|
@@ -202,21 +202,21 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
202
202
|
if (type === 'error') {
|
|
203
203
|
if (onRetry) {
|
|
204
204
|
return [{
|
|
205
|
-
content: formatMessage(
|
|
205
|
+
content: formatMessage(_syncBlock.syncBlockMessages.deleteRetryButton),
|
|
206
206
|
onClick: onRetry
|
|
207
207
|
}];
|
|
208
208
|
}
|
|
209
209
|
} else if (type === 'info' && action) {
|
|
210
210
|
return [{
|
|
211
211
|
content: formatMessage(action),
|
|
212
|
-
href:
|
|
212
|
+
href: _constants.SYNCED_BLOCKS_DOCUMENTATION_URL,
|
|
213
213
|
target: '_blank',
|
|
214
214
|
rel: 'noopener noreferrer'
|
|
215
215
|
}];
|
|
216
216
|
} else if (type === 'feedback' && activeFlag.id === _types.FLAG_ID.SYNC_BLOCK_FEEDBACK_PROMPT && activeFlag.feedbackContext) {
|
|
217
217
|
var feedbackContext = activeFlag.feedbackContext;
|
|
218
218
|
return [{
|
|
219
|
-
content: formatMessage(
|
|
219
|
+
content: formatMessage(_syncBlock.syncBlockMessages.feedbackFlagGiveFeedback),
|
|
220
220
|
onClick: function onClick() {
|
|
221
221
|
dismissFlag(false);
|
|
222
222
|
try {
|
|
@@ -227,7 +227,7 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}, {
|
|
230
|
-
content: formatMessage(
|
|
230
|
+
content: formatMessage(_syncBlock.syncBlockMessages.feedbackFlagNoThanks),
|
|
231
231
|
onClick: onDismissed
|
|
232
232
|
}];
|
|
233
233
|
}
|
|
@@ -9,8 +9,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _reactIntl = require("react-intl");
|
|
12
|
-
var
|
|
13
|
-
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
12
|
+
var _placeholderText = require("@atlaskit/editor-common/messages/placeholder-text");
|
|
13
|
+
var _syncBlock = require("@atlaskit/editor-common/styles/sync-block");
|
|
14
14
|
/**
|
|
15
15
|
* @jsxRuntime classic
|
|
16
16
|
* @jsx jsx
|
|
@@ -45,7 +45,7 @@ var SourceSyncBlockPlaceholder = exports.SourceSyncBlockPlaceholder = function S
|
|
|
45
45
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
46
46
|
formatMessage = _useIntl.formatMessage;
|
|
47
47
|
var placeholderStyles = (0, _react.useMemo)(function () {
|
|
48
|
-
return getSourceSyncBlockPlaceholderStyles(JSON.stringify(formatMessage(
|
|
48
|
+
return getSourceSyncBlockPlaceholderStyles(JSON.stringify(formatMessage(_placeholderText.placeholderTextMessages.sourceSyncBlockPlaceholderText)));
|
|
49
49
|
}, [formatMessage]);
|
|
50
50
|
return (0, _react2.jsx)(_react2.Global, {
|
|
51
51
|
styles: placeholderStyles
|
|
@@ -12,8 +12,8 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactIntl = require("react-intl");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var _syncBlock = require("@atlaskit/editor-common/messages/syncBlock");
|
|
16
|
+
var _syncBlock2 = require("@atlaskit/editor-common/styles/sync-block");
|
|
17
17
|
var _blockSynced = _interopRequireDefault(require("@atlaskit/icon-lab/core/block-synced"));
|
|
18
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
19
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
@@ -34,13 +34,13 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
34
34
|
unpublishedInfo = _ref.unpublishedInfo;
|
|
35
35
|
var intl = (0, _reactIntl.useIntl)();
|
|
36
36
|
var formatMessage = intl.formatMessage;
|
|
37
|
-
var _useState = (0, _react.useState)(formatMessage(
|
|
37
|
+
var _useState = (0, _react.useState)(formatMessage(_syncBlock.syncBlockMessages.defaultSyncBlockTooltip)),
|
|
38
38
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
39
39
|
tooltipContent = _useState2[0],
|
|
40
40
|
setTooltipContent = _useState2[1];
|
|
41
|
-
var tooltipMessage = formatMessage(
|
|
41
|
+
var tooltipMessage = formatMessage(_syncBlock.syncBlockMessages.defaultSyncBlockTooltip);
|
|
42
42
|
if (title) {
|
|
43
|
-
tooltipMessage = formatMessage(
|
|
43
|
+
tooltipMessage = formatMessage(_syncBlock.syncBlockMessages.referenceSyncBlockTooltip, {
|
|
44
44
|
title: title
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -52,7 +52,7 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
52
52
|
size: "small",
|
|
53
53
|
color: "color.text.inverse",
|
|
54
54
|
weight: "bold"
|
|
55
|
-
}, formatMessage(
|
|
55
|
+
}, formatMessage(_syncBlock.syncBlockMessages.referenceSyncBlockSyncedFrom)), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
56
56
|
size: "small",
|
|
57
57
|
color: "color.text.inverse"
|
|
58
58
|
}, ' ', title)) : /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
@@ -62,7 +62,7 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
62
62
|
size: "small",
|
|
63
63
|
color: "color.text.inverse",
|
|
64
64
|
weight: "bold"
|
|
65
|
-
}, formatMessage(
|
|
65
|
+
}, formatMessage(_syncBlock.syncBlockMessages.referenceSyncBlockLastEdited)), /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
66
66
|
size: "small",
|
|
67
67
|
color: "color.text.inverse"
|
|
68
68
|
}, ' ', elapsedTime));
|
|
@@ -70,7 +70,7 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
70
70
|
setTooltipContent(tooltipContent);
|
|
71
71
|
}, [contentUpdatedAt, formatMessage, intl, title, tooltipMessage]);
|
|
72
72
|
var ariaDescribedById = "sync-block-label-description-".concat(localId);
|
|
73
|
-
var unpublishedParenthetical = unpublishedInfo ? formatMessage(
|
|
73
|
+
var unpublishedParenthetical = unpublishedInfo ? formatMessage(_syncBlock.syncBlockMessages.unpublishedInParentheses) : undefined;
|
|
74
74
|
var getLabelContent = (0, _react.useMemo)(function () {
|
|
75
75
|
// The parenthetical carries a leading space so the accessible name and copied text read as
|
|
76
76
|
// "… (unpublished)". Flex trims it visually, and the label's own gap provides the spacing.
|
|
@@ -97,24 +97,24 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
97
97
|
}, label);
|
|
98
98
|
};
|
|
99
99
|
if (isUnsyncedBlock) {
|
|
100
|
-
return renderPlainLabel(formatMessage(
|
|
100
|
+
return renderPlainLabel(formatMessage(_syncBlock.syncBlockMessages.unsyncedBlockLabel));
|
|
101
101
|
}
|
|
102
102
|
if (isSource) {
|
|
103
|
-
return renderPlainLabel(formatMessage(
|
|
103
|
+
return renderPlainLabel(formatMessage(_syncBlock.syncBlockMessages.sourceSyncedBlockLabel));
|
|
104
104
|
}
|
|
105
105
|
if (!title) {
|
|
106
|
-
return renderPlainLabel(formatMessage(
|
|
106
|
+
return renderPlainLabel(formatMessage(_syncBlock.syncBlockMessages.syncedBlockLabel));
|
|
107
107
|
}
|
|
108
108
|
return renderTruncatingTitle(title);
|
|
109
109
|
}, [formatMessage, isSource, isUnsyncedBlock, title, unpublishedParenthetical]);
|
|
110
|
-
var unpublishedTooltipLabel = unpublishedInfo ? formatMessage(unpublishedInfo.variant === 'source' ?
|
|
110
|
+
var unpublishedTooltipLabel = unpublishedInfo ? formatMessage(unpublishedInfo.variant === 'source' ? _syncBlock.syncBlockMessages.unpublishedSourceAvailabilityTooltip : _syncBlock.syncBlockMessages.unpublishedLocalReferenceAvailabilityTooltip, {
|
|
111
111
|
sourceType: unpublishedInfo.sourceType
|
|
112
112
|
}) : undefined;
|
|
113
113
|
var primaryLabel = /*#__PURE__*/_react.default.createElement("div", {
|
|
114
114
|
"data-testid": SyncBlockLabelDataId
|
|
115
115
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
116
116
|
,
|
|
117
|
-
className:
|
|
117
|
+
className: _syncBlock2.SyncBlockLabelSharedCssClassName.labelClassName,
|
|
118
118
|
"aria-describedby": isSource || isUnsyncedBlock ? undefined : ariaDescribedById
|
|
119
119
|
}, /*#__PURE__*/_react.default.createElement(_blockSynced.default, {
|
|
120
120
|
color: "var(--ds-icon-subtle, #505258)",
|
|
@@ -5,22 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SyncBlockRefresher = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
9
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
10
10
|
// Component that manages synced block data synchronization.
|
|
11
11
|
// Uses provider-based GraphQL subscriptions for updates when online.
|
|
12
12
|
// Falls back to polling at regular intervals when offline.
|
|
13
13
|
var SyncBlockRefresher = exports.SyncBlockRefresher = function SyncBlockRefresher(_ref) {
|
|
14
14
|
var syncBlockStoreManager = _ref.syncBlockStoreManager,
|
|
15
15
|
api = _ref.api;
|
|
16
|
-
var _useSharedPluginState = (0,
|
|
16
|
+
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['connectivity'], function (states) {
|
|
17
17
|
var _states$connectivityS;
|
|
18
18
|
return {
|
|
19
19
|
mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
|
|
20
20
|
};
|
|
21
21
|
}),
|
|
22
22
|
mode = _useSharedPluginState.mode;
|
|
23
|
-
var isOnline = !(0,
|
|
23
|
+
var isOnline = !(0, _isOfflineMode.isOfflineMode)(mode);
|
|
24
24
|
(0, _react.useEffect)(function () {
|
|
25
25
|
var useRealTimeSubscriptions = isOnline;
|
|
26
26
|
syncBlockStoreManager.referenceManager.setRealTimeSubscriptionsEnabled(useRealTimeSubscriptions);
|
|
@@ -9,8 +9,10 @@ exports.SyncBlockRendererWrapper = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _bindEventListener = require("bind-event-listener");
|
|
12
|
-
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
13
|
-
var
|
|
12
|
+
var _syncBlock = require("@atlaskit/editor-common/styles/sync-block");
|
|
13
|
+
var _types = require("@atlaskit/editor-synced-block-provider/common/types");
|
|
14
|
+
var _useFetchSyncBlockData = require("@atlaskit/editor-synced-block-provider/useFetchSyncBlockData");
|
|
15
|
+
var _useFetchSyncBlockTitle = require("@atlaskit/editor-synced-block-provider/useFetchSyncBlockTitle");
|
|
14
16
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
17
|
var _getUnpublishedSourceType = require("./getUnpublishedSourceType");
|
|
16
18
|
var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
@@ -25,8 +27,8 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
25
27
|
localId = _ref.localId,
|
|
26
28
|
api = _ref.api;
|
|
27
29
|
var isSamePageSyncEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('editor-synced-block-same-page-sync');
|
|
28
|
-
var syncBlockFetchResult = (0,
|
|
29
|
-
var title = (0,
|
|
30
|
+
var syncBlockFetchResult = (0, _useFetchSyncBlockData.useFetchSyncBlockData)(syncBlockStore, resourceId, localId, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent);
|
|
31
|
+
var title = (0, _useFetchSyncBlockTitle.useFetchSyncBlockTitle)(syncBlockStore, node);
|
|
30
32
|
var contentUpdatedAt = syncBlockFetchResult === null || syncBlockFetchResult === void 0 || (_syncBlockFetchResult = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult === void 0 || (_syncBlockFetchResult = _syncBlockFetchResult.data) === null || _syncBlockFetchResult === void 0 ? void 0 : _syncBlockFetchResult.contentUpdatedAt;
|
|
31
33
|
var isUnpublishedBlock = ((_syncBlockFetchResult2 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult2 === void 0 || (_syncBlockFetchResult2 = _syncBlockFetchResult2.data) === null || _syncBlockFetchResult2 === void 0 ? void 0 : _syncBlockFetchResult2.status) === 'unpublished';
|
|
32
34
|
var localSameDocumentSource = isSamePageSyncEnabled ? (_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 ? void 0 : _syncBlockFetchResult3.localSameDocumentSource : undefined;
|
|
@@ -51,7 +53,7 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
51
53
|
isMounted = false;
|
|
52
54
|
};
|
|
53
55
|
}, [localSourceBlockInstanceId, syncBlockStore.sourceManager]);
|
|
54
|
-
var isUnsyncedBlock = isUnpublishedBlock && !localSameDocumentSource || (syncBlockFetchResult === null || syncBlockFetchResult === void 0 || (_syncBlockFetchResult4 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult4 === void 0 || (_syncBlockFetchResult4 = _syncBlockFetchResult4.error) === null || _syncBlockFetchResult4 === void 0 ? void 0 : _syncBlockFetchResult4.type) ===
|
|
56
|
+
var isUnsyncedBlock = isUnpublishedBlock && !localSameDocumentSource || (syncBlockFetchResult === null || syncBlockFetchResult === void 0 || (_syncBlockFetchResult4 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult4 === void 0 || (_syncBlockFetchResult4 = _syncBlockFetchResult4.error) === null || _syncBlockFetchResult4 === void 0 ? void 0 : _syncBlockFetchResult4.type) === _types.SyncBlockError.NotFound;
|
|
55
57
|
|
|
56
58
|
// Prevent editing in the contentEditable renderer wrapper. We set
|
|
57
59
|
// contentEditable="true" to enable text selection (creating an editable
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.SyncBlockSSRReactContextsProvider = SyncBlockSSRReactContextsProvider;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
|
-
var
|
|
10
|
+
var _isSsr = require("@atlaskit/editor-common/is-ssr");
|
|
11
11
|
/**
|
|
12
12
|
* Wraps syncBlock nodeview children with the editor's actual IntlProvider during
|
|
13
13
|
* SSR streaming (renderToStaticMarkup). This ensures that components using
|
|
@@ -22,7 +22,7 @@ var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
|
22
22
|
function SyncBlockSSRReactContextsProvider(_ref) {
|
|
23
23
|
var children = _ref.children,
|
|
24
24
|
intl = _ref.intl;
|
|
25
|
-
if (!(0,
|
|
25
|
+
if (!(0, _isSsr.isSSR)()) {
|
|
26
26
|
return children;
|
|
27
27
|
}
|
|
28
28
|
if (!intl) {
|