@atlaskit/editor-plugin-synced-block 5.3.12 → 5.3.13

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/afm-cc/tsconfig.json +0 -3
  3. package/afm-jira/tsconfig.json +0 -3
  4. package/afm-products/tsconfig.json +0 -3
  5. package/dist/cjs/editor-commands/index.js +27 -33
  6. package/dist/cjs/nodeviews/bodiedSyncedBlock.js +2 -7
  7. package/dist/cjs/nodeviews/syncedBlock.js +4 -18
  8. package/dist/cjs/pm-plugins/main.js +34 -43
  9. package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +1 -2
  10. package/dist/cjs/pm-plugins/utils/utils.js +1 -46
  11. package/dist/cjs/syncedBlockPlugin.js +3 -5
  12. package/dist/cjs/ui/DeleteConfirmationModal.js +4 -20
  13. package/dist/cjs/ui/SyncBlockLabel.js +4 -10
  14. package/dist/cjs/ui/SyncBlockRefresher.js +7 -9
  15. package/dist/cjs/ui/floating-toolbar.js +3 -3
  16. package/dist/es2019/editor-commands/index.js +27 -33
  17. package/dist/es2019/nodeviews/bodiedSyncedBlock.js +2 -7
  18. package/dist/es2019/nodeviews/syncedBlock.js +4 -15
  19. package/dist/es2019/pm-plugins/main.js +33 -42
  20. package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +1 -2
  21. package/dist/es2019/pm-plugins/utils/utils.js +0 -47
  22. package/dist/es2019/syncedBlockPlugin.js +3 -4
  23. package/dist/es2019/ui/DeleteConfirmationModal.js +4 -20
  24. package/dist/es2019/ui/SyncBlockLabel.js +4 -10
  25. package/dist/es2019/ui/SyncBlockRefresher.js +7 -9
  26. package/dist/es2019/ui/floating-toolbar.js +3 -3
  27. package/dist/esm/editor-commands/index.js +27 -33
  28. package/dist/esm/nodeviews/bodiedSyncedBlock.js +2 -7
  29. package/dist/esm/nodeviews/syncedBlock.js +4 -18
  30. package/dist/esm/pm-plugins/main.js +34 -43
  31. package/dist/esm/pm-plugins/utils/track-sync-blocks.js +1 -2
  32. package/dist/esm/pm-plugins/utils/utils.js +0 -45
  33. package/dist/esm/syncedBlockPlugin.js +3 -5
  34. package/dist/esm/ui/DeleteConfirmationModal.js +4 -20
  35. package/dist/esm/ui/SyncBlockLabel.js +4 -10
  36. package/dist/esm/ui/SyncBlockRefresher.js +7 -9
  37. package/dist/esm/ui/floating-toolbar.js +3 -3
  38. package/dist/types/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +1 -1
  39. package/dist/types/pm-plugins/utils/utils.d.ts +1 -3
  40. package/dist/types-ts4.5/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +1 -1
  41. package/dist/types-ts4.5/pm-plugins/utils/utils.d.ts +1 -3
  42. package/package.json +1 -5
@@ -24,17 +24,15 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
24
24
  var paragraphNode = paragraph.createAndFill({});
25
25
  var newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(attrs, paragraphNode ? [paragraphNode] : []);
26
26
  if (!newBodiedSyncBlockNode) {
27
- if (fg('platform_synced_block_dogfooding')) {
28
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
29
- action: ACTION.ERROR,
30
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
31
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
32
- attributes: {
33
- error: 'Create and fill for empty content failed'
34
- },
35
- eventType: EVENT_TYPE.OPERATIONAL
36
- });
37
- }
27
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
28
+ action: ACTION.ERROR,
29
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
30
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
31
+ attributes: {
32
+ error: 'Create and fill for empty content failed'
33
+ },
34
+ eventType: EVENT_TYPE.OPERATIONAL
35
+ });
38
36
  return false;
39
37
  }
40
38
 
@@ -49,33 +47,29 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
49
47
  } else {
50
48
  var conversionInfo = canBeConvertedToSyncBlock(tr.selection);
51
49
  if (!conversionInfo) {
52
- if (fg('platform_synced_block_dogfooding')) {
53
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
54
- action: ACTION.ERROR,
55
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
56
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
57
- attributes: {
58
- error: 'Content cannot be converted to sync block'
59
- },
60
- eventType: EVENT_TYPE.OPERATIONAL
61
- });
62
- }
50
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
51
+ action: ACTION.ERROR,
52
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
53
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
54
+ attributes: {
55
+ error: 'Content cannot be converted to sync block'
56
+ },
57
+ eventType: EVENT_TYPE.OPERATIONAL
58
+ });
63
59
  return false;
