@atlaskit/editor-plugin-synced-block 5.3.19 → 5.3.21

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.
@@ -4,7 +4,6 @@ import { copyDomNode, toDOM } from '@atlaskit/editor-common/copy-button';
4
4
  import { DOMSerializer, Fragment } from '@atlaskit/editor-prosemirror/model';
5
5
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { syncedBlockPluginKey } from '../pm-plugins/main';
9
8
  import { canBeConvertedToSyncBlock, findSyncBlock, findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
10
9
  import { FLAG_ID } from '../types';
@@ -35,12 +34,6 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
35
34
  });
36
35
  return false;
37
36
  }
38
-
39
- // Save the new node with empty content to backend
40
- // This is so that the node can be copied and referenced without the source being saved/published
41
- if (!fg('platform_synced_block_patch_1')) {
42
- syncBlockStore.sourceManager.createBodiedSyncBlockNode(attrs, function () {});
43
- }
44
37
  if (typeAheadInsert) {
45
38
  tr = typeAheadInsert(newBodiedSyncBlockNode);
46
39
  } else {
@@ -74,13 +67,6 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
74
67
  });
75
68
  return false;
76
69
  }
77
-
78
- // Save the new node with empty content to backend
79
- // This is so that the node can be copied and referenced without the source being saved/published
80
- if (!fg('platform_synced_block_patch_1')) {
81
- // Moved to appendTransaction
82
- syncBlockStore.sourceManager.createBodiedSyncBlockNode(_attrs, function () {}, _newBodiedSyncBlockNode);
83
- }
84
70
  tr.replaceWith(conversionInfo.from, conversionInfo.to, _newBodiedSyncBlockNode).scrollIntoView();
85
71
 
86
72
  // set selection to the start of the previous selection for the position taken up by the start of the new synced block
@@ -105,19 +91,17 @@ export var copySyncedBlockReferenceToClipboard = function copySyncedBlockReferen
105
91
  var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection, syncBlockStore, inputMethod, api) {
106
92
  var syncBlockFindResult = findSyncBlockOrBodiedSyncBlock(schema, selection);
107
93
  if (!syncBlockFindResult) {
108
- if (fg('platform_synced_block_patch_1')) {
109
- var _api$analytics;
110
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
111
- eventType: EVENT_TYPE.OPERATIONAL,
112
- action: ACTION.ERROR,
113
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
114
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
115
- attributes: {
116
- error: 'No sync block found in selection',
117
- inputMethod: inputMethod
118
- }
119
- });
120
- }
94
+ var _api$analytics;
95
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
96
+ eventType: EVENT_TYPE.OPERATIONAL,
97
+ action: ACTION.ERROR,
98
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
99
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
100
+ attributes: {
101
+ error: 'No sync block found in selection',
102
+ inputMethod: inputMethod
103
+ }
104
+ });
121
105
  return false;
122
106
  }
123
107
  var isBodiedSyncBlock = isBodiedSyncBlockNode(syncBlockFindResult.node, schema.nodes.bodiedSyncBlock);
@@ -130,39 +114,35 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
130
114
  resourceId: syncBlockStore.referenceManager.generateResourceIdForReference(syncBlockFindResult.node.attrs.resourceId)
131
115
  });
