@atlaskit/editor-plugin-synced-block 20.1.5 → 21.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 +14 -0
- package/dist/cjs/editor-commands/index.js +1 -4
- package/dist/cjs/pm-plugins/main.js +6 -11
- package/dist/cjs/syncedBlockPlugin.js +1 -2
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +1 -3
- package/dist/cjs/ui/Flag.js +1 -2
- package/dist/cjs/ui/SyncBlockLabel.js +2 -3
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +2 -7
- package/dist/cjs/ui/SyncedLocationDropdown.js +3 -22
- package/dist/cjs/ui/floating-toolbar.js +36 -82
- package/dist/cjs/ui/quick-insert.js +2 -4
- package/dist/es2019/editor-commands/index.js +1 -4
- package/dist/es2019/pm-plugins/main.js +6 -11
- package/dist/es2019/syncedBlockPlugin.js +1 -2
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +1 -3
- package/dist/es2019/ui/Flag.js +1 -2
- package/dist/es2019/ui/SyncBlockLabel.js +2 -3
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +2 -7
- package/dist/es2019/ui/SyncedLocationDropdown.js +3 -22
- package/dist/es2019/ui/floating-toolbar.js +36 -83
- package/dist/es2019/ui/quick-insert.js +2 -4
- package/dist/esm/editor-commands/index.js +1 -4
- package/dist/esm/pm-plugins/main.js +6 -11
- package/dist/esm/syncedBlockPlugin.js +1 -2
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +1 -3
- package/dist/esm/ui/Flag.js +1 -2
- package/dist/esm/ui/SyncBlockLabel.js +2 -3
- package/dist/esm/ui/SyncBlockRendererWrapper.js +2 -7
- package/dist/esm/ui/SyncedLocationDropdown.js +3 -22
- package/dist/esm/ui/floating-toolbar.js +37 -83
- package/dist/esm/ui/quick-insert.js +2 -4
- package/package.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 21.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 21.0.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`55e90d4321606`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55e90d4321606) -
|
|
14
|
+
Clean up experiment platform_editor_sync_block_activation.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 20.1.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -17,7 +17,6 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-synced-block-provider/utils");
|
|
18
18
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
19
19
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
20
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
21
20
|
var _main = require("../pm-plugins/main");
|
|
22
21
|
var _utils3 = require("../pm-plugins/utils/utils");
|
|
23
22
|
var _types = require("../types");
|
|
@@ -372,9 +371,7 @@ var removeSyncedBlockAtPos = exports.removeSyncedBlockAtPos = function removeSyn
|
|
|
372
371
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'syncBlock') {
|
|
373
372
|
var _node$nodeSize;
|
|
374
373
|
var removeTr = tr.replace(pos, pos + ((_node$nodeSize = node === null || node === void 0 ? void 0 : node.nodeSize) !== null && _node$nodeSize !== void 0 ? _node$nodeSize : 0));
|
|
375
|
-
|
|
376
|
-
removeTr.setMeta(_main.deleteMechanismMetaKey, 'deleteButton');
|
|
377
|
-
}
|
|
374
|
+
removeTr.setMeta(_main.deleteMechanismMetaKey, 'deleteButton');
|
|
378
375
|
return removeTr;
|
|
379
376
|
}
|
|
380
377
|
return tr;
|
|
@@ -25,7 +25,6 @@ var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
|
25
25
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
26
26
|
var _utils2 = require("@atlaskit/editor-synced-block-provider/utils");
|
|
27
27
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
28
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
29
28
|
var _bodiedSyncedBlock = require("../nodeviews/bodiedSyncedBlock");
|
|
30
29
|
var _syncedBlock = require("../nodeviews/syncedBlock");
|
|
31
30
|
var _types = require("../types");
|
|
@@ -175,13 +174,9 @@ var isHistoryMeta = function isHistoryMeta(meta) {
|
|
|
175
174
|
*/
|
|
176
175
|
var getDeleteMechanism = exports.getDeleteMechanism = function getDeleteMechanism(tr, state) {
|
|
177
176
|
var _selection$node, _selection$node2;
|
|
178
|
-
// Keep the legacy analytics classification unchanged while activation is off.
|
|
179
|
-
// The stricter history, structural-step, and reference-selection handling is
|
|
180
|
-
// only needed by the prompted feedback rollout.
|
|
181
|
-
var isSyncBlockActivationEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
182
177
|
var historyMeta = tr.getMeta(_utils.pmHistoryPluginKey);
|
|
183
178
|
if (historyMeta) {
|
|
184
|
-
if (
|
|
179
|
+
if (!isHistoryMeta(historyMeta)) {
|
|
185
180
|
return 'other';
|
|
186
181
|
}
|
|
187
182
|
return isHistoryMeta(historyMeta) && historyMeta.redo ? 'redo' : 'undo';
|
|
@@ -192,7 +187,7 @@ var getDeleteMechanism = exports.getDeleteMechanism = function getDeleteMechanis
|
|
|
192
187
|
if (tr.getMeta(deleteMechanismMetaKey) === 'deleteButton') {
|
|
193
188
|
return 'deleteButton';
|
|
194
189
|
}
|
|
195
|
-
var hasStructuralStep =
|
|
190
|
+
var hasStructuralStep = tr.steps.some(function (step) {
|
|
196
191
|
return step instanceof _transform.ReplaceAroundStep;
|
|
197
192
|
});
|
|
198
193
|
var hasReplaceStep = tr.steps.some(function (step) {
|
|
@@ -202,7 +197,7 @@ var getDeleteMechanism = exports.getDeleteMechanism = function getDeleteMechanis
|
|
|
202
197
|
return 'other';
|
|
203
198
|
}
|
|
204
199
|
var selection = state.selection;
|
|
205
|
-
var isNodeSelected = selection instanceof _state.NodeSelection && (((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type.name) === 'bodiedSyncBlock' ||
|
|
200
|
+
var isNodeSelected = selection instanceof _state.NodeSelection && (((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type.name) === 'bodiedSyncBlock' || ((_selection$node2 = selection.node) === null || _selection$node2 === void 0 ? void 0 : _selection$node2.type.name) === 'syncBlock');
|
|
206
201
|
return isNodeSelected ? 'selectionReplaced' : 'keyboardDelete';
|
|
207
202
|
};
|
|
208
203
|
var getPromptedFeedbackEntryPoint = exports.getPromptedFeedbackEntryPoint = function getPromptedFeedbackEntryPoint(mechanism) {
|
|
@@ -290,7 +285,7 @@ var filterTransactionOnline = function filterTransactionOnline(_ref3) {
|
|
|
290
285
|
var isCutRemoval = hasRemovedSyncBlock && ctx.consumeCutRemoval();
|
|
291
286
|
var canPromptForRemoval = Boolean(ctx.onGiveFeedback) && hasRemovedSyncBlock && !(0, _collab.isDirtyTransaction)(tr) && !isCutRemoval && !isPasteOrDrop;
|
|
292
287
|
var promptedFeedbackEntryPoint = canPromptForRemoval ? getPromptedFeedbackEntryPoint(getDeleteMechanism(tr, state)) : undefined;
|
|
293
|
-
var entryPoint = promptedFeedbackEntryPoint
|
|
288
|
+
var entryPoint = promptedFeedbackEntryPoint;
|
|
294
289
|
if (entryPoint && syncBlockRemoved.length > 0 && bodiedSyncBlockRemoved.length === 0) {
|
|
295
290
|
tr.setMeta(syncedBlockPromptedFeedbackMetaKey, {
|
|
296
291
|
context: {
|
|
@@ -965,7 +960,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
965
960
|
var isCopy = ctx.consumeCopyEvent();
|
|
966
961
|
var isCut = ctx.consumeCutEvent();
|
|
967
962
|
// A prompted feedback cut is always a cut, so the two never need combining.
|
|
968
|
-
var isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) && isCut)
|
|
963
|
+
var isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) && isCut);
|
|
969
964
|
if (!syncBlockStore || !isCopy && !isCut) {
|
|
970
965
|
return slice;
|
|
971
966
|
}
|
|
@@ -1122,7 +1117,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
1122
1117
|
var feedbackContext = tr.getMeta(syncedBlockPromptedFeedbackMetaKey);
|
|
1123
1118
|
return feedbackContext ? [feedbackContext] : [];
|
|
1124
1119
|
});
|
|
1125
|
-
if (feedbackContexts.length > 0
|
|
1120
|
+
if (feedbackContexts.length > 0) {
|
|
1126
1121
|
feedbackContexts.forEach(function (feedbackContext) {
|
|
1127
1122
|
ctx.handleAppliedFeedback(feedbackContext);
|
|
1128
1123
|
});
|
|
@@ -12,7 +12,6 @@ var _syncBlock = require("@atlaskit/adf-schema/sync-block");
|
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
14
14
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
15
|
var _editorActions = require("./editor-actions");
|
|
17
16
|
var _editorCommands = require("./editor-commands");
|
|
18
17
|
var _main = require("./pm-plugins/main");
|
|
@@ -170,7 +169,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
170
169
|
refs.containerElement = containerElement || undefined;
|
|
171
170
|
refs.popupsMountPoint = popupsMountPoint || undefined;
|
|
172
171
|
refs.wrapperElement = wrapperElement || undefined;
|
|
173
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
172
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_SourceSyncBlockPlaceholder.SourceSyncBlockPlaceholder, null), /*#__PURE__*/_react.default.createElement(LazySyncedBlockUI, {
|
|
174
173
|
syncBlockStore: syncBlockStore,
|
|
175
174
|
api: api,
|
|
176
175
|
editorView: editorView,
|
|
@@ -15,7 +15,6 @@ var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
|
15
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
16
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge/lozenge"));
|
|
17
17
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
18
|
var _utils = require("../pm-plugins/utils/utils");
|
|
20
19
|
var _types = require("../types");
|
|
21
20
|
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); }
|
|
@@ -121,7 +120,6 @@ var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(_ref4) {
|
|
|
121
120
|
var lozenge = /*#__PURE__*/_react.default.createElement(SyncedBlockNewLozenge, {
|
|
122
121
|
label: formatMessage(_messages.blockMenuMessages.newLozenge)
|
|
123
122
|
});
|
|
124
|
-
var copyLabel = (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true) ? _messages.syncBlockMessages.copyToSyncLabel : _messages.blockMenuMessages.copySyncedBlock;
|
|
125
123
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
126
124
|
elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.SyncBlocksIcon, {
|
|
127
125
|
label: "",
|
|
@@ -130,7 +128,7 @@ var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(_ref4) {
|
|
|
130
128
|
onClick: onClick,
|
|
131
129
|
isDisabled: (0, _editorPluginConnectivity.isOfflineMode)(mode),
|
|
132
130
|
elemAfterText: lozenge
|
|
133
|
-
}, formatMessage(
|
|
131
|
+
}, formatMessage(_messages.syncBlockMessages.copyToSyncLabel));
|
|
134
132
|
};
|
|
135
133
|
var CreateOrCopySyncedBlockDropdownItem = exports.CreateOrCopySyncedBlockDropdownItem = function CreateOrCopySyncedBlockDropdownItem(_ref5) {
|
|
136
134
|
var api = _ref5.api,
|
package/dist/cjs/ui/Flag.js
CHANGED
|
@@ -24,7 +24,6 @@ var _statusSuccess = _interopRequireDefault(require("@atlaskit/icon/core/status-
|
|
|
24
24
|
var _statusWarning = _interopRequireDefault(require("@atlaskit/icon/core/status-warning"));
|
|
25
25
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
26
26
|
var _anchor = require("@atlaskit/primitives/compiled/anchor");
|
|
27
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
28
27
|
var _main = require("../pm-plugins/main");
|
|
29
28
|
var _types = require("../types");
|
|
30
29
|
var _flagMap;
|
|
@@ -157,7 +156,7 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
157
156
|
var onRetry = activeFlag.onRetry,
|
|
158
157
|
onDismissedCallback = activeFlag.onDismissed;
|
|
159
158
|
var isCopiedFlag = activeFlag.id === _types.FLAG_ID.SYNC_BLOCK_COPIED;
|
|
160
|
-
var isCopiedDescriptionEnabled = isCopiedFlag && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_blocks_patch_11') || activeFlag.sourceProduct === 'confluence-page'
|
|
159
|
+
var isCopiedDescriptionEnabled = isCopiedFlag && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_blocks_patch_11') || activeFlag.sourceProduct === 'confluence-page');
|
|
161
160
|
var copiedDescription = getSyncBlockCopiedDescription(activeFlag, isCopiedDescriptionEnabled);
|
|
162
161
|
var title = isJiraUnpublishedPaste ? _messages.syncBlockMessages.unpublishedSyncBlockPastedTitleJiraWorkItem : defaultTitle;
|
|
163
162
|
var description = copiedDescription !== null && copiedDescription !== void 0 ? copiedDescription : isJiraUnpublishedPaste ? _messages.syncBlockMessages.unpublishedSyncBlockPastedDescriptionJiraWorkItem : defaultDescription;
|
|
@@ -16,7 +16,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
16
16
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
17
17
|
var _blockSynced = _interopRequireDefault(require("@atlaskit/icon-lab/core/block-synced"));
|
|
18
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
20
19
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
21
20
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/visually-hidden"));
|
|
22
21
|
var _time = require("./utils/time");
|
|
@@ -101,7 +100,7 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
101
100
|
return renderPlainLabel(formatMessage(_messages.syncBlockMessages.unsyncedBlockLabel));
|
|
102
101
|
}
|
|
103
102
|
if (isSource) {
|
|
104
|
-
return renderPlainLabel(formatMessage(
|
|
103
|
+
return renderPlainLabel(formatMessage(_messages.syncBlockMessages.sourceSyncedBlockLabel));
|
|
105
104
|
}
|
|
106
105
|
if (!title) {
|
|
107
106
|
return renderPlainLabel(formatMessage(_messages.syncBlockMessages.syncedBlockLabel));
|
|
@@ -124,7 +123,7 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
124
123
|
}), getLabelContent);
|
|
125
124
|
var referenceDescription = !isSource && !isUnsyncedBlock && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
|
|
126
125
|
id: ariaDescribedById
|
|
127
|
-
},
|
|
126
|
+
}, tooltipMessage);
|
|
128
127
|
if (unpublishedTooltipLabel) {
|
|
129
128
|
return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
130
129
|
position: "top",
|
|
@@ -12,7 +12,6 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
12
12
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
13
13
|
var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
|
|
14
14
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
15
|
var _getUnpublishedSourceType = require("./getUnpublishedSourceType");
|
|
17
16
|
var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
18
17
|
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); }
|
|
@@ -54,10 +53,6 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
54
53
|
}, [localSourceBlockInstanceId, syncBlockStore.sourceManager]);
|
|
55
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) === _editorSyncedBlockProvider.SyncBlockError.NotFound;
|
|
56
55
|
|
|
57
|
-
// Evaluated unconditionally so the experiment exposure is tracked correctly
|
|
58
|
-
// (recorded on every render, not lazily on first click).
|
|
59
|
-
var isSyncBlockActivationEnabled = (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
60
|
-
|
|
61
56
|
// Prevent editing in the contentEditable renderer wrapper. We set
|
|
62
57
|
// contentEditable="true" to enable text selection (creating an editable
|
|
63
58
|
// island inside ProseMirror's contentEditable="false" nodeview wrapper),
|
|
@@ -75,7 +70,7 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
75
70
|
var rendererRef = (0, _react.useRef)(null);
|
|
76
71
|
(0, _react.useEffect)(function () {
|
|
77
72
|
var containerEl = rendererRef.current;
|
|
78
|
-
if (!containerEl
|
|
73
|
+
if (!containerEl) {
|
|
79
74
|
return;
|
|
80
75
|
}
|
|
81
76
|
var unbind = (0, _bindEventListener.bind)(containerEl, {
|
|
@@ -95,7 +90,7 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
95
90
|
}
|
|
96
91
|
});
|
|
97
92
|
return unbind;
|
|
98
|
-
}, [
|
|
93
|
+
}, []);
|
|
99
94
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
100
95
|
ref: rendererRef,
|
|
101
96
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
@@ -41,8 +41,6 @@ var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge/lozenge"));
|
|
|
41
41
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
42
42
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
43
43
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner/spinner"));
|
|
44
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
45
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
46
44
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
47
45
|
var _types = require("../types");
|
|
48
46
|
var _SyncedLocationsEmptyStateIllustration = require("./assets/SyncedLocationsEmptyStateIllustration");
|
|
@@ -63,7 +61,6 @@ var styles = {
|
|
|
63
61
|
title: "_1reo15vq _18m915vq _syazazsu _1bto1l2s _o5721q9c",
|
|
64
62
|
note: "_syaz1rpy _o5721q9c",
|
|
65
63
|
lozenge: "_ahbq12x7 _1ul91wqb",
|
|
66
|
-
noResultsContainer: "_1bsbo8uj _y3gn1h6o",
|
|
67
64
|
activationDropdownContent: "_1rjcze3t _1bsb1kdj",
|
|
68
65
|
activationNoResultsContainer: "_vchhusvi _1bsb1kdj _ca0q1ejb _n3td1ejb",
|
|
69
66
|
activationNoResultsContent: "_195g1wug _1bsb12aa _y3gn1h6o",
|
|
@@ -833,10 +830,7 @@ var DropdownContentWithReferenceData = function DropdownContentWithReferenceData
|
|
|
833
830
|
}
|
|
834
831
|
};
|
|
835
832
|
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
836
|
-
xcss: (0, _react2.cx)(styles.dropdownContent,
|
|
837
|
-
// Read off the discriminant rather than the experiment, so the control cohort
|
|
838
|
-
// cannot reach this width and no second exposure is fired for a style.
|
|
839
|
-
locations.kind === 'field-aware' && styles.fieldAwareDropdownContent, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_sync_block_activation', 'isEnabled', true) && fetchStatus === 'success' && locationCount === 0 && styles.activationDropdownContent, shouldApplyMinHeight(fetchStatus, locationCount) && styles.containerWithMinHeight)
|
|
833
|
+
xcss: (0, _react2.cx)(styles.dropdownContent, locations.kind === 'field-aware' && styles.fieldAwareDropdownContent, fetchStatus === 'success' && locationCount === 0 && styles.activationDropdownContent, shouldApplyMinHeight(fetchStatus, locationCount) && styles.containerWithMinHeight)
|
|
840
834
|
}, content());
|
|
841
835
|
};
|
|
842
836
|
// The pre-experiment rows. This block is master's, moved into a component; remove with the experiment.
|
|
@@ -971,7 +965,7 @@ var ErrorScreen = function ErrorScreen(_ref18) {
|
|
|
971
965
|
};
|
|
972
966
|
var NoResultScreen = function NoResultScreen(_ref19) {
|
|
973
967
|
var formatMessage = _ref19.formatMessage;
|
|
974
|
-
return
|
|
968
|
+
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
975
969
|
xcss: styles.activationNoResultsContainer,
|
|
976
970
|
testId: "synced-locations-dropdown-content-no-results"
|
|
977
971
|
}, /*#__PURE__*/React.createElement(_compiled.Stack, {
|
|
@@ -987,18 +981,5 @@ var NoResultScreen = function NoResultScreen(_ref19) {
|
|
|
987
981
|
target: "_blank",
|
|
988
982
|
rel: "noopener noreferrer",
|
|
989
983
|
xcss: styles.learnMoreLink
|
|
990
|
-
}, formatMessage(_messages.syncBlockMessages.syncedLocationDropdownLearnMoreLink)))))
|
|
991
|
-
xcss: styles.noResultsContainer,
|
|
992
|
-
space: "space.100",
|
|
993
|
-
testId: "synced-locations-dropdown-content-no-results"
|
|
994
|
-
}, /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
995
|
-
as: "p"
|
|
996
|
-
}, formatMessage(_messages.syncBlockMessages.syncedLocationDropdownNoResults)), /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
997
|
-
as: "p"
|
|
998
|
-
}, /*#__PURE__*/React.createElement(_compiled.Anchor, {
|
|
999
|
-
href: _syncBlock.SYNCED_BLOCKS_DOCUMENTATION_URL,
|
|
1000
|
-
target: "_blank",
|
|
1001
|
-
rel: "noopener noreferrer",
|
|
1002
|
-
xcss: styles.learnMoreLink
|
|
1003
|
-
}, formatMessage(_messages.syncBlockMessages.syncedLocationDropdownLearnMoreLink))));
|
|
984
|
+
}, formatMessage(_messages.syncBlockMessages.syncedLocationDropdownLearnMoreLink)))));
|
|
1004
985
|
};
|
|
@@ -21,7 +21,6 @@ var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
|
21
21
|
var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
|
|
22
22
|
var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
|
|
23
23
|
var _megaphone = _interopRequireDefault(require("@atlaskit/icon/core/megaphone"));
|
|
24
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
24
|
var _editorCommands = require("../editor-commands");
|
|
26
25
|
var _utils2 = require("../pm-plugins/utils/utils");
|
|
27
26
|
var _types = require("../types");
|
|
@@ -38,7 +37,6 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
38
37
|
if (syncBlockStore.sourceManager.isPendingCreation(syncBlockObject.node.attrs.resourceId)) {
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
41
|
-
var isSyncBlockActivationEnabled = (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
42
40
|
var syncBlockInstance = syncBlockStore.referenceManager.getFromCache(syncBlockObject.node.attrs.resourceId);
|
|
43
41
|
var isUnsyncedBlock = (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.type) === _editorSyncedBlockProvider.SyncBlockError.NotFound;
|
|
44
42
|
var isErroredBlock = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error;
|
|
@@ -69,45 +67,24 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
69
67
|
}, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
|
|
70
68
|
items.push(deleteButton);
|
|
71
69
|
} else {
|
|
72
|
-
// When the synced block activation experiment is enabled, the copy action is
|
|
73
|
-
// re-framed as the primary "Copy to sync" action: it shows a visible label and
|
|
74
|
-
// is moved to the first toolbar position (before the synced-location info). See
|
|
75
|
-
// EDITOR-8060.
|
|
76
70
|
var copyButton = _objectSpread({
|
|
77
71
|
id: 'editor.syncedBlock.copy',
|
|
78
72
|
type: 'button',
|
|
79
73
|
appearance: 'subtle',
|
|
80
74
|
icon: _copy.default,
|
|
81
|
-
title:
|
|
82
|
-
showTitle:
|
|
83
|
-
|
|
84
|
-
testId: isSyncBlockActivationEnabled ? _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarCopy : undefined,
|
|
75
|
+
title: formatMessage(_messages.syncBlockMessages.copyToSyncLabel),
|
|
76
|
+
showTitle: true,
|
|
77
|
+
testId: _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarCopy,
|
|
85
78
|
onClick: (0, _editorCommands.copySyncedBlockReferenceToClipboard)(syncBlockStore, _analytics.INPUT_METHOD.SYNCED_BLOCK_TB, api, isLivePage)
|
|
86
79
|
}, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
|
|
87
|
-
|
|
88
|
-
// In the activation experience the primary "Copy to sync" action leads the
|
|
89
|
-
// toolbar, ahead of the informational synced-location dropdown.
|
|
90
|
-
if (isSyncBlockActivationEnabled) {
|
|
91
|
-
items.push(copyButton);
|
|
92
|
-
}
|
|
80
|
+
items.push(copyButton);
|
|
93
81
|
if (!isErroredBlock) {
|
|
94
82
|
var syncedLocation = {
|
|
95
83
|
type: 'custom',
|
|
96
84
|
fallback: [],
|
|
97
85
|
render: function render(_view, _idx, _dispatchAnalyticsEvent, floatingToolbarRenderContext) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
key: "".concat(resourceId, ":").concat(localId, ":").concat(isBodiedSyncBlock),
|
|
101
|
-
syncBlockStore: syncBlockStore,
|
|
102
|
-
resourceId: resourceId,
|
|
103
|
-
localId: localId,
|
|
104
|
-
intl: intl,
|
|
105
|
-
isSource: isBodiedSyncBlock,
|
|
106
|
-
api: api,
|
|
107
|
-
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return /*#__PURE__*/_react.default.createElement(_SyncedLocationDropdown.SyncedLocationDropdown, {
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_SyncedLocationDropdown.SyncedLocationDropdownWithCount, {
|
|
87
|
+
key: "".concat(resourceId, ":").concat(localId, ":").concat(isBodiedSyncBlock),
|
|
111
88
|
syncBlockStore: syncBlockStore,
|
|
112
89
|
resourceId: resourceId,
|
|
113
90
|
localId: localId,
|
|
@@ -141,12 +118,6 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
141
118
|
};
|
|
142
119
|
items.push(syncedLocation, unsyncButton);
|
|
143
120
|
}
|
|
144
|
-
|
|
145
|
-
// Outside the activation experience the copy button keeps its original
|
|
146
|
-
// (icon-only, secondary) position after the synced-location info.
|
|
147
|
-
if (!isSyncBlockActivationEnabled) {
|
|
148
|
-
items.push(copyButton);
|
|
149
|
-
}
|
|
150
121
|
var disabled = !syncBlockStore.referenceManager.getSyncBlockURL(syncBlockObject.node.attrs.resourceId);
|
|
151
122
|
if (!isBodiedSyncBlock) {
|
|
152
123
|
var editSourceButton = _objectSpread({
|
|
@@ -162,56 +133,39 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(stat
|
|
|
162
133
|
}, hoverDecorationProps(nodeType, _consts.akEditorSelectedNodeClassName));
|
|
163
134
|
items.push(editSourceButton);
|
|
164
135
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
136
|
+
|
|
137
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
138
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
139
|
+
var testId = isBodiedSyncBlock ? _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceOverflowTrigger : _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceOverflowTrigger;
|
|
140
|
+
var overflowMenuConfig = [{
|
|
141
|
+
type: 'overflow-dropdown',
|
|
142
|
+
testId: testId,
|
|
143
|
+
options: [].concat((0, _toConsumableArray2.default)(onGiveFeedback ? [{
|
|
144
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.feedbackDialog),
|
|
145
|
+
icon: /*#__PURE__*/_react.default.createElement(_megaphone.default, {
|
|
146
|
+
label: ""
|
|
147
|
+
}),
|
|
148
|
+
onClick: function onClick() {
|
|
149
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
150
|
+
var tr = _ref.tr;
|
|
151
|
+
return tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(syncBlockObject.pos + syncBlockObject.node.nodeSize), _selection.Side.RIGHT));
|
|
152
|
+
});
|
|
153
|
+
onGiveFeedback({
|
|
154
|
+
blockType: isBodiedSyncBlock ? 'source' : 'reference',
|
|
155
|
+
entryPoint: 'overflow-menu'
|
|
156
|
+
});
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
}] : []), [_objectSpread({
|
|
173
160
|
title: formatMessage(_messages.default.delete),
|
|
174
|
-
showTitle: false,
|
|
175
|
-
tooltipContent: formatMessage(_messages.default.delete),
|
|
176
161
|
onClick: (0, _editorCommands.removeSyncedBlock)(api),
|
|
177
|
-
icon: _delete.default,
|
|
162
|
+
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
163
|
+
label: ""
|
|
164
|
+
}),
|
|
178
165
|
testId: isBodiedSyncBlock ? _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
|
|
179
|
-
}, hoverDecorationProps(nodeType))
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
// testId is required to show focus on trigger button on ESC key press
|
|
183
|
-
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
184
|
-
var testId = isBodiedSyncBlock ? _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceOverflowTrigger : _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceOverflowTrigger;
|
|
185
|
-
var overflowMenuConfig = [{
|
|
186
|
-
type: 'overflow-dropdown',
|
|
187
|
-
testId: testId,
|
|
188
|
-
options: [].concat((0, _toConsumableArray2.default)(isSyncBlockActivationEnabled && onGiveFeedback ? [{
|
|
189
|
-
title: formatMessage(_messages.toolbarInsertBlockMessages.feedbackDialog),
|
|
190
|
-
icon: /*#__PURE__*/_react.default.createElement(_megaphone.default, {
|
|
191
|
-
label: ""
|
|
192
|
-
}),
|
|
193
|
-
onClick: function onClick() {
|
|
194
|
-
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
195
|
-
var tr = _ref.tr;
|
|
196
|
-
return tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(syncBlockObject.pos + syncBlockObject.node.nodeSize), _selection.Side.RIGHT));
|
|
197
|
-
});
|
|
198
|
-
onGiveFeedback({
|
|
199
|
-
blockType: isBodiedSyncBlock ? 'source' : 'reference',
|
|
200
|
-
entryPoint: 'overflow-menu'
|
|
201
|
-
});
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
}] : []), [_objectSpread({
|
|
205
|
-
title: formatMessage(_messages.default.delete),
|
|
206
|
-
onClick: (0, _editorCommands.removeSyncedBlock)(api),
|
|
207
|
-
icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
|
|
208
|
-
label: ""
|
|
209
|
-
}),
|
|
210
|
-
testId: isBodiedSyncBlock ? _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : _types.SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
|
|
211
|
-
}, hoverDecorationProps(nodeType))])
|
|
212
|
-
}];
|
|
213
|
-
items.push.apply(items, overflowMenuConfig);
|
|
214
|
-
}
|
|
166
|
+
}, hoverDecorationProps(nodeType))])
|
|
167
|
+
}];
|
|
168
|
+
items.push.apply(items, overflowMenuConfig);
|
|
215
169
|
}
|
|
216
170
|
var getDomRef = function getDomRef(editorView) {
|
|
217
171
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
@@ -15,7 +15,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
15
15
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
16
16
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge/lozenge"));
|
|
17
17
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
18
|
var _editorCommands = require("../editor-commands");
|
|
20
19
|
var _types = require("../types");
|
|
21
20
|
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); }
|
|
@@ -26,10 +25,9 @@ var getQuickInsertConfig = exports.getQuickInsertConfig = function getQuickInser
|
|
|
26
25
|
if (!(config !== null && config !== void 0 && config.enableSourceCreation)) {
|
|
27
26
|
return [];
|
|
28
27
|
}
|
|
29
|
-
var syncBlockTitle = (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true) ? _messages.blockTypeMessages.syncedBlockQuickInsertTitle : _messages.blockTypeMessages.syncBlock;
|
|
30
28
|
return [{
|
|
31
29
|
id: 'syncBlock',
|
|
32
|
-
title: formatMessage(
|
|
30
|
+
title: formatMessage(_messages.blockTypeMessages.syncedBlockQuickInsertTitle),
|
|
33
31
|
description: formatMessage(_messages.blockTypeMessages.syncedBlockDescription),
|
|
34
32
|
priority: 400,
|
|
35
33
|
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block', 'auto', 'update', 'excerpt', 'connect', 'create'],
|
|
@@ -42,7 +40,7 @@ var getQuickInsertConfig = exports.getQuickInsertConfig = function getQuickInser
|
|
|
42
40
|
}, formatMessage(_messages.blockTypeMessages.newLozenge))),
|
|
43
41
|
icon: function icon() {
|
|
44
42
|
return /*#__PURE__*/React.createElement(_quickInsert.IconSyncBlock, {
|
|
45
|
-
label: formatMessage(
|
|
43
|
+
label: formatMessage(_messages.blockTypeMessages.syncedBlockQuickInsertTitle)
|
|
46
44
|
});
|
|
47
45
|
},
|
|
48
46
|
action: function action(insert, state) {
|
|
@@ -8,7 +8,6 @@ import { findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode, saf
|
|
|
8
8
|
import { getSourceProductFromResourceIdSafe } from '@atlaskit/editor-synced-block-provider/utils';
|
|
9
9
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
11
|
import { creationMetaKey, deleteMechanismMetaKey, syncedBlockPluginKey } from '../pm-plugins/main';
|
|
13
12
|
import { canBeConvertedToSyncBlock, deferDispatch, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
14
13
|
import { FLAG_ID } from '../types';
|
|
@@ -369,9 +368,7 @@ export const removeSyncedBlockAtPos = (api, pos) => {
|
|
|
369
368
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'syncBlock') {
|
|
370
369
|
var _node$nodeSize;
|
|
371
370
|
const removeTr = tr.replace(pos, pos + ((_node$nodeSize = node === null || node === void 0 ? void 0 : node.nodeSize) !== null && _node$nodeSize !== void 0 ? _node$nodeSize : 0));
|
|
372
|
-
|
|
373
|
-
removeTr.setMeta(deleteMechanismMetaKey, 'deleteButton');
|
|
374
|
-
}
|
|
371
|
+
removeTr.setMeta(deleteMechanismMetaKey, 'deleteButton');
|
|
375
372
|
return removeTr;
|
|
376
373
|
}
|
|
377
374
|
return tr;
|
|
@@ -13,7 +13,6 @@ import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
13
13
|
import { convertPMNodesToSyncBlockNodes } from '@atlaskit/editor-synced-block-provider';
|
|
14
14
|
import { getSourceProductFromResourceIdSafe } from '@atlaskit/editor-synced-block-provider/utils';
|
|
15
15
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
16
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
17
16
|
import { bodiedSyncBlockNodeView } from '../nodeviews/bodiedSyncedBlock';
|
|
18
17
|
import { SyncBlock as SyncBlockView } from '../nodeviews/syncedBlock';
|
|
19
18
|
import { FLAG_ID } from '../types';
|
|
@@ -145,13 +144,9 @@ const isHistoryMeta = meta => typeof meta === 'object' && meta !== null && 'redo
|
|
|
145
144
|
*/
|
|
146
145
|
export const getDeleteMechanism = (tr, state) => {
|
|
147
146
|
var _selection$node, _selection$node2;
|
|
148
|
-
// Keep the legacy analytics classification unchanged while activation is off.
|
|
149
|
-
// The stricter history, structural-step, and reference-selection handling is
|
|
150
|
-
// only needed by the prompted feedback rollout.
|
|
151
|
-
const isSyncBlockActivationEnabled = expValEqualsNoExposure('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
152
147
|
const historyMeta = tr.getMeta(pmHistoryPluginKey);
|
|
153
148
|
if (historyMeta) {
|
|
154
|
-
if (
|
|
149
|
+
if (!isHistoryMeta(historyMeta)) {
|
|
155
150
|
return 'other';
|
|
156
151
|
}
|
|
157
152
|
return isHistoryMeta(historyMeta) && historyMeta.redo ? 'redo' : 'undo';
|
|
@@ -162,7 +157,7 @@ export const getDeleteMechanism = (tr, state) => {
|
|
|
162
157
|
if (tr.getMeta(deleteMechanismMetaKey) === 'deleteButton') {
|
|
163
158
|
return 'deleteButton';
|
|
164
159
|
}
|
|
165
|
-
const hasStructuralStep =
|
|
160
|
+
const hasStructuralStep = tr.steps.some(step => step instanceof ReplaceAroundStep);
|
|
166
161
|
const hasReplaceStep = tr.steps.some(step => step instanceof ReplaceStep);
|
|
167
162
|
if (hasStructuralStep || !hasReplaceStep) {
|
|
168
163
|
return 'other';
|
|
@@ -170,7 +165,7 @@ export const getDeleteMechanism = (tr, state) => {
|
|
|
170
165
|
const {
|
|
171
166
|
selection
|
|
172
167
|
} = state;
|
|
173
|
-
const isNodeSelected = selection instanceof NodeSelection && (((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type.name) === 'bodiedSyncBlock' ||
|
|
168
|
+
const isNodeSelected = selection instanceof NodeSelection && (((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type.name) === 'bodiedSyncBlock' || ((_selection$node2 = selection.node) === null || _selection$node2 === void 0 ? void 0 : _selection$node2.type.name) === 'syncBlock');
|
|
174
169
|
return isNodeSelected ? 'selectionReplaced' : 'keyboardDelete';
|
|
175
170
|
};
|
|
176
171
|
export const getPromptedFeedbackEntryPoint = mechanism => {
|
|
@@ -262,7 +257,7 @@ const filterTransactionOnline = ({
|
|
|
262
257
|
const isCutRemoval = hasRemovedSyncBlock && ctx.consumeCutRemoval();
|
|
263
258
|
const canPromptForRemoval = Boolean(ctx.onGiveFeedback) && hasRemovedSyncBlock && !isDirtyTransaction(tr) && !isCutRemoval && !isPasteOrDrop;
|
|
264
259
|
const promptedFeedbackEntryPoint = canPromptForRemoval ? getPromptedFeedbackEntryPoint(getDeleteMechanism(tr, state)) : undefined;
|
|
265
|
-
const entryPoint = promptedFeedbackEntryPoint
|
|
260
|
+
const entryPoint = promptedFeedbackEntryPoint;
|
|
266
261
|
if (entryPoint && syncBlockRemoved.length > 0 && bodiedSyncBlockRemoved.length === 0) {
|
|
267
262
|
tr.setMeta(syncedBlockPromptedFeedbackMetaKey, {
|
|
268
263
|
context: {
|
|
@@ -904,7 +899,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
904
899
|
const isCopy = ctx.consumeCopyEvent();
|
|
905
900
|
const isCut = ctx.consumeCutEvent();
|
|
906
901
|
// A prompted feedback cut is always a cut, so the two never need combining.
|
|
907
|
-
const isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) && isCut)
|
|
902
|
+
const isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) && isCut);
|
|
908
903
|
if (!syncBlockStore || !isCopy && !isCut) {
|
|
909
904
|
return slice;
|
|
910
905
|
}
|
|
@@ -1055,7 +1050,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
1055
1050
|
const feedbackContext = tr.getMeta(syncedBlockPromptedFeedbackMetaKey);
|
|
1056
1051
|
return feedbackContext ? [feedbackContext] : [];
|
|
1057
1052
|
});
|
|
1058
|
-
if (feedbackContexts.length > 0
|
|
1053
|
+
if (feedbackContexts.length > 0) {
|
|
1059
1054
|
feedbackContexts.forEach(feedbackContext => {
|
|
1060
1055
|
ctx.handleAppliedFeedback(feedbackContext);
|
|
1061
1056
|
});
|
|
@@ -4,7 +4,6 @@ import { syncBlock } from '@atlaskit/adf-schema/sync-block';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
6
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
import { flushBodiedSyncBlocks, flushSyncBlocks, discardUnpublishedSyncBlocks } from './editor-actions';
|
|
9
8
|
import { copySyncedBlockReferenceToClipboardEditorCommand, createSyncedBlock } from './editor-commands';
|
|
10
9
|
import { createPlugin, syncedBlockPluginKey } from './pm-plugins/main';
|
|
@@ -158,7 +157,7 @@ export const syncedBlockPlugin = ({
|
|
|
158
157
|
refs.containerElement = containerElement || undefined;
|
|
159
158
|
refs.popupsMountPoint = popupsMountPoint || undefined;
|
|
160
159
|
refs.wrapperElement = wrapperElement || undefined;
|
|
161
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
160
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SourceSyncBlockPlaceholder, null), /*#__PURE__*/React.createElement(LazySyncedBlockUI, {
|
|
162
161
|
syncBlockStore: syncBlockStore,
|
|
163
162
|
api: api,
|
|
164
163
|
editorView: editorView,
|
|
@@ -7,7 +7,6 @@ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
|
7
7
|
import { SyncBlocksIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
8
|
import Lozenge from '@atlaskit/lozenge/lozenge';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { canBeConvertedToSyncBlock } from '../pm-plugins/utils/utils';
|
|
12
11
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
13
12
|
const SyncedBlockNewLozenge = ({
|
|
@@ -116,7 +115,6 @@ const CopySyncedBlockDropdownItem = ({
|
|
|
116
115
|
const lozenge = /*#__PURE__*/React.createElement(SyncedBlockNewLozenge, {
|
|
117
116
|
label: formatMessage(blockMenuMessages.newLozenge)
|
|
118
117
|
});
|
|
119
|
-
const copyLabel = expValEquals('platform_editor_sync_block_activation', 'isEnabled', true) ? syncBlockMessages.copyToSyncLabel : blockMenuMessages.copySyncedBlock;
|
|
120
118
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
121
119
|
elemBefore: /*#__PURE__*/React.createElement(SyncBlocksIcon, {
|
|
122
120
|
label: "",
|
|
@@ -125,7 +123,7 @@ const CopySyncedBlockDropdownItem = ({
|
|
|
125
123
|
onClick: onClick,
|
|
126
124
|
isDisabled: isOfflineMode(mode),
|
|
127
125
|
elemAfterText: lozenge
|
|
128
|
-
}, formatMessage(
|
|
126
|
+
}, formatMessage(syncBlockMessages.copyToSyncLabel));
|
|
129
127
|
};
|
|
130
128
|
export const CreateOrCopySyncedBlockDropdownItem = ({
|
|
131
129
|
api,
|