64
60
  }
65
61
  var _attrs = syncBlockStore.sourceManager.generateBodiedSyncBlockAttrs();
66
62
  var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude);
67
63
  if (!_newBodiedSyncBlockNode) {
68
- if (fg('platform_synced_block_dogfooding')) {
69
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
70
- action: ACTION.ERROR,
71
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
72
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
73
- attributes: {
74
- error: 'Create and fill for content failed'
75
- },
76
- eventType: EVENT_TYPE.OPERATIONAL
77
- });
78
- }
64
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
65
+ action: ACTION.ERROR,
66
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
67
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
68
+ attributes: {
69
+ error: 'Create and fill for content failed'
70
+ },
71
+ eventType: EVENT_TYPE.OPERATIONAL
72
+ });
79
73
  return false;
80
74
  }
81
75
 
@@ -12,7 +12,6 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
12
12
  import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
13
13
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
14
14
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
15
  import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
17
16
  var toDOM = function toDOM() {
18
17
  return ['div', {
@@ -90,7 +89,7 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
90
89
  if (!syncBlockStore) {
91
90
  return null;
92
91
  }
93
- return fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(ErrorBoundary, {
92
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
94
93
  component: ACTION_SUBJECT.SYNCED_BLOCK,
95
94
  dispatchAnalyticsEvent: (_this$api6 = this.api) === null || _this$api6 === void 0 || (_this$api6 = _this$api6.analytics) === null || _this$api6 === void 0 ? void 0 : _this$api6.actions.fireAnalyticsEvent,
96
95
  fallbackComponent: null
@@ -98,11 +97,7 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
98
97
  ref: forwardRef,
99
98
  syncBlockStore: syncBlockStore,
100
99
  node: this.node
101
- })) : /*#__PURE__*/React.createElement(BodiedSyncBlockWrapper, {
102
- ref: forwardRef,
103
- syncBlockStore: syncBlockStore,
104
- node: this.node
105
- });
100
+ }));
106
101
  }
107
102
  }, {
108
103
  key: "getContentDOM",
@@ -13,7 +13,6 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
13
13
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
14
14
  import { SyncBlockSharedCssClassName, SyncBlockActionsProvider } from '@atlaskit/editor-common/sync-block';
15
15
  import { useFetchSyncBlockData as _useFetchSyncBlockData, useFetchSyncBlockTitle as _useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
16
- import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import { removeSyncedBlockAtPos } from '../editor-commands';
18
17
  import { SyncBlockRendererWrapper } from '../ui/SyncBlockRendererWrapper';
19
18
  export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
@@ -42,8 +41,7 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
42
41
  _this$api,
43
42
  _this$api2,
44
43
  _this2 = this,
45
- _this$options2,
46
- _this$options3;
44
+ _this$options2;
47
45
  var getPos = _ref.getPos;
48
46
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
49
47
  return null;
@@ -54,14 +52,13 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
54
52
  if (!resourceId || !localId) {
55
53
  return null;
56
54
  }
57
- var initialSyncBlockStore = fg('platform_synced_block_dogfooding') ? this.syncBlockStore : undefined;
58
- var syncBlockStore = (_this$api$syncedBlock = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.syncedBlock) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.syncBlockStore) !== null && _this$api$syncedBlock !== void 0 ? _this$api$syncedBlock : initialSyncBlockStore;
55
+ var syncBlockStore = (_this$api$syncedBlock = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.syncedBlock) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.syncBlockStore) !== null && _this$api$syncedBlock !== void 0 ? _this$api$syncedBlock : this.syncBlockStore;
59
56
  if (!syncBlockStore) {
60
57
  return null;
61
58
  }
62
59
 
63
60
  // get document node from data provider
