@atlaskit/editor-plugin-synced-block 8.3.2 → 8.3.4
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/AGENTS.md +1 -2
- package/CHANGELOG.md +26 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +7 -25
- package/dist/cjs/nodeviews/syncedBlock.js +1 -4
- package/dist/cjs/pm-plugins/main.js +54 -60
- package/dist/cjs/pm-plugins/menu-and-toolbar-experiences.js +10 -19
- package/dist/cjs/pm-plugins/utils/utils.js +3 -10
- package/dist/cjs/syncedBlockPlugin.js +1 -7
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +23 -13
- package/dist/cjs/ui/DeleteConfirmationModal.js +29 -93
- package/dist/cjs/ui/SyncBlockLabel.js +1 -4
- package/dist/cjs/ui/SyncedLocationDropdown.js +2 -2
- package/dist/cjs/ui/floating-toolbar.js +1 -2
- package/dist/cjs/ui/quick-insert.js +2 -3
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +7 -23
- package/dist/es2019/nodeviews/syncedBlock.js +1 -4
- package/dist/es2019/pm-plugins/main.js +42 -48
- package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +7 -19
- package/dist/es2019/pm-plugins/utils/utils.js +3 -11
- package/dist/es2019/syncedBlockPlugin.js +1 -7
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +15 -6
- package/dist/es2019/ui/DeleteConfirmationModal.js +36 -77
- package/dist/es2019/ui/SyncBlockLabel.js +1 -4
- package/dist/es2019/ui/SyncedLocationDropdown.js +2 -2
- package/dist/es2019/ui/floating-toolbar.js +1 -2
- package/dist/es2019/ui/quick-insert.js +2 -2
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +7 -25
- package/dist/esm/nodeviews/syncedBlock.js +1 -4
- package/dist/esm/pm-plugins/main.js +54 -60
- package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +10 -19
- package/dist/esm/pm-plugins/utils/utils.js +3 -11
- package/dist/esm/syncedBlockPlugin.js +1 -7
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +23 -13
- package/dist/esm/ui/DeleteConfirmationModal.js +29 -93
- package/dist/esm/ui/SyncBlockLabel.js +1 -4
- package/dist/esm/ui/SyncedLocationDropdown.js +2 -2
- package/dist/esm/ui/floating-toolbar.js +1 -2
- package/dist/esm/ui/quick-insert.js +2 -3
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +1 -3
- package/dist/types-ts4.5/nodeviews/bodiedSyncedBlock.d.ts +1 -3
- package/docs/0-intro.tsx +1 -1
- package/package.json +8 -20
- package/dist/cjs/nodeviews/bodiedSyncBlockNodeWithToDOMFixed.js +0 -35
- package/dist/es2019/nodeviews/bodiedSyncBlockNodeWithToDOMFixed.js +0 -27
- package/dist/esm/nodeviews/bodiedSyncBlockNodeWithToDOMFixed.js +0 -28
- package/dist/types/nodeviews/bodiedSyncBlockNodeWithToDOMFixed.d.ts +0 -6
- package/dist/types-ts4.5/nodeviews/bodiedSyncBlockNodeWithToDOMFixed.d.ts +0 -6
|
@@ -4,7 +4,6 @@ import { ACTION, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { Experience, EXPERIENCE_ID, ExperienceCheckDomMutation, ExperienceCheckTimeout, getNodeQuery, getPopupContainerFromEditorView, popupWithNestedElement, getSelectionAncestorDOM } from '@atlaskit/editor-common/experiences';
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
8
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
10
9
|
import { syncedBlockPluginKey } from './main';
|
|
@@ -12,7 +11,6 @@ var TIMEOUT_DURATION = 30000;
|
|
|
12
11
|
var pluginKey = new PluginKey('syncedBlockMenuAndToolbarExperience');
|
|
13
12
|
var SYNCED_BLOCK_BUTTON_TEST_IDS = Object.values(SYNCED_BLOCK_BUTTON_TEST_ID);
|
|
14
13
|
var syncedBlockButtonIds = new Set(SYNCED_BLOCK_BUTTON_TEST_IDS);
|
|
15
|
-
var targetEl;
|
|
16
14
|
export var getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperiencesPlugin(_ref) {
|
|
17
15
|
var refs = _ref.refs,
|
|
18
16
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
@@ -139,7 +137,7 @@ export var getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperi
|
|
|
139
137
|
if (!typeaheadPopup || !(typeaheadPopup instanceof HTMLElement)) {
|
|
140
138
|
return;
|
|
141
139
|
}
|
|
142
|
-
var targetElement =
|
|
140
|
+
var targetElement = typeaheadPopup.querySelector('[role="option"][aria-selected="true"]');
|
|
143
141
|
if (!targetElement || !(targetElement instanceof HTMLElement)) {
|
|
144
142
|
return;
|
|
145
143
|
}
|
|
@@ -296,16 +294,6 @@ var handleButtonClick = function handleButtonClick(_ref2) {
|
|
|
296
294
|
var isEnterKey = function isEnterKey(key) {
|
|
297
295
|
return key === 'Enter';
|
|
298
296
|
};
|
|
299
|
-
var getTarget = function getTarget(containerElement) {
|
|
300
|
-
if (!targetEl) {
|
|
301
|
-
var element = containerElement === null || containerElement === void 0 ? void 0 : containerElement.querySelector('.ProseMirror');
|
|
302
|
-
if (!element || !(element instanceof HTMLElement)) {
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
targetEl = element;
|
|
306
|
-
}
|
|
307
|
-
return targetEl;
|
|
308
|
-
};
|
|
309
297
|
var syncedBlockAddedToDomCheck = function syncedBlockAddedToDomCheck(refs, editorViewRef) {
|
|
310
298
|
return new ExperienceCheckDomMutation({
|
|
311
299
|
onDomMutation: function onDomMutation(_ref3) {
|
|
@@ -320,17 +308,20 @@ var syncedBlockAddedToDomCheck = function syncedBlockAddedToDomCheck(refs, edito
|
|
|
320
308
|
observeConfig: function observeConfig() {
|
|
321
309
|
var _editorViewRef$curren2;
|
|
322
310
|
return [{
|
|
323
|
-
target:
|
|
311
|
+
target: editorViewRef === null || editorViewRef === void 0 || (_editorViewRef$curren2 = editorViewRef.current) === null || _editorViewRef$curren2 === void 0 ? void 0 : _editorViewRef$curren2.dom,
|
|
324
312
|
options: {
|
|
325
313
|
childList: true
|
|
326
314
|
}
|
|
327
|
-
}
|
|
315
|
+
},
|
|
316
|
+
// When wrapping a node with breakout mark with sync block, breakout dom is reused
|
|
317
|
+
// hence we need to observe subtree to catch sync block mutation
|
|
318
|
+
{
|
|
328
319
|
target: getSelectionAncestorDOM(editorViewRef === null || editorViewRef === void 0 ? void 0 : editorViewRef.current),
|
|
329
320
|
options: {
|
|
330
321
|
childList: true,
|
|
331
322
|
subtree: true
|
|
332
323
|
}
|
|
333
|
-
}]
|
|
324
|
+
}];
|
|
334
325
|
}
|
|
335
326
|
});
|
|
336
327
|
};
|
|
@@ -356,17 +347,17 @@ var referenceSyncBlockRemovedFromDomCheck = function referenceSyncBlockRemovedFr
|
|
|
356
347
|
observeConfig: function observeConfig() {
|
|
357
348
|
var _editorViewRef$curren3;
|
|
358
349
|
return [{
|
|
359
|
-
target:
|
|
350
|
+
target: editorViewRef === null || editorViewRef === void 0 || (_editorViewRef$curren3 = editorViewRef.current) === null || _editorViewRef$curren3 === void 0 ? void 0 : _editorViewRef$curren3.dom,
|
|
360
351
|
options: {
|
|
361
352
|
childList: true
|
|
362
353
|
}
|
|
363
|
-
}
|
|
354
|
+
}, {
|
|
364
355
|
target: getSelectionAncestorDOM(editorViewRef === null || editorViewRef === void 0 ? void 0 : editorViewRef.current),
|
|
365
356
|
options: {
|
|
366
357
|
childList: true,
|
|
367
358
|
subtree: true
|
|
368
359
|
}
|
|
369
|
-
}]
|
|
360
|
+
}];
|
|
370
361
|
}
|
|
371
362
|
});
|
|
372
363
|
};
|
|
@@ -2,8 +2,6 @@ import { expandSelectionToBlockRange } from '@atlaskit/editor-common/selection';
|
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
6
|
* Defers a callback to the next microtask (when gated) or next macrotask via setTimeout(0).
|
|
9
7
|
* Used to avoid re-entrant ProseMirror dispatch cycles.
|
|
@@ -97,9 +95,7 @@ var _fragmentContainsExtension = function fragmentContainsExtension(fragment) {
|
|
|
97
95
|
if (found) {
|
|
98
96
|
return;
|
|
99
97
|
}
|
|
100
|
-
if (
|
|
101
|
-
exposure: true
|
|
102
|
-
}) ? EXTENSION_NODES.has(node.type.name) : node.type.name === 'inlineExtension') {
|
|
98
|
+
if (EXTENSION_NODES.has(node.type.name)) {
|
|
103
99
|
found = true;
|
|
104
100
|
} else if (node.content.size) {
|
|
105
101
|
if (_fragmentContainsExtension(node.content)) {
|
|
@@ -160,17 +156,13 @@ export var wasExtensionInsertedInBodiedSyncBlock = function wasExtensionInserted
|
|
|
160
156
|
if (resourceId !== undefined) {
|
|
161
157
|
return false;
|
|
162
158
|
}
|
|
163
|
-
if (
|
|
164
|
-
exposure: true
|
|
165
|
-
}) ? EXTENSION_NODES.has(node.type.name) : node.type.name === 'inlineExtension') {
|
|
159
|
+
if (EXTENSION_NODES.has(node.type.name)) {
|
|
166
160
|
var _$pos = tr.doc.resolve(pos);
|
|
167
161
|
var _parent = findParentNodeOfTypeClosestToPos(_$pos, bodiedSyncBlock);
|
|
168
162
|
if (_parent !== null && _parent !== void 0 && _parent.node.attrs.resourceId) {
|
|
169
163
|
var mappedPos = tr.mapping.invert().map(pos);
|
|
170
164
|
var nodeBefore = state.doc.nodeAt(mappedPos);
|
|
171
|
-
if (!nodeBefore || (
|
|
172
|
-
exposure: true
|
|
173
|
-
}) ? EXTENSION_NODES.has(nodeBefore.type.name) : nodeBefore.type.name !== 'inlineExtension')) {
|
|
165
|
+
if (!nodeBefore || EXTENSION_NODES.has(nodeBefore.type.name)) {
|
|
174
166
|
resourceId = _parent.node.attrs.resourceId;
|
|
175
167
|
return false;
|
|
176
168
|
}
|
|
@@ -4,10 +4,8 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
5
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
6
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
7
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { flushBodiedSyncBlocks as _flushBodiedSyncBlocks, flushSyncBlocks, discardUnpublishedSyncBlocks as _discardUnpublishedSyncBlocks } from './editor-actions';
|
|
9
8
|
import { copySyncedBlockReferenceToClipboardEditorCommand, createSyncedBlock } from './editor-commands';
|
|
10
|
-
import { bodiedSyncBlockNodeWithToDOMFixed } from './nodeviews/bodiedSyncBlockNodeWithToDOMFixed';
|
|
11
9
|
import { createPlugin, syncedBlockPluginKey } from './pm-plugins/main';
|
|
12
10
|
import { getMenuAndToolbarExperiencesPlugin } from './pm-plugins/menu-and-toolbar-experiences';
|
|
13
11
|
import { getBlockMenuComponents } from './ui/block-menu-components';
|
|
@@ -76,11 +74,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref2) {
|
|
|
76
74
|
node: syncBlock
|
|
77
75
|
}, {
|
|
78
76
|
name: 'bodiedSyncBlock',
|
|
79
|
-
node:
|
|
80
|
-
exposure: true
|
|
81
|
-
}) ?
|
|
82
|
-
// delete bodiedSyncBlockNodeWithToDOMFixed when cleaning up platform_synced_block_patch_6
|
|
83
|
-
bodiedSyncBlockNodeWithToDOMFixed() : bodiedSyncBlock
|
|
77
|
+
node: bodiedSyncBlock
|
|
84
78
|
}];
|
|
85
79
|
},
|
|
86
80
|
pmPlugins: function pmPlugins() {
|
|
@@ -9,8 +9,14 @@ import Lozenge from '@atlaskit/lozenge';
|
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { canBeConvertedToSyncBlock } from '../pm-plugins/utils/utils';
|
|
11
11
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var SyncedBlockNewLozenge = function SyncedBlockNewLozenge(_ref) {
|
|
13
|
+
var label = _ref.label;
|
|
14
|
+
return /*#__PURE__*/React.createElement(Lozenge, {
|
|
15
|
+
appearance: fg('confluence_fronend_labels_categorization_migration') ? 'discovery' : 'new'
|
|
16
|
+
}, label);
|
|
17
|
+
};
|
|
18
|
+
var CreateSyncedBlockDropdownItem = function CreateSyncedBlockDropdownItem(_ref2) {
|
|
19
|
+
var api = _ref2.api;
|
|
14
20
|
var _useIntl = useIntl(),
|
|
15
21
|
formatMessage = _useIntl.formatMessage;
|
|
16
22
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection', 'blockControls', 'connectivity'], function (states) {
|
|
@@ -39,6 +45,9 @@ var CreateSyncedBlockDropdownItem = function CreateSyncedBlockDropdownItem(_ref)
|
|
|
39
45
|
}));
|
|
40
46
|
};
|
|
41
47
|
var isOffline = isOfflineMode(mode);
|
|
48
|
+
var lozenge = /*#__PURE__*/React.createElement(SyncedBlockNewLozenge, {
|
|
49
|
+
label: formatMessage(blockMenuMessages.newLozenge)
|
|
50
|
+
});
|
|
42
51
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
43
52
|
elemBefore: /*#__PURE__*/React.createElement(SyncBlocksIcon, {
|
|
44
53
|
label: "",
|
|
@@ -47,13 +56,12 @@ var CreateSyncedBlockDropdownItem = function CreateSyncedBlockDropdownItem(_ref)
|
|
|
47
56
|
onClick: onClick,
|
|
48
57
|
isDisabled: isOffline,
|
|
49
58
|
testId: SYNCED_BLOCK_BUTTON_TEST_ID.blockMenuCreate,
|
|
50
|
-
elemAfter:
|
|
51
|
-
|
|
52
|
-
}, formatMessage(blockMenuMessages.newLozenge))
|
|
59
|
+
elemAfter: fg('platform_synced_block_patch_12') ? undefined : lozenge,
|
|
60
|
+
elemAfterText: fg('platform_synced_block_patch_12') ? lozenge : undefined
|
|
53
61
|
}, formatMessage(blockMenuMessages.syncBlock));
|
|
54
62
|
};
|
|
55
|
-
var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(
|
|
56
|
-
var api =
|
|
63
|
+
var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(_ref3) {
|
|
64
|
+
var api = _ref3.api;
|
|
57
65
|
var _useIntl2 = useIntl(),
|
|
58
66
|
formatMessage = _useIntl2.formatMessage;
|
|
59
67
|
var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['connectivity'], function (states) {
|
|
@@ -70,6 +78,9 @@ var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(_ref2) {
|
|
|
70
78
|
closeMenu: true
|
|
71
79
|
}));
|
|
72
80
|
};
|
|
81
|
+
var lozenge = /*#__PURE__*/React.createElement(SyncedBlockNewLozenge, {
|
|
82
|
+
label: formatMessage(blockMenuMessages.newLozenge)
|
|
83
|
+
});
|
|
73
84
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
74
85
|
elemBefore: /*#__PURE__*/React.createElement(SyncBlocksIcon, {
|
|
75
86
|
label: "",
|
|
@@ -77,14 +88,13 @@ var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(_ref2) {
|
|
|
77
88
|
}),
|
|
78
89
|
onClick: onClick,
|
|
79
90
|
isDisabled: isOfflineMode(mode),
|
|
80
|
-
elemAfter:
|
|
81
|
-
|
|
82
|
-
}, formatMessage(blockMenuMessages.newLozenge))
|
|
91
|
+
elemAfter: fg('platform_synced_block_patch_12') ? undefined : lozenge,
|
|
92
|
+
elemAfterText: fg('platform_synced_block_patch_12') ? lozenge : undefined
|
|
83
93
|
}, formatMessage(blockMenuMessages.copySyncedBlock));
|
|
84
94
|
};
|
|
85
|
-
export var CreateOrCopySyncedBlockDropdownItem = function CreateOrCopySyncedBlockDropdownItem(
|
|
86
|
-
var api =
|
|
87
|
-
enableSourceSyncedBlockCreation =
|
|
95
|
+
export var CreateOrCopySyncedBlockDropdownItem = function CreateOrCopySyncedBlockDropdownItem(_ref4) {
|
|
96
|
+
var api = _ref4.api,
|
|
97
|
+
enableSourceSyncedBlockCreation = _ref4.enableSourceSyncedBlockCreation;
|
|
88
98
|
var _useSharedPluginState3 = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
89
99
|
var _states$blockControls3, _states$blockControls4;
|
|
90
100
|
return {
|
|
@@ -14,33 +14,9 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
14
14
|
import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
16
16
|
import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
17
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
17
|
import { Text, Box } from '@atlaskit/primitives/compiled';
|
|
19
18
|
import Spinner from '@atlaskit/spinner';
|
|
20
19
|
import { syncedBlockPluginKey } from '../pm-plugins/main';
|
|
21
|
-
var modalContentMapOld = {
|
|
22
|
-
'source-block-deleted': {
|
|
23
|
-
titleMultiple: messages.deleteConfirmationModalTitleMultiple,
|
|
24
|
-
titleSingle: messages.deletionConfirmationModalTitleSingle,
|
|
25
|
-
descriptionSingle: messages.deletionConfirmationModalDescriptionNoRef,
|
|
26
|
-
descriptionMultiple: messages.deletionConfirmationModalDescription,
|
|
27
|
-
confirmButtonLabel: messages.deleteConfirmationModalDeleteButton
|
|
28
|
-
},
|
|
29
|
-
'source-block-unpublished': {
|
|
30
|
-
titleMultiple: messages.deleteConfirmationModalTitleMultiple,
|
|
31
|
-
titleSingle: messages.deletionConfirmationModalTitleSingle,
|
|
32
|
-
descriptionSingle: messages.deletionConfirmationModalDescriptionNoRef,
|
|
33
|
-
descriptionMultiple: messages.deletionConfirmationModalDescription,
|
|
34
|
-
confirmButtonLabel: messages.deleteConfirmationModalDeleteButton
|
|
35
|
-
},
|
|
36
|
-
'source-block-unsynced': {
|
|
37
|
-
titleMultiple: messages.unsyncConfirmationModalTitle,
|
|
38
|
-
titleSingle: messages.unsyncConfirmationModalTitle,
|
|
39
|
-
descriptionSingle: messages.unsyncConfirmModalDescriptionSingle,
|
|
40
|
-
descriptionMultiple: messages.unsyncConfirmModalDescriptionMultiple,
|
|
41
|
-
confirmButtonLabel: messages.deleteConfirmationModalUnsyncButton
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
20
|
var modalContentMap = {
|
|
45
21
|
'source-block-deleted': {
|
|
46
22
|
titleMultiple: messages.deleteConfirmationModalTitleMultiple,
|
|
@@ -102,10 +78,9 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
102
78
|
formatMessage = _useIntl.formatMessage;
|
|
103
79
|
var resolverRef = React.useRef(undefined);
|
|
104
80
|
|
|
105
|
-
// When
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
// close the modal (which was never open).
|
|
81
|
+
// When a source block with no references is deleted, the modal is never shown but
|
|
82
|
+
// onDeleteCompleted still sets bodiedSyncBlockDeletionStatus to 'completed'. This ref signals
|
|
83
|
+
// the useEffect to silently reset the status without trying to close the modal (which was never open).
|
|
109
84
|
var skipModalOnCompletedRef = React.useRef(false);
|
|
110
85
|
var handleClick = useCallback(function (confirm) {
|
|
111
86
|
return function () {
|
|
@@ -197,24 +172,20 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
197
172
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
198
173
|
while (1) switch (_context3.prev = _context3.next) {
|
|
199
174
|
case 0:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
_context3.prev = 1;
|
|
205
|
-
_context3.next = 4;
|
|
175
|
+
_context3.prev = 0;
|
|
176
|
+
_context3.next = 3;
|
|
206
177
|
return fetchReferenceCountRef.current(syncBlockIds);
|
|
207
|
-
case
|
|
178
|
+
case 3:
|
|
208
179
|
count = _context3.sent;
|
|
209
|
-
_context3.next =
|
|
180
|
+
_context3.next = 9;
|
|
210
181
|
break;
|
|
211
|
-
case
|
|
212
|
-
_context3.prev =
|
|
213
|
-
_context3.t0 = _context3["catch"](
|
|
182
|
+
case 6:
|
|
183
|
+
_context3.prev = 6;
|
|
184
|
+
_context3.t0 = _context3["catch"](0);
|
|
214
185
|
count = 1;
|
|
215
|
-
case
|
|
186
|
+
case 9:
|
|
216
187
|
if (!(count === 0)) {
|
|
217
|
-
_context3.next =
|
|
188
|
+
_context3.next = 13;
|
|
218
189
|
break;
|
|
219
190
|
}
|
|
220
191
|
// No references — auto-confirm without showing the modal.
|
|
@@ -231,9 +202,8 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
231
202
|
} : {}));
|
|
232
203
|
});
|
|
233
204
|
return _context3.abrupt("return", true);
|
|
234
|
-
case
|
|
205
|
+
case 13:
|
|
235
206
|
setReferenceCount(count);
|
|
236
|
-
case 15:
|
|
237
207
|
setIsOpen(true);
|
|
238
208
|
setSyncBlockIds(syncBlockIds);
|
|
239
209
|
if (deleteReason) {
|
|
@@ -252,11 +222,11 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
252
222
|
});
|
|
253
223
|
}
|
|
254
224
|
return _context3.abrupt("return", confirmedPromise);
|
|
255
|
-
case
|
|
225
|
+
case 20:
|
|
256
226
|
case "end":
|
|
257
227
|
return _context3.stop();
|
|
258
228
|
}
|
|
259
|
-
}, _callee3, null, [[
|
|
229
|
+
}, _callee3, null, [[0, 6]]);
|
|
260
230
|
}));
|
|
261
231
|
return function (_x3, _x4) {
|
|
262
232
|
return _ref5.apply(this, arguments);
|
|
@@ -273,7 +243,7 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
273
243
|
};
|
|
274
244
|
}, [syncBlockStoreManager, confirmationCallback]);
|
|
275
245
|
useEffect(function () {
|
|
276
|
-
if (skipModalOnCompletedRef.current
|
|
246
|
+
if (skipModalOnCompletedRef.current) {
|
|
277
247
|
if (bodiedSyncBlockDeletionStatus === 'completed') {
|
|
278
248
|
var _api$core6;
|
|
279
249
|
// Deletion was auto-confirmed without showing the modal (no references).
|
|
@@ -308,44 +278,10 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
308
278
|
});
|
|
309
279
|
}
|
|
310
280
|
}, [api === null || api === void 0 || (_api$core8 = api.core) === null || _api$core8 === void 0 ? void 0 : _api$core8.actions, bodiedSyncBlockDeletionStatus, isOpen]);
|
|
311
|
-
useEffect(function () {
|
|
312
|
-
// When the flag is off, fetch references after the modal opens (original behaviour).
|
|
313
|
-
// When the flag is on, references are fetched and set before the modal opens in
|
|
314
|
-
// confirmationCallback, so this useEffect is skipped to avoid a duplicate fetch.
|
|
315
|
-
if (isOpen && syncBlockIds !== undefined && !fg('platform_synced_block_patch_9')) {
|
|
316
|
-
var fetchReferences = /*#__PURE__*/function () {
|
|
317
|
-
var _ref0 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
318
|
-
var totalCount;
|
|
319
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
320
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
321
|
-
case 0:
|
|
322
|
-
_context4.prev = 0;
|
|
323
|
-
_context4.next = 3;
|
|
324
|
-
return fetchReferenceCountRef.current(syncBlockIds);
|
|
325
|
-
case 3:
|
|
326
|
-
totalCount = _context4.sent;
|
|
327
|
-
setReferenceCount(totalCount);
|
|
328
|
-
_context4.next = 10;
|
|
329
|
-
break;
|
|
330
|
-
case 7:
|
|
331
|
-
_context4.prev = 7;
|
|
332
|
-
_context4.t0 = _context4["catch"](0);
|
|
333
|
-
setReferenceCount(0);
|
|
334
|
-
case 10:
|
|
335
|
-
case "end":
|
|
336
|
-
return _context4.stop();
|
|
337
|
-
}
|
|
338
|
-
}, _callee4, null, [[0, 7]]);
|
|
339
|
-
}));
|
|
340
|
-
return function fetchReferences() {
|
|
341
|
-
return _ref0.apply(this, arguments);
|
|
342
|
-
};
|
|
343
|
-
}();
|
|
344
281
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}, [isOpen, syncBlockIds]);
|
|
282
|
+
// References are fetched and set before the modal opens in
|
|
283
|
+
// confirmationCallback, so no additional fetch is needed here.
|
|
284
|
+
|
|
349
285
|
return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(ModalDialog, {
|
|
350
286
|
onClose: handleClick(false),
|
|
351
287
|
testId: "sync-block-delete-confirmation",
|
|
@@ -355,7 +291,7 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
355
291
|
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
356
292
|
size: "large"
|
|
357
293
|
})) : /*#__PURE__*/React.createElement(ModalContent, {
|
|
358
|
-
content:
|
|
294
|
+
content: modalContentMap[deleteReason],
|
|
359
295
|
referenceCount: referenceCount,
|
|
360
296
|
handleClick: handleClick,
|
|
361
297
|
formatMessage: formatMessage,
|
|
@@ -365,15 +301,15 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
|
|
|
365
301
|
sourceCount: (syncBlockIds === null || syncBlockIds === void 0 ? void 0 : syncBlockIds.length) || 0
|
|
366
302
|
}))));
|
|
367
303
|
};
|
|
368
|
-
var ModalContent = function ModalContent(
|
|
369
|
-
var content =
|
|
370
|
-
referenceCount =
|
|
371
|
-
handleClick =
|
|
372
|
-
formatMessage =
|
|
373
|
-
isDeleting =
|
|
374
|
-
isDisabled =
|
|
375
|
-
deleteReason =
|
|
376
|
-
sourceCount =
|
|
304
|
+
var ModalContent = function ModalContent(_ref0) {
|
|
305
|
+
var content = _ref0.content,
|
|
306
|
+
referenceCount = _ref0.referenceCount,
|
|
307
|
+
handleClick = _ref0.handleClick,
|
|
308
|
+
formatMessage = _ref0.formatMessage,
|
|
309
|
+
isDeleting = _ref0.isDeleting,
|
|
310
|
+
isDisabled = _ref0.isDisabled,
|
|
311
|
+
deleteReason = _ref0.deleteReason,
|
|
312
|
+
sourceCount = _ref0.sourceCount;
|
|
377
313
|
var titleMultiple = content.titleMultiple,
|
|
378
314
|
titleSingle = content.titleSingle,
|
|
379
315
|
descriptionSingle = content.descriptionSingle,
|
|
@@ -5,7 +5,6 @@ import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages'
|
|
|
5
5
|
import { SyncBlockLabelSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
6
6
|
import BlockSyncedIcon from '@atlaskit/icon-lab/core/block-synced';
|
|
7
7
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
8
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
10
9
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
11
10
|
import { formatElapsedTime } from './utils/time';
|
|
@@ -71,9 +70,7 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
71
70
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
72
71
|
,
|
|
73
72
|
className: SyncBlockLabelSharedCssClassName.labelClassName,
|
|
74
|
-
"aria-describedby":
|
|
75
|
-
exposure: true
|
|
76
|
-
}) ? undefined : ariaDescribedById
|
|
73
|
+
"aria-describedby": isSource || isUnsyncedBlock ? undefined : ariaDescribedById
|
|
77
74
|
}, /*#__PURE__*/React.createElement(BlockSyncedIcon, {
|
|
78
75
|
color: "var(--ds-icon-subtle, #505258)",
|
|
79
76
|
size: "small",
|
|
@@ -269,7 +269,7 @@ export var processReferenceData = function processReferenceData(referenceData, i
|
|
|
269
269
|
var references = _step.value;
|
|
270
270
|
if (references.length > 1) {
|
|
271
271
|
references.forEach(function (reference, index) {
|
|
272
|
-
return reference.title = "".concat(reference.title === '' && reference.hasAccess
|
|
272
|
+
return reference.title = "".concat(reference.title === '' && reference.hasAccess ? formatMessage(messages.syncedLocationDropdownUntitledPage) : reference.title, ": ").concat(formatMessage(messages.syncedLocationDropdownTitleBlockIndex, {
|
|
273
273
|
index: index + 1
|
|
274
274
|
}));
|
|
275
275
|
});
|
|
@@ -419,7 +419,7 @@ var DropdownContent = function DropdownContent(_ref7) {
|
|
|
419
419
|
count: "".concat(referenceData.length > 99 ? '99+' : referenceData.length)
|
|
420
420
|
})
|
|
421
421
|
}, referenceData.map(function (reference) {
|
|
422
|
-
var title = reference.title === '' && reference.hasAccess
|
|
422
|
+
var title = reference.title === '' && reference.hasAccess ? formatMessage(messages.syncedLocationDropdownUntitledPage) : reference.title || reference.url || '';
|
|
423
423
|
return /*#__PURE__*/React.createElement("div", {
|
|
424
424
|
key: reference.title,
|
|
425
425
|
className: ax(["_2ll012x7"])
|
|
@@ -12,7 +12,6 @@ import CopyIcon from '@atlaskit/icon/core/copy';
|
|
|
12
12
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
13
13
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
14
14
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock, unsync } from '../editor-commands';
|
|
17
16
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
18
17
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
@@ -78,7 +77,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
78
77
|
var _syncBlockInstance$da;
|
|
79
78
|
return /*#__PURE__*/React.createElement(Button, {
|
|
80
79
|
areAnyNewToolbarFlagsEnabled: true,
|
|
81
|
-
disabled:
|
|
80
|
+
disabled: (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'unpublished',
|
|
82
81
|
icon: /*#__PURE__*/React.createElement(LinkBrokenIcon, {
|
|
83
82
|
label: ""
|
|
84
83
|
}),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* quick-insert.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import "./quick-insert.compiled.css";
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -20,8 +19,8 @@ export var getQuickInsertConfig = function getQuickInsertConfig(config, api, syn
|
|
|
20
19
|
id: 'syncBlock',
|
|
21
20
|
title: formatMessage(blockTypeMessages.syncedBlock),
|
|
22
21
|
description: formatMessage(blockTypeMessages.syncedBlockDescription),
|
|
23
|
-
priority:
|
|
24
|
-
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block', 'auto', 'update', 'excerpt', 'connect'
|
|
22
|
+
priority: 400,
|
|
23
|
+
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block', 'auto', 'update', 'excerpt', 'connect', 'create'],
|
|
25
24
|
isDisabledOffline: true,
|
|
26
25
|
keyshortcut: '',
|
|
27
26
|
lozenge: /*#__PURE__*/React.createElement("span", {
|
|
@@ -31,15 +31,13 @@ export declare class BodiedSyncBlock implements NodeView {
|
|
|
31
31
|
getPos: getPosHandlerNode;
|
|
32
32
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
33
33
|
private api?;
|
|
34
|
-
private syncBlockStore?;
|
|
35
34
|
private cleanupConnectivityModeListener?;
|
|
36
35
|
private cleanupViewModeListener?;
|
|
37
36
|
private labelKey;
|
|
38
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI
|
|
37
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI);
|
|
39
38
|
private updateContentEditable;
|
|
40
39
|
private handleConnectivityModeChange;
|
|
41
40
|
private handleViewModeChange;
|
|
42
|
-
private get syncedBlockStore();
|
|
43
41
|
update(node: PMNode): boolean;
|
|
44
42
|
ignoreMutation(mutation: MutationRecord | {
|
|
45
43
|
target: Node;
|
|
@@ -31,15 +31,13 @@ export declare class BodiedSyncBlock implements NodeView {
|
|
|
31
31
|
getPos: getPosHandlerNode;
|
|
32
32
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
33
33
|
private api?;
|
|
34
|
-
private syncBlockStore?;
|
|
35
34
|
private cleanupConnectivityModeListener?;
|
|
36
35
|
private cleanupViewModeListener?;
|
|
37
36
|
private labelKey;
|
|
38
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI
|
|
37
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI);
|
|
39
38
|
private updateContentEditable;
|
|
40
39
|
private handleConnectivityModeChange;
|
|
41
40
|
private handleViewModeChange;
|
|
42
|
-
private get syncedBlockStore();
|
|
43
41
|
update(node: PMNode): boolean;
|
|
44
42
|
ignoreMutation(mutation: MutationRecord | {
|
|
45
43
|
target: Node;
|
package/docs/0-intro.tsx
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.4",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@atlaskit/dropdown-menu": "16.8.11",
|
|
34
34
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^10.0.0",
|
|
36
|
-
"@atlaskit/editor-plugin-block-menu": "^9.
|
|
37
|
-
"@atlaskit/editor-plugin-connectivity": "10.0
|
|
38
|
-
"@atlaskit/editor-plugin-content-format": "^4.
|
|
36
|
+
"@atlaskit/editor-plugin-block-menu": "^9.2.0",
|
|
37
|
+
"@atlaskit/editor-plugin-connectivity": "10.1.0",
|
|
38
|
+
"@atlaskit/editor-plugin-content-format": "^4.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^10.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-floating-toolbar": "^12.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-focus": "^9.1.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
55
55
|
"@atlaskit/primitives": "^19.0.0",
|
|
56
56
|
"@atlaskit/spinner": "19.1.2",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^80.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^80.3.0",
|
|
58
58
|
"@atlaskit/tokens": "13.0.4",
|
|
59
59
|
"@atlaskit/tooltip": "^22.2.0",
|
|
60
60
|
"@atlaskit/visually-hidden": "^3.1.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"date-fns": "^2.17.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@atlaskit/editor-common": "^114.
|
|
67
|
+
"@atlaskit/editor-common": "^114.32.0",
|
|
68
68
|
"react": "^18.2.0",
|
|
69
69
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
70
70
|
},
|
|
@@ -112,22 +112,10 @@
|
|
|
112
112
|
"confluence_fronend_labels_categorization_migration": {
|
|
113
113
|
"type": "boolean"
|
|
114
114
|
},
|
|
115
|
-
"
|
|
116
|
-
"type": "boolean"
|
|
117
|
-
},
|
|
118
|
-
"platform_synced_block_update_refactor": {
|
|
119
|
-
"type": "boolean"
|
|
120
|
-
},
|
|
121
|
-
"platform_synced_block_patch_8": {
|
|
122
|
-
"type": "boolean"
|
|
123
|
-
},
|
|
124
|
-
"platform_synced_block_patch_9": {
|
|
125
|
-
"type": "boolean"
|
|
126
|
-
},
|
|
127
|
-
"platform_synced_block_patch_10": {
|
|
115
|
+
"platform_synced_block_patch_11": {
|
|
128
116
|
"type": "boolean"
|
|
129
117
|
},
|
|
130
|
-
"
|
|
118
|
+
"platform_synced_block_patch_12": {
|
|
131
119
|
"type": "boolean"
|
|
132
120
|
}
|
|
133
121
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.bodiedSyncBlockNodeWithToDOMFixed = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
-
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
11
|
-
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; }
|
|
12
|
-
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; }
|
|
13
|
-
/**
|
|
14
|
-
* Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
|
|
15
|
-
* Adding correct classnames and structure to the toDOM, necessary for SSR rendering
|
|
16
|
-
*/
|
|
17
|
-
var bodiedSyncBlockNodeWithToDOMFixed = exports.bodiedSyncBlockNodeWithToDOMFixed = function bodiedSyncBlockNodeWithToDOMFixed() {
|
|
18
|
-
return _objectSpread(_objectSpread({}, _adfSchema.bodiedSyncBlock), {}, {
|
|
19
|
-
toDOM: function toDOM(node) {
|
|
20
|
-
var _node$attrs = node.attrs,
|
|
21
|
-
localId = _node$attrs.localId,
|
|
22
|
-
resourceId = _node$attrs.resourceId;
|
|
23
|
-
var outerAttrs = {
|
|
24
|
-
class: _syncBlock.BodiedSyncBlockSharedCssClassName.prefix,
|
|
25
|
-
'data-bodied-sync-block': '',
|
|
26
|
-
'data-local-id': localId,
|
|
27
|
-
'data-resource-id': resourceId
|
|
28
|
-
};
|
|
29
|
-
var innerAttrs = {
|
|
30
|
-
class: _syncBlock.BodiedSyncBlockSharedCssClassName.content
|
|
31
|
-
};
|
|
32
|
-
return ['div', outerAttrs, ['div', innerAttrs, 0]];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
};
|