132
116
  if (!referenceSyncBlockNode) {
133
- if (fg('platform_synced_block_patch_1')) {
134
- var _api$analytics2;
135
- api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
136
- eventType: EVENT_TYPE.OPERATIONAL,
137
- action: ACTION.ERROR,
138
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
139
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
140
- attributes: {
141
- error: 'Failed to create reference sync block node',
142
- resourceId: syncBlockFindResult.node.attrs.resourceId,
143
- inputMethod: inputMethod
144
- }
145
- });
146
- }
147
- return false;
148
- }
149
- } else {
150
- referenceSyncBlockNode = syncBlockFindResult.node;
151
- }
152
- if (!referenceSyncBlockNode) {
153
- if (fg('platform_synced_block_patch_1')) {
154
- var _api$analytics3;
155
- api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || (_api$analytics3 = _api$analytics3.actions) === null || _api$analytics3 === void 0 || _api$analytics3.fireAnalyticsEvent({
117
+ var _api$analytics2;
118
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
156
119
  eventType: EVENT_TYPE.OPERATIONAL,
157
120
  action: ACTION.ERROR,
158
121
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
159
122
  actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
160
123
  attributes: {
161
- error: 'No reference sync block node available',
124
+ error: 'Failed to create reference sync block node',
125
+ resourceId: syncBlockFindResult.node.attrs.resourceId,
162
126
  inputMethod: inputMethod
163
127
  }
164
128
  });
129
+ return false;
165
130
  }
131
+ } else {
132
+ referenceSyncBlockNode = syncBlockFindResult.node;
133
+ }
134
+ if (!referenceSyncBlockNode) {
135
+ var _api$analytics3;
136
+ api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || (_api$analytics3 = _api$analytics3.actions) === null || _api$analytics3 === void 0 || _api$analytics3.fireAnalyticsEvent({
137
+ eventType: EVENT_TYPE.OPERATIONAL,
138
+ action: ACTION.ERROR,
139
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
140
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
141
+ attributes: {
142
+ error: 'No reference sync block node available',
143
+ inputMethod: inputMethod
144
+ }
145
+ });
166
146
  return false;
167
147
  }
168
148
  var domNode = toDOM(referenceSyncBlockNode, schema);
@@ -171,20 +151,18 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
171
151
  // Use setTimeout to dispatch transaction in next tick and avoid re-entrant dispatch
172
152
  setTimeout(function () {
173
153
  api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
154
+ var _api$analytics4;
174
155
  var tr = _ref3.tr;
175
- if (fg('platform_synced_block_patch_1')) {
176
- var _api$analytics4;
177
- api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || (_api$analytics4 = _api$analytics4.actions) === null || _api$analytics4 === void 0 || _api$analytics4.fireAnalyticsEvent({
178
- eventType: EVENT_TYPE.OPERATIONAL,
179
- action: ACTION.COPIED,
180
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
181
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
182
- attributes: {
183
- resourceId: referenceSyncBlockNode.attrs.resourceId,
184
- inputMethod: inputMethod
185
- }
186
- });
187
- }
156
+ api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || (_api$analytics4 = _api$analytics4.actions) === null || _api$analytics4 === void 0 || _api$analytics4.fireAnalyticsEvent({
157
+ eventType: EVENT_TYPE.OPERATIONAL,
158
+ action: ACTION.COPIED,
159
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
160
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
161
+ attributes: {
162
+ resourceId: referenceSyncBlockNode.attrs.resourceId,
163
+ inputMethod: inputMethod
164
+ }
165
+ });
188
166
  return tr.setMeta(syncedBlockPluginKey, {
189
167
  activeFlag: {
190
168
  id: FLAG_ID.SYNC_BLOCK_COPIED
@@ -204,18 +182,16 @@ export var editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore
204
182
  }
205
183
  var syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
206
184
  if (syncBlockURL) {
207
- if (fg('platform_synced_block_patch_1')) {
208
- var _api$analytics5;
209
- api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
210
- eventType: EVENT_TYPE.OPERATIONAL,
211
- action: ACTION.SYNCED_BLOCK_EDIT_SOURCE,
212
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
213
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
214
- attributes: {
215
- resourceId: resourceId
216
- }
217
- });
218
- }
185
+ var _api$analytics5;
186
+ api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
187
+ eventType: EVENT_TYPE.OPERATIONAL,
188
+ action: ACTION.SYNCED_BLOCK_EDIT_SOURCE,
189
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
190
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
191
+ attributes: {
192
+ resourceId: resourceId
193
+ }
194
+ });
219
195
  window.open(syncBlockURL, '_blank');
220
196
  } else {
221
197
  var _api$analytics6;
@@ -0,0 +1,28 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
3
+ 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) { _defineProperty(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; }
4
+ import { bodiedSyncBlock } from '@atlaskit/adf-schema';
5
+ import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
6
+ /**
7
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
8
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
9
+ */
10
+ export var bodiedSyncBlockNodeWithToDOMFixed = function bodiedSyncBlockNodeWithToDOMFixed() {
11
+ return _objectSpread(_objectSpread({}, bodiedSyncBlock), {}, {
12
+ toDOM: function toDOM(node) {
13
+ var _node$attrs = node.attrs,
14
+ localId = _node$attrs.localId,
15
+ resourceId = _node$attrs.resourceId;
16
+ var outerAttrs = {
17
+ class: BodiedSyncBlockSharedCssClassName.prefix,
18
+ 'data-bodied-sync-block': '',
19
+ 'data-local-id': localId,
20
+ 'data-resource-id': resourceId
21
+ };
22
+ var innerAttrs = {
23
+ class: BodiedSyncBlockSharedCssClassName.content
24
+ };
25
+ return ['div', outerAttrs, ['div', innerAttrs, 0]];
26
+ }
27
+ });
28
+ };
@@ -14,7 +14,6 @@ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
14
14
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
15
15
  import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
16
16
  import { convertPMNodesToSyncBlockNodes, rebaseTransaction } from '@atlaskit/editor-synced-block-provider';
17
- import { fg } from '@atlaskit/platform-feature-flags';
18
17
  import { lazyBodiedSyncBlockView } from '../nodeviews/bodiedLazySyncedBlock';
19
18
  import { SyncBlock as SyncBlockView } from '../nodeviews/syncedBlock';
20
19
  import { FLAG_ID } from '../types';
@@ -134,11 +133,8 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
134
133
  if (!tr.selection.eq(oldEditorState.selection)) {
135
134
  newDecorationSet = calculateDecorations(tr.doc, tr.selection, tr.doc.type.schema);
136
135
  }
137
- var newRetryCreationPosMap = retryCreationPosMap;
138
- if (fg('platform_synced_block_patch_1')) {
139
- var newPosEntry = meta === null || meta === void 0 ? void 0 : meta.retryCreationPos;
140
- newRetryCreationPosMap = mapRetryCreationPosMap(retryCreationPosMap, newPosEntry, tr.mapping.map.bind(tr.mapping));
141
- }
136
+ var newPosEntry = meta === null || meta === void 0 ? void 0 : meta.retryCreationPos;
137
+ var newRetryCreationPosMap = mapRetryCreationPosMap(retryCreationPosMap, newPosEntry, tr.mapping.map.bind(tr.mapping));
142
138
  return {
143
139
  activeFlag: (_meta$activeFlag = meta === null || meta === void 0 ? void 0 : meta.activeFlag) !== null && _meta$activeFlag !== void 0 ? _meta$activeFlag : activeFlag,
144
140
  selectionDecorationSet: newDecorationSet,
@@ -194,7 +190,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
194
190
  class: SyncBlockStateCssClassName.viewModeClassName
195
191
  }));