64
- return fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(ErrorBoundary, {
61
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
65
62
  component: ACTION_SUBJECT.SYNCED_BLOCK,
66
63
  dispatchAnalyticsEvent: (_this$api2 = this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.analytics) === null || _this$api2 === void 0 ? void 0 : _this$api2.actions.fireAnalyticsEvent,
67
64
  fallbackComponent: null
@@ -86,18 +83,7 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
86
83
  return _useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this2$api = _this2.api) === null || _this2$api === void 0 || (_this2$api = _this2$api.analytics) === null || _this2$api === void 0 || (_this2$api = _this2$api.actions) === null || _this2$api === void 0 ? void 0 : _this2$api.fireAnalyticsEvent);
87
84
  },
88
85
  api: this.api
89
- }))) : /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
90
- localId: this.node.attrs.localId,
91
- syncedBlockRenderer: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncedBlockRenderer,
92
- useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
93
- return _useFetchSyncBlockTitle(syncBlockStore, _this2.node);
94
- },
95
- useFetchSyncBlockData: function useFetchSyncBlockData() {
96
- var _this2$api2;
97
- return _useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this2$api2 = _this2.api) === null || _this2$api2 === void 0 || (_this2$api2 = _this2$api2.analytics) === null || _this2$api2 === void 0 || (_this2$api2 = _this2$api2.actions) === null || _this2$api2 === void 0 ? void 0 : _this2$api2.fireAnalyticsEvent);
98
- },
99
- api: this.api
100
- });
86
+ })));
101
87
  }
102
88
  }, {
103
89
  key: "destroy",
@@ -13,9 +13,7 @@ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
13
13
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
14
14
  import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
15
15
  import { convertPMNodesToSyncBlockNodes, rebaseTransaction } from '@atlaskit/editor-synced-block-provider';
16
- import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import { lazyBodiedSyncBlockView } from '../nodeviews/bodiedLazySyncedBlock';
18
- import { lazySyncBlockView } from '../nodeviews/lazySyncedBlock';
19
17
  import { SyncBlock as SyncBlockView } from '../nodeviews/syncedBlock';
20
18
  import { FLAG_ID } from '../types';
21
19
  import { handleBodiedSyncBlockRemoval } from './utils/handle-bodied-sync-block-removal';
@@ -57,7 +55,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
57
55
  var unpublishedFlagShown = new Set();
58
56
 
59
57
  // Set up callback to detect unpublished sync blocks when they're fetched
60
- fg('platform_synced_block_dogfooding') && syncBlockStore.referenceManager.setOnUnpublishedSyncBlockDetected(function (resourceId) {
58
+ syncBlockStore.referenceManager.setOnUnpublishedSyncBlockDetected(function (resourceId) {
61
59
  // Only show the flag once per sync block
62
60
  if (!unpublishedFlagShown.has(resourceId)) {
63
61
  unpublishedFlagShown.add(resourceId);
@@ -108,7 +106,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
108
106
  },
109
107
  props: {
110
108
  nodeViews: {
111
- syncBlock: fg('platform_synced_block_dogfooding') ? function (node, view, getPos, _decorations) {
109
+ syncBlock: function syncBlock(node, view, getPos, _decorations) {
112
110
  // To support SSR, pass `syncBlockStore` here
113
111
  // and do not use lazy loading.
114
112
  // We cannot start rendering and then load `syncBlockStore` asynchronously,
@@ -123,11 +121,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
123
121
  eventDispatcher: pmPluginFactoryParams.eventDispatcher,
124
122
  syncBlockStore: syncBlockStore
125
123
  }).init();
126
- } : lazySyncBlockView({
127
- options: options,
128
- pmPluginFactoryParams: pmPluginFactoryParams,
129
- api: api
130
- }),
124
+ },
131
125
  bodiedSyncBlock: lazyBodiedSyncBlockView({
132
126
  pluginOptions: options,
133
127
  pmPluginFactoryParams: pmPluginFactoryParams,
@@ -217,7 +211,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
217
211
  var isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
218
212
 
219
213
  // Track newly added reference sync blocks before processing the transaction
220
- if (tr.docChanged && !tr.getMeta('isRemote') && fg('platform_synced_block_dogfooding')) {
214
+ if (tr.docChanged && !tr.getMeta('isRemote')) {
221
215
  var _trackSyncBlocks = trackSyncBlocks(function (node) {
222
216
  return node.type.name === 'syncBlock';
223
217
  }, tr, state),
@@ -242,43 +236,40 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
242
236
  bodiedSyncBlockRemoved = _trackSyncBlocks2.removed,
243
237
  bodiedSyncBlockAdded = _trackSyncBlocks2.added;
244
238
  if (!isOffline) {
245
- if (fg('platform_synced_block_dogfooding')) {
246
- var _trackSyncBlocks3 = trackSyncBlocks(function (node) {
247
- return node.type.name === 'syncBlock';
248
- }, tr, state),
249
- syncBlockRemoved = _trackSyncBlocks3.removed,
250
- syncBlockAdded = _trackSyncBlocks3.added;
251
- syncBlockRemoved.forEach(function (syncBlock) {
252
- var _api$analytics;
253
- 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({
254
- action: ACTION.DELETED,
255
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
256
- actionSubjectId: ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_DELETE,
257
- attributes: {
258
- resourceId: syncBlock.attrs.resourceId,
259
- blockInstanceId: syncBlock.attrs.localId
260
- },
261
- eventType: EVENT_TYPE.OPERATIONAL
262
- });
239
+ var _trackSyncBlocks3 = trackSyncBlocks(function (node) {
240
+ return node.type.name === 'syncBlock';
241
+ }, tr, state),
242
+ syncBlockRemoved = _trackSyncBlocks3.removed,
243
+ syncBlockAdded = _trackSyncBlocks3.added;
244
+ syncBlockRemoved.forEach(function (syncBlock) {
245
+ var _api$analytics;
246
+ 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({
247
+ action: ACTION.DELETED,
248
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
249
+ actionSubjectId: ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_DELETE,
250
+ attributes: {
251
+ resourceId: syncBlock.attrs.resourceId,
252
+ blockInstanceId: syncBlock.attrs.localId
253
+ },
254
+ eventType: EVENT_TYPE.OPERATIONAL
263
255
  });
264
- syncBlockAdded.forEach(function (syncBlock) {
265
- var _api$analytics2;
266
- 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({
267
- action: ACTION.INSERTED,
268
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
269
- actionSubjectId: ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_CREATE,
270
- attributes: {
271
- resourceId: syncBlock.attrs.resourceId,
272
- blockInstanceId: syncBlock.attrs.localId
273
- },
274
- eventType: EVENT_TYPE.OPERATIONAL
275
- });
256
+ });
257
+ syncBlockAdded.forEach(function (syncBlock) {
258
+ var _api$analytics2;
259
+ 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({
260
+ action: ACTION.INSERTED,
261
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
262
+ actionSubjectId: ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_CREATE,
263
+ attributes: {
264
+ resourceId: syncBlock.attrs.resourceId,
265
+ blockInstanceId: syncBlock.attrs.localId
266
+ },
267
+ eventType: EVENT_TYPE.OPERATIONAL
276
268
  });
277
- }
278
- ;
269
+ });
279
270
  if (bodiedSyncBlockRemoved.length > 0) {
280
271
  confirmationTransactionRef.current = tr;
281
- return handleBodiedSyncBlockRemoval(bodiedSyncBlockRemoved, syncBlockStore, api, confirmationTransactionRef, fg('platform_synced_block_dogfooding') ? getDeleteReason(tr) : undefined);
272
+ return handleBodiedSyncBlockRemoval(bodiedSyncBlockRemoved, syncBlockStore, api, confirmationTransactionRef, getDeleteReason(tr));
282
273
  }
283
274
  if (bodiedSyncBlockAdded.length > 0) {
284
275
  if (Boolean(tr.getMeta(pmHistoryPluginKey))) {
@@ -3,7 +3,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
3
3
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
4
  import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  export var trackSyncBlocks = function trackSyncBlocks(predicate, tr, state) {
8
7
  var removed = {};
9
8
  var added = {};
@@ -23,7 +22,7 @@ export var trackSyncBlocks = function trackSyncBlocks(predicate, tr, state) {
23
22
  var hasBodiedSyncBlockChanges = replaceSteps.some(function (step, idx) {
24
23
  var from = step.from,
25
24
  to = step.to;
26
- var docAtStep = fg('platform_synced_block_dogfooding') ? tr.docs[idx] : state.doc;
25
+ var docAtStep = tr.docs[idx];
27
26
  var hasChange = false;
28
27
  if (from !== to) {
29
28
  step.getMap().forEach(function (oldStart, oldEnd) {
@@ -1,9 +1,6 @@
1
1
  import { expandSelectionToBlockRange } from '@atlaskit/editor-common/selection';
2
2
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
3
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
- import { CellSelection, findTable } from '@atlaskit/editor-tables';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
4
  export var findSyncBlock = function findSyncBlock(schema, selection) {
8
5
  var syncBlock = schema.nodes.syncBlock;
9
6
  return findSelectedNodeOfType(syncBlock)(selection);
@@ -28,48 +25,6 @@ var UNSUPPORTED_NODE_TYPES = new Set(['inlineExtension', 'extension', 'bodiedExt
28
25
  * or false if conversion is not possible
29
26
  */
30
27
  export var canBeConvertedToSyncBlock = function canBeConvertedToSyncBlock(selection) {
31
- return fg('platform_synced_block_dogfooding') ? canBeConvertedToSyncBlockNew(selection) : canBeConvertedToSyncBlockOld(selection);
32
- };
33
- export var canBeConvertedToSyncBlockOld = function canBeConvertedToSyncBlockOld(selection) {
34
- var schema = selection.$from.doc.type.schema;
35
- var nodes = schema.nodes;
36
- var from = selection.from;
37
- var to = selection.to;
38
- var contentToInclude = selection.content().content;
39
- if (selection instanceof CellSelection) {
40
- var table = findTable(selection);
41
- if (!table) {
42
- return false;
43
- }
44
- contentToInclude = Fragment.from([table.node]);
45
- from = table.pos;
46
- to = table.pos + table.node.nodeSize;
47
- } else if (selection instanceof TextSelection) {
48
- var trueParent = findParentNodeOfType([nodes.bulletList, nodes.orderedList, nodes.taskList, nodes.blockquote])(selection);
49
- if (trueParent) {
50
- contentToInclude = Fragment.from([trueParent.node]);
51
- from = trueParent.pos;
52
- to = trueParent.pos + trueParent.node.nodeSize;
53
- }
54
- }
55
- var canBeConverted = true;
56
- selection.$from.doc.nodesBetween(from, to, function (node) {
57
- if (UNSUPPORTED_NODE_TYPES.has(node.type.name)) {
58
- canBeConverted = false;
59
- return false;
60
- }
61
- });
62
- if (!canBeConverted) {
63
- return false;
64
- }
65
- contentToInclude = removeBreakoutMarks(contentToInclude);
66
- return {
67
- contentToInclude: contentToInclude,
68
- from: from,
69
- to: to
70
- };
71
- };
72
- export var canBeConvertedToSyncBlockNew = function canBeConvertedToSyncBlockNew(selection) {
73
28
  var _expandSelectionToBlo = expandSelectionToBlockRange(selection),
74
29
  $from = _expandSelectionToBlo.$from,
75
30
  range = _expandSelectionToBlo.range;
@@ -1,11 +1,9 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  import React from 'react';
3
2
  import { bodiedSyncBlock, syncBlock } from '@atlaskit/adf-schema';
4
3
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
5
4
  import { IconSyncBlock } from '@atlaskit/editor-common/quick-insert';
6
5
  import { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
7
6
  import Lozenge from '@atlaskit/lozenge';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
7
  import { flushBodiedSyncBlocks as _flushBodiedSyncBlocks, flushSyncBlocks } from './editor-actions';
10
8
  import { copySyncedBlockReferenceToClipboardEditorCommand, createSyncedBlock } from './editor-commands';
11
9
  import { createPlugin, syncedBlockPluginKey } from './pm-plugins/main';
@@ -43,7 +41,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
43
41
  plugin: function plugin(params) {
44
42
  return createPlugin(config, params, syncBlockStore, api);
45
43
  }
46
- }].concat(_toConsumableArray(fg('platform_synced_block_dogfooding') ? [{
44
+ }, {
47
45
  name: 'menuAndToolbarExperiencesPlugin',
48
46
  plugin: function plugin() {
49
47
  return getMenuAndToolbarExperiencesPlugin({
@@ -54,7 +52,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
54
52
  }
55
53
  });
56
54
  }
57
- }] : []));
55
+ }];
58
56
  },
59
57
  commands: {
60
58
  copySyncedBlockReferenceToClipboard: function copySyncedBlockReferenceToClipboard(inputMethod) {
@@ -114,7 +112,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
114
112
  fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.fireAnalyticsEvent
115
113
  });
116
114
  },
117
- testId: fg('platform_synced_block_dogfooding') ? SYNCED_BLOCK_BUTTON_TEST_ID.quickInsertCreate : undefined
115
+ testId: SYNCED_BLOCK_BUTTON_TEST_ID.quickInsertCreate
118
116
  }];
119
117
  },
120
118
  floatingToolbar: function floatingToolbar(state, intl) {
@@ -11,7 +11,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
11
11
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
12
12
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
13
13
  import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { Text, Box } from '@atlaskit/primitives/compiled';
16
15
  import Spinner from '@atlaskit/spinner';
17
16
  import { syncedBlockPluginKey } from '../pm-plugins/main';
@@ -35,7 +34,7 @@ var styles = {
35
34
  spinner: "_1mou1wug _195g1wug"
36
35
  };
37
36
  export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
38
- var _api$core2, _api$core4, _api$core6, _syncBlockIds$length;
37
+ var _api$core2, _api$core4, _api$core6;
39
38
  var syncBlockStoreManager = _ref.syncBlockStoreManager,
40
39
  api = _ref.api;
41
40
  var _useState = useState(false),
@@ -130,7 +129,7 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
130
129
  }
131
130
  }, [api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions, bodiedSyncBlockDeletionStatus, isOpen]);
132
131
  useEffect(function () {
133
- if (isOpen && syncBlockIds !== undefined && fg('platform_synced_block_dogfooding')) {
132
+ if (isOpen && syncBlockIds !== undefined) {
134
133
  var fetchReferences = /*#__PURE__*/function () {
135
134
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
136
135
  var references, totalCount;
@@ -196,7 +195,7 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
196
195
  onClose: handleClick(false),
197
196
  testId: "sync-block-delete-confirmation",
198
197
  height: 184
199
- }, fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(React.Fragment, null, referenceCount === undefined ? /*#__PURE__*/React.createElement(Box, {
198
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, referenceCount === undefined ? /*#__PURE__*/React.createElement(Box, {
200
199
  xcss: styles.spinner
201
200
  }, /*#__PURE__*/React.createElement(Spinner, {
202
201
  size: "large"
@@ -209,22 +208,7 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
209
208
  isDisabled: isOfflineMode(mode),
210
209
  deleteReason: deleteReason,
211
210
  sourceCount: (syncBlockIds === null || syncBlockIds === void 0 ? void 0 : syncBlockIds.length) || 0
212
- })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalHeader, {
213
- hasCloseButton: true
214
- }, /*#__PURE__*/React.createElement(ModalTitle, {
215
- appearance: "warning"
216
- }, formatMessage(messages.deleteConfirmationModalTitleSingle))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, null, formatMessage(messages.deleteConfirmationModalDescription, {
217
- syncBlockCount: (_syncBlockIds$length = syncBlockIds === null || syncBlockIds === void 0 ? void 0 : syncBlockIds.length) !== null && _syncBlockIds$length !== void 0 ? _syncBlockIds$length : 1
218
- }))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
219
- appearance: "subtle",
220
- onClick: handleClick(false)
221
- }, formatMessage(messages.deleteConfirmationModalCancelButton)), /*#__PURE__*/React.createElement(Button, {
222
- appearance: "warning",
223
- onClick: handleClick(true),
224
- autoFocus: true,
225
- isDisabled: isOfflineMode(mode),
226
- isLoading: bodiedSyncBlockDeletionStatus === 'processing'
227
- }, formatMessage(messages.deleteConfirmationModalDeleteButton))))));
211
+ }))));
228
212
  };
229
213
  var ModalContent = function ModalContent(_ref7) {
230
214
  var content = _ref7.content,
@@ -4,7 +4,6 @@ import { useIntl } from 'react-intl-next';
4
4
  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
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { Text } from '@atlaskit/primitives/compiled';
9
8
  import Tooltip from '@atlaskit/tooltip';
10
9
  import VisuallyHidden from '@atlaskit/visually-hidden';
@@ -23,17 +22,12 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
23
22
  tooltipContent = _useState2[0],
24
23
  setTooltipContent = _useState2[1];
25
24
  var tooltipMessage = formatMessage(messages.defaultSyncBlockTooltip);
26
- if (isSource && !fg('platform_synced_block_dogfooding')) {
27
- tooltipMessage = formatMessage(messages.sourceSyncBlockTooltip);
28
- } else if (title) {
25
+ if (title) {
29
26
  tooltipMessage = formatMessage(messages.referenceSyncBlockTooltip, {
30
27
  title: title
31
28
  });
32
29
  }
33
30
  var updateTooltipContent = useCallback(function () {
34
- if (!fg('platform_synced_block_dogfooding')) {
35
- return;
36
- }
37
31
  var tooltipContent = tooltipMessage;
38
32
  if (contentUpdatedAt) {
39
33
  var elapsedTime = formatElapsedTime(contentUpdatedAt, intl);
@@ -53,7 +47,7 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
53
47
  }, [contentUpdatedAt, formatMessage, intl, tooltipMessage]);
54
48
  var ariaDescribedById = "sync-block-label-description-".concat(localId);
55
49
  var getLabelContent = useMemo(function () {
56
- if (isUnsyncedBlock && fg('platform_synced_block_dogfooding')) {
50
+ if (isUnsyncedBlock) {
57
51
  return /*#__PURE__*/React.createElement(Text, {
58
52
  size: "small",
59
53
  color: "color.text.subtle"
@@ -82,12 +76,12 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
82
76
  size: "small",
83
77
  label: ""
84
78
  }), getLabelContent);
85
- if ((isSource || isUnsyncedBlock) && fg('platform_synced_block_dogfooding')) {
79
+ if (isSource || isUnsyncedBlock) {
86
80
  return label;
87
81
  }
88
82
  return /*#__PURE__*/React.createElement(Tooltip, {
89
83
  position: "top",
90
- content: fg('platform_synced_block_dogfooding') ? tooltipContent : tooltipMessage
84
+ content: tooltipContent
91
85
  // workaround because tooltip adds aria-describedby with a new id every time the tooltip is opened
92
86
  // this causes an infinite rerender loop because of the forwardRef from the node view we are inside in bodiedSyncBlock
93
87
  // tooltip content is available for screen readers in visually hidden content after the label
@@ -1,13 +1,12 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  export var SYNC_BLOCK_FETCH_INTERVAL = 3000;
6
5
 
7
6
  // Component that manages synced block data synchronization.
8
- // When the feature flag 'platform_synced_block_dogfooding' is enabled,
9
- // it uses provider-based GraphQL subscriptions for updates.
10
- // When disabled, it falls back to polling at regular intervals.
7
+ // Component that manages synced block data synchronization.
8
+ // Uses provider-based GraphQL subscriptions for updates when online.
9
+ // Falls back to polling at regular intervals when offline.
11
10
  export var SyncBlockRefresher = function SyncBlockRefresher(_ref) {
12
11
  var syncBlockStoreManager = _ref.syncBlockStoreManager,
13
12
  api = _ref.api;
@@ -18,14 +17,13 @@ export var SyncBlockRefresher = function SyncBlockRefresher(_ref) {
18
17
  };
19
18
  }),
20
19
  mode = _useSharedPluginState.mode;
21
- var featureFlagEnabled = fg('platform_synced_block_dogfooding');
22
20
  var isOnline = !isOfflineMode(mode);
23
21
  useEffect(function () {
24
- var useRealTimeSubscriptions = featureFlagEnabled && isOnline;
22
+ var useRealTimeSubscriptions = isOnline;
25
23
  syncBlockStoreManager.referenceManager.setRealTimeSubscriptionsEnabled(useRealTimeSubscriptions);
26
- }, [syncBlockStoreManager, featureFlagEnabled, isOnline]);
24
+ }, [syncBlockStoreManager, isOnline]);
27
25
  useEffect(function () {
28
- var useRealTimeSubscriptions = featureFlagEnabled && isOnline;
26
+ var useRealTimeSubscriptions = isOnline;
29
27
  if (useRealTimeSubscriptions) {
30
28
  return;
31
29
  }
@@ -44,6 +42,6 @@ export var SyncBlockRefresher = function SyncBlockRefresher(_ref) {
44
42
  return function () {
45
43
  window.clearInterval(interval);
46
44
  };
47
- }, [syncBlockStoreManager, isOnline, featureFlagEnabled]);
45
+ }, [syncBlockStoreManager, isOnline]);
48
46
  return null;
49
47
  };
@@ -49,11 +49,11 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
49
49
  title: formatMessage(commonMessages.delete),
50
50
  onClick: removeSyncedBlock(api),
51
51
  icon: DeleteIcon,
52
- testId: fg('platform_synced_block_dogfooding') ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete : undefined
53
- }, hoverDecorationProps(nodeType, fg('platform_synced_block_dogfooding') ? undefined : akEditorSelectedNodeClassName));
52
+ testId: SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
53
+ }, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
54
54
  items.push(deleteButton);
55
55
  } else {
56
- if (!isErroredBlock && fg('platform_synced_block_dogfooding')) {
56
+ if (!isErroredBlock) {
57
57
  var syncedLocation = {
58
58
  type: 'custom',
59
59
  fallback: [],
@@ -6,4 +6,4 @@ import { type SyncBlockInfo } from '../../types';
6
6
  export type ConfirmationTransactionRef = {
7
7
  current: Transaction | undefined;
8
8
  };
9
- export declare const handleBodiedSyncBlockRemoval: (bodiedSyncBlockRemoved: SyncBlockInfo[], syncBlockStore: SyncBlockStoreManager, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, confirmationTransactionRef: ConfirmationTransactionRef, deletionReason: DeletionReason | undefined) => boolean;
9
+ export declare const handleBodiedSyncBlockRemoval: (bodiedSyncBlockRemoved: SyncBlockInfo[], syncBlockStore: SyncBlockStoreManager, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, confirmationTransactionRef: ConfirmationTransactionRef, deletionReason: DeletionReason) => boolean;
@@ -1,6 +1,6 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { NodeType, Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
3
- import { type Selection } from '@atlaskit/editor-prosemirror/state';
3
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
5
5
  export declare const findSyncBlock: (schema: Schema, selection: Selection) => ContentNodeWithPos | undefined;
6
6
  export declare const findBodiedSyncBlock: (schema: Schema, selection: Selection) => ContentNodeWithPos | undefined;
@@ -20,6 +20,4 @@ export interface SyncBlockConversionInfo {
20
20
  * or false if conversion is not possible
21
21
  */
22
22
  export declare const canBeConvertedToSyncBlock: (selection: Selection) => SyncBlockConversionInfo | false;
23
- export declare const canBeConvertedToSyncBlockOld: (selection: Selection) => SyncBlockConversionInfo | false;
24
- export declare const canBeConvertedToSyncBlockNew: (selection: Selection) => SyncBlockConversionInfo | false;
25
23
  export declare const sliceFullyContainsNode: (slice: Slice, node: PMNode) => boolean;
@@ -6,4 +6,4 @@ import { type SyncBlockInfo } from '../../types';
6
6
  export type ConfirmationTransactionRef = {
7
7
  current: Transaction | undefined;
8
8
  };
9
- export declare const handleBodiedSyncBlockRemoval: (bodiedSyncBlockRemoved: SyncBlockInfo[], syncBlockStore: SyncBlockStoreManager, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, confirmationTransactionRef: ConfirmationTransactionRef, deletionReason: DeletionReason | undefined) => boolean;
9
+ export declare const handleBodiedSyncBlockRemoval: (bodiedSyncBlockRemoved: SyncBlockInfo[], syncBlockStore: SyncBlockStoreManager, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, confirmationTransactionRef: ConfirmationTransactionRef, deletionReason: DeletionReason) => boolean;
@@ -1,6 +1,6 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { NodeType, Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
3
- import { type Selection } from '@atlaskit/editor-prosemirror/state';
3
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
5
5
  export declare const findSyncBlock: (schema: Schema, selection: Selection) => ContentNodeWithPos | undefined;
6
6
  export declare const findBodiedSyncBlock: (schema: Schema, selection: Selection) => ContentNodeWithPos | undefined;
@@ -20,6 +20,4 @@ export interface SyncBlockConversionInfo {
20
20
  * or false if conversion is not possible
21
21
  */
22
22
  export declare const canBeConvertedToSyncBlock: (selection: Selection) => SyncBlockConversionInfo | false;
23
- export declare const canBeConvertedToSyncBlockOld: (selection: Selection) => SyncBlockConversionInfo | false;
24
- export declare const canBeConvertedToSyncBlockNew: (selection: Selection) => SyncBlockConversionInfo | false;
25
23
  export declare const sliceFullyContainsNode: (slice: Slice, node: PMNode) => boolean;