196
192
  }
197
- if (node.type.name === 'bodiedSyncBlock' && syncBlockStore.sourceManager.isPendingCreation(node.attrs.resourceId) && fg('platform_synced_block_patch_1')) {
193
+ if (node.type.name === 'bodiedSyncBlock' && syncBlockStore.sourceManager.isPendingCreation(node.attrs.resourceId)) {
198
194
  loadingDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
199
195
  class: SyncBlockStateCssClassName.creationLoadingClassName
200
196
  }));
@@ -261,12 +257,6 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
261
257
  var _api$connectivity2;
262
258
  var isOffline = isOfflineMode(api === null || api === void 0 || (_api$connectivity2 = api.connectivity) === null || _api$connectivity2 === void 0 || (_api$connectivity2 = _api$connectivity2.sharedState.currentState()) === null || _api$connectivity2 === void 0 ? void 0 : _api$connectivity2.mode);
263
259
  var isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
264
- var hasNoPendingRequest = fg('platform_synced_block_patch_1') ? false :
265
- // requireConfirmationBeforeDelete is always true, so this evaluates to false and hence redundant
266
- !(syncBlockStore !== null && syncBlockStore !== void 0 && syncBlockStore.sourceManager.requireConfirmationBeforeDelete()) && !syncBlockStore.sourceManager.hasPendingCreation();
267
- var isCommitsCreation = fg('platform_synced_block_patch_1') ? false :
268
- // For patch 1, we don't intercept the insert transaction, hence it's redundant
269
- Boolean(tr.getMeta('isCommitSyncBlockCreation'));
270
260
 
271
261
  // Track newly added reference sync blocks before processing the transaction
272
262
  if (tr.docChanged && !tr.getMeta('isRemote')) {
@@ -287,7 +277,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
287
277
  // or are from remote (collab) or already confirmed sync block deletion
288
278
  // We only care about local changes that change the document
289
279
  // and are not yet confirmed for sync block deletion
290
- if (!tr.docChanged || hasNoPendingRequest || Boolean(tr.getMeta('isRemote')) || isCommitsCreation || !isOffline && isConfirmedSyncBlockDeletion) {
280
+ if (!tr.docChanged || Boolean(tr.getMeta('isRemote')) || !isOffline && isConfirmedSyncBlockDeletion) {
291
281
  return true;
292
282
  }
293
283
  var _trackSyncBlocks2 = trackSyncBlocks(syncBlockStore.sourceManager.isSourceBlock, tr, state),
@@ -336,22 +326,8 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
336
326
  // After true is returned here and the node is created, we delete the node in the filterTransaction immediately, which cancels out the creation
337
327
  return true;
338
328
  }
339
- if (fg('platform_synced_block_patch_1')) {
340
- handleBodiedSyncBlockCreation(bodiedSyncBlockAdded, state, api);
341
- return true;
342
- } else {
343
- // If there is bodiedSyncBlock node addition and it's waiting for the result of saving the node to backend (syncBlockStore.hasPendingCreation()),
344
- // we need to intercept the transaction and save it in insert callback so that we only insert it to the document when backend call if backend call is successful
345
- // The callback will be evoked by in SourceSyncBlockStoreManager.commitPendingCreation
346
- syncBlockStore.sourceManager.registerCreationCallback(function () {
347
- var _api$core;
348
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function () {
349
- return tr.setMeta('isCommitSyncBlockCreation', true);
350
- });
351
- api === null || api === void 0 || api.core.actions.focus();
352
- });
353
- return false;
354
- }
329
+ handleBodiedSyncBlockCreation(bodiedSyncBlockAdded, state, api);
330
+ return true;
355
331
  }
356
332
  } else {
357
333
  var _trackSyncBlocks4 = trackSyncBlocks(function (node) {
@@ -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 } 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 { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
9
8
  var TIMEOUT_DURATION = 30000;
10
9
  var pluginKey = new PluginKey('syncedBlockMenuAndToolbarExperience');
@@ -54,44 +53,38 @@ export var getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperi
54
53
  durationMs: TIMEOUT_DURATION
55
54
  }), referenceSyncBlockRemovedFromDomCheck(refs)]
56
55
  });
57
- var unsyncReferenceSyncedBlockExperience;
58
- var unsyncSourceSyncedBlockExperience;
59
- var deleteSourceSyncedBlockExperience;
60
- var syncedLocationsExperience;
61
- if (fg('platform_synced_block_patch_1')) {
62
- unsyncReferenceSyncedBlockExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
63
- action: ACTION.REFERENCE_SYNCED_BLOCK_UNSYNC,
64
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
65
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
66
- checks: [new ExperienceCheckTimeout({
67
- durationMs: TIMEOUT_DURATION
68
- }), referenceSyncBlockRemovedFromDomCheck(refs)]
69
- });
70
- unsyncSourceSyncedBlockExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
71
- action: ACTION.SYNCED_BLOCK_UNSYNC,
72
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
73
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
74
- checks: [new ExperienceCheckTimeout({
75
- durationMs: TIMEOUT_DURATION
76
- }), syncBlockDeleteConfirmationModalAddedCheck(refs)]
77
- });
78
- deleteSourceSyncedBlockExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
79
- action: ACTION.SYNCED_BLOCK_DELETE,
80
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
81
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
82
- checks: [new ExperienceCheckTimeout({
83
- durationMs: TIMEOUT_DURATION
84
- }), syncBlockDeleteConfirmationModalAddedCheck(refs)]
85
- });
86
- syncedLocationsExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
87
- action: ACTION.SYNCED_BLOCK_VIEW_SYNCED_LOCATIONS,
88
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
89
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
90
- checks: [new ExperienceCheckTimeout({
91
- durationMs: TIMEOUT_DURATION
92
- }), syncedLocationsDropdownOpenedCheck(refs)]
93
- });
94
- }
56
+ var unsyncReferenceSyncedBlockExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
57
+ action: ACTION.REFERENCE_SYNCED_BLOCK_UNSYNC,
58
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
59
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
60
+ checks: [new ExperienceCheckTimeout({
61
+ durationMs: TIMEOUT_DURATION
62
+ }), referenceSyncBlockRemovedFromDomCheck(refs)]
63
+ });
64
+ var unsyncSourceSyncedBlockExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
65
+ action: ACTION.SYNCED_BLOCK_UNSYNC,
66
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
67
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
68
+ checks: [new ExperienceCheckTimeout({
69
+ durationMs: TIMEOUT_DURATION
70
+ }), syncBlockDeleteConfirmationModalAddedCheck(refs)]
71
+ });
72
+ var deleteSourceSyncedBlockExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
73
+ action: ACTION.SYNCED_BLOCK_DELETE,
74
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
75
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
76
+ checks: [new ExperienceCheckTimeout({
77
+ durationMs: TIMEOUT_DURATION
78
+ }), syncBlockDeleteConfirmationModalAddedCheck(refs)]
79
+ });
80
+ var syncedLocationsExperience = new Experience(EXPERIENCE_ID.TOOLBAR_ACTION, {
81
+ action: ACTION.SYNCED_BLOCK_VIEW_SYNCED_LOCATIONS,
82
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_TOOLBAR,
83
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
84
+ checks: [new ExperienceCheckTimeout({
85
+ durationMs: TIMEOUT_DURATION
86
+ }), syncedLocationsDropdownOpenedCheck(refs)]
87
+ });
95
88
  var unbindClickListener = bind(document, {
96
89
  type: 'click',
97
90
  listener: function listener(event) {
@@ -155,7 +148,6 @@ export var getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperi
155
148
  editorViewEl = editorView.dom;
156
149
  return {
157
150
  destroy: function destroy() {
158
- var _deleteSourceSyncedBl, _unsyncReferenceSynce, _unsyncSourceSyncedBl, _syncedLocationsExper;
159
151
  createSourcePrimaryToolbarExperience.abort({
160
152
  reason: 'editorDestroyed'
161
153
  });
@@ -168,16 +160,16 @@ export var getMenuAndToolbarExperiencesPlugin = function getMenuAndToolbarExperi
168
160
  deleteReferenceSyncedBlockExperience.abort({
169
161
  reason: 'editorDestroyed'
170
162
  });
171
- (_deleteSourceSyncedBl = deleteSourceSyncedBlockExperience) === null || _deleteSourceSyncedBl === void 0 || _deleteSourceSyncedBl.abort({
163
+ deleteSourceSyncedBlockExperience === null || deleteSourceSyncedBlockExperience === void 0 || deleteSourceSyncedBlockExperience.abort({
172
164
  reason: 'editorDestroyed'
173
165
  });
174
- (_unsyncReferenceSynce = unsyncReferenceSyncedBlockExperience) === null || _unsyncReferenceSynce === void 0 || _unsyncReferenceSynce.abort({
166
+ unsyncReferenceSyncedBlockExperience === null || unsyncReferenceSyncedBlockExperience === void 0 || unsyncReferenceSyncedBlockExperience.abort({
175
167
  reason: 'editorDestroyed'
176
168
  });
177
- (_unsyncSourceSyncedBl = unsyncSourceSyncedBlockExperience) === null || _unsyncSourceSyncedBl === void 0 || _unsyncSourceSyncedBl.abort({
169
+ unsyncSourceSyncedBlockExperience === null || unsyncSourceSyncedBlockExperience === void 0 || unsyncSourceSyncedBlockExperience.abort({
178
170
  reason: 'editorDestroyed'
179
171
  });
180
- (_syncedLocationsExper = syncedLocationsExperience) === null || _syncedLocationsExper === void 0 || _syncedLocationsExper.abort({
172
+ syncedLocationsExperience === null || syncedLocationsExperience === void 0 || syncedLocationsExperience.abort({
181
173
  reason: 'editorDestroyed'
182
174
  });
183
175
  unbindClickListener();
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { bodiedSyncBlock, syncBlock } from '@atlaskit/adf-schema';
3
3
  import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { flushBodiedSyncBlocks as _flushBodiedSyncBlocks, flushSyncBlocks } from './editor-actions';
5
6
  import { copySyncedBlockReferenceToClipboardEditorCommand, createSyncedBlock } from './editor-commands';
7
+ import { bodiedSyncBlockNodeWithToDOMFixed } from './nodeviews/bodiedSyncBlockNodeWithToDOMFixed';
6
8
  import { createPlugin, syncedBlockPluginKey } from './pm-plugins/main';
7
9
  import { getMenuAndToolbarExperiencesPlugin } from './pm-plugins/menu-and-toolbar-experiences';
8
10
  import { getBlockMenuComponents } from './ui/block-menu-components';
@@ -29,7 +31,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
29
31
  node: syncBlock
30
32
  }, {
31
33
  name: 'bodiedSyncBlock',
32
- node: bodiedSyncBlock
34
+ node: fg('platform_synced_block_patch_3') ? bodiedSyncBlockNodeWithToDOMFixed() : bodiedSyncBlock
33
35
  }];
34
36
  },
35
37
  pmPlugins: function pmPlugins() {
@@ -25,7 +25,6 @@ import QuotationMarkIcon from '@atlaskit/icon/core/quotation-mark';
25
25
  import StatusErrorIcon from '@atlaskit/icon/core/status-error';
26
26
  import { ConfluenceIcon, JiraIcon, AtlassianIcon } from '@atlaskit/logo';
27
27
  import Lozenge from '@atlaskit/lozenge';
28
- import { fg } from '@atlaskit/platform-feature-flags';
29
28
  import { Box, Text, Inline, Anchor, Stack } from '@atlaskit/primitives/compiled';
30
29
  import Spinner from '@atlaskit/spinner';
31
30
  import Tooltip from '@atlaskit/tooltip';
@@ -175,14 +174,14 @@ export var SyncedLocationDropdown = function SyncedLocationDropdown(_ref4) {
175
174
  var isOpen = _ref5.isOpen;
176
175
  return setIsOpen(isOpen);
177
176
  },
178
- testId: fg('platform_synced_block_patch_1') ? 'synced-block-synced-locations-dropdown' : undefined,
177
+ testId: "synced-block-synced-locations-dropdown",
179
178
  trigger: function trigger(_ref6) {
180
179
  var triggerRef = _ref6.triggerRef,
181
180
  triggerProps = _objectWithoutProperties(_ref6, _excluded);
182
181
  return /*#__PURE__*/React.createElement(Button, _extends({
183
182
  ref: triggerRef,
184
183
  areAnyNewToolbarFlagsEnabled: true,
185
- selected: fg('platform_synced_block_patch_1') ? isOpen : undefined,
184
+ selected: isOpen,
186
185
  iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
187
186
  color: "currentColor",
188
187
  spacing: "spacious",
@@ -251,18 +250,16 @@ var DropdownContent = function DropdownContent(_ref7) {
251
250
  getReferenceData();
252
251
  }, [syncBlockStore, intl, isSource, localId, resourceId]);
253
252
  var handleLocationClick = function handleLocationClick() {
254
- if (fg('platform_synced_block_patch_1')) {
255
- var _api$analytics;
256
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
257
- eventType: EVENT_TYPE.OPERATIONAL,
258
- action: ACTION.CLICKED,
259
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
260
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CLICK_SYNCED_LOCATION,
261
- attributes: {
262
- resourceId: resourceId
263
- }
264
- });
265
- }
253
+ var _api$analytics;
254
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
255
+ eventType: EVENT_TYPE.OPERATIONAL,
256
+ action: ACTION.CLICKED,
257
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
258
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CLICK_SYNCED_LOCATION,
259
+ attributes: {
260
+ resourceId: resourceId
261
+ }
262
+ });
266
263
  };
267
264
  var content = function content() {
268
265
  switch (fetchStatus) {
@@ -324,7 +321,7 @@ var ErrorScreen = function ErrorScreen(_ref9) {
324
321
  var formatMessage = _ref9.formatMessage;
325
322
  return /*#__PURE__*/React.createElement(Box, {
326
323
  xcss: styles.errorContainer,
327
- testId: fg('platform_synced_block_patch_1') ? 'synced-locations-dropdown-content-error' : undefined
324
+ testId: "synced-locations-dropdown-content-error"
328
325
  }, /*#__PURE__*/React.createElement(Box, {
329
326
  xcss: styles.errorIcon
330
327
  }, /*#__PURE__*/React.createElement(StatusErrorIcon, {
@@ -342,7 +339,7 @@ var NoResultScreen = function NoResultScreen(_ref0) {
342
339
  return /*#__PURE__*/React.createElement(Stack, {
343
340
  xcss: styles.noResultsContainer,
344
341
  space: "space.100",
345
- testId: fg('platform_synced_block_patch_1') ? 'synced-locations-dropdown-content-no-results' : undefined
342
+ testId: "synced-locations-dropdown-content-no-results"
346
343
  }, /*#__PURE__*/React.createElement(Text, {
347
344
  as: "p"
348
345
  }, formatMessage(messages.syncedLocationDropdownNoResults)), /*#__PURE__*/React.createElement(Text, {
@@ -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';
@@ -23,7 +22,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
23
22
  if (!syncBlockObject) {
24
23
  return;
25
24
  }
26
- if (syncBlockStore.sourceManager.isPendingCreation(syncBlockObject.node.attrs.resourceId) && fg('platform_synced_block_patch_1')) {
25
+ if (syncBlockStore.sourceManager.isPendingCreation(syncBlockObject.node.attrs.resourceId)) {
27
26
  return;
28
27
  }
29
28
  var syncBlockInstance = syncBlockStore.referenceManager.getFromCache(syncBlockObject.node.attrs.resourceId);
@@ -84,7 +83,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
84
83
  onClick: function onClick() {
85
84
  return unsync(syncBlockStore, isBodiedSyncBlock, view);
86
85
  },
87
- testId: fg('platform_synced_block_patch_1') ? isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceUnsync : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceUnsync : undefined
86
+ testId: isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceUnsync : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceUnsync
88
87
  });
89
88
  }
90
89
  };
@@ -129,7 +128,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
129
128
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
130
129
  label: ""
131
130
  }),
132
- testId: fg('platform_synced_block_patch_1') ? isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete : undefined
131
+ testId: isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
133
132
  }, hoverDecorationProps(nodeType))]
134
133
  }];
135
134
  items.push.apply(items, overflowMenuConfig);
@@ -0,0 +1,6 @@
1
+ import type { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
4
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
5
+ */
6
+ export declare const bodiedSyncBlockNodeWithToDOMFixed: () => NodeSpec;
@@ -0,0 +1,6 @@
1
+ import type { NodeSpec } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Based on packages/editor/editor-plugin-synced-block/src/nodeviews/bodiedSyncedBlock.tsx
4
+ * Adding correct classnames and structure to the toDOM, necessary for SSR rendering
5
+ */
6
+ export declare const bodiedSyncBlockNodeWithToDOMFixed: () => NodeSpec;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "5.3.19",
3
+ "version": "5.3.21",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/editor-plugin-selection": "^7.0.0",
41
41
  "@atlaskit/editor-prosemirror": "^7.3.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.10.0",
43
- "@atlaskit/editor-synced-block-provider": "^3.28.0",
43
+ "@atlaskit/editor-synced-block-provider": "^3.29.0",
44
44
  "@atlaskit/editor-toolbar": "^0.19.0",
45
45
  "@atlaskit/flag": "^17.8.0",
46
46
  "@atlaskit/icon": "31.0.0",
@@ -61,7 +61,7 @@
61
61
  "react-intl-next": "npm:react-intl@^5.18.1"
62
62
  },
63
63
  "peerDependencies": {
64
- "@atlaskit/editor-common": "^111.12.0",
64
+ "@atlaskit/editor-common": "^111.13.0",
65
65
  "react": "^18.2.0"
66
66
  },
67
67
  "devDependencies": {
@@ -104,10 +104,10 @@
104
104
  }
105
105
  },
106
106
  "platform-feature-flags": {
107
- "platform_synced_block_patch_1": {
107
+ "platform_synced_block_patch_2": {
108
108
  "type": "boolean"
109
109
  },
110
- "platform_synced_block_patch_2": {
110
+ "platform_synced_block_patch_3": {
111
111
  "type": "boolean"
112
112
  }
113
113
  }