@atlaskit/editor-plugin-synced-block 5.3.11 → 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 (62) hide show
  1. package/CHANGELOG.md +16 -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 +99 -40
  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/menu-and-toolbar-experiences.js +221 -81
  10. package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +1 -2
  11. package/dist/cjs/pm-plugins/utils/utils.js +1 -46
  12. package/dist/cjs/syncedBlockPlugin.js +5 -7
  13. package/dist/cjs/types/index.js +5 -1
  14. package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +2 -1
  15. package/dist/cjs/ui/DeleteConfirmationModal.js +4 -20
  16. package/dist/cjs/ui/SyncBlockLabel.js +4 -10
  17. package/dist/cjs/ui/SyncBlockRefresher.js +7 -9
  18. package/dist/cjs/ui/SyncedLocationDropdown.js +32 -6
  19. package/dist/cjs/ui/floating-toolbar.js +11 -7
  20. package/dist/es2019/editor-commands/index.js +99 -40
  21. package/dist/es2019/nodeviews/bodiedSyncedBlock.js +2 -7
  22. package/dist/es2019/nodeviews/syncedBlock.js +4 -15
  23. package/dist/es2019/pm-plugins/main.js +33 -42
  24. package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +206 -71
  25. package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +1 -2
  26. package/dist/es2019/pm-plugins/utils/utils.js +0 -47
  27. package/dist/es2019/syncedBlockPlugin.js +4 -5
  28. package/dist/es2019/types/index.js +5 -1
  29. package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +2 -1
  30. package/dist/es2019/ui/DeleteConfirmationModal.js +4 -20
  31. package/dist/es2019/ui/SyncBlockLabel.js +4 -10
  32. package/dist/es2019/ui/SyncBlockRefresher.js +7 -9
  33. package/dist/es2019/ui/SyncedLocationDropdown.js +30 -6
  34. package/dist/es2019/ui/floating-toolbar.js +10 -6
  35. package/dist/esm/editor-commands/index.js +99 -40
  36. package/dist/esm/nodeviews/bodiedSyncedBlock.js +2 -7
  37. package/dist/esm/nodeviews/syncedBlock.js +4 -18
  38. package/dist/esm/pm-plugins/main.js +34 -43
  39. package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +221 -81
  40. package/dist/esm/pm-plugins/utils/track-sync-blocks.js +1 -2
  41. package/dist/esm/pm-plugins/utils/utils.js +0 -45
  42. package/dist/esm/syncedBlockPlugin.js +5 -7
  43. package/dist/esm/types/index.js +5 -1
  44. package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +2 -1
  45. package/dist/esm/ui/DeleteConfirmationModal.js +4 -20
  46. package/dist/esm/ui/SyncBlockLabel.js +4 -10
  47. package/dist/esm/ui/SyncBlockRefresher.js +7 -9
  48. package/dist/esm/ui/SyncedLocationDropdown.js +32 -6
  49. package/dist/esm/ui/floating-toolbar.js +11 -7
  50. package/dist/types/editor-commands/index.d.ts +3 -2
  51. package/dist/types/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +1 -1
  52. package/dist/types/pm-plugins/utils/utils.d.ts +1 -3
  53. package/dist/types/syncedBlockPluginType.d.ts +2 -1
  54. package/dist/types/types/index.d.ts +4 -0
  55. package/dist/types/ui/SyncedLocationDropdown.d.ts +4 -1
  56. package/dist/types-ts4.5/editor-commands/index.d.ts +3 -2
  57. package/dist/types-ts4.5/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +1 -1
  58. package/dist/types-ts4.5/pm-plugins/utils/utils.d.ts +1 -3
  59. package/dist/types-ts4.5/syncedBlockPluginType.d.ts +2 -1
  60. package/dist/types-ts4.5/types/index.d.ts +4 -0
  61. package/dist/types-ts4.5/ui/SyncedLocationDropdown.d.ts +4 -1
  62. package/package.json +5 -6
@@ -1,5 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
5
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
5
6
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
@@ -62,7 +63,7 @@ var CopySyncedBlockDropdownItem = function CopySyncedBlockDropdownItem(_ref2) {
62
63
  mode = _useSharedPluginState2.mode;
63
64
  var onClick = function onClick() {
64
65
  var _api$core3, _api$core4, _api$blockControls2;
65
- api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 ? void 0 : api.syncedBlock.commands.copySyncedBlockReferenceToClipboard());
66
+ api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(api === null || api === void 0 ? void 0 : api.syncedBlock.commands.copySyncedBlockReferenceToClipboard(INPUT_METHOD.BLOCK_MENU));
66
67
  api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.toggleBlockMenu({
67
68
  closeMenu: true
68
69
  }));
@@ -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
  };
@@ -14,6 +14,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
14
14
  import { useState, useEffect } from 'react';
15
15
  import { cx } from '@compiled/react';
16
16
  import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
17
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
17
18
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
18
19
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
19
20
  import { IconTile } from '@atlaskit/icon';
@@ -24,6 +25,7 @@ import QuotationMarkIcon from '@atlaskit/icon/core/quotation-mark';
24
25
  import StatusErrorIcon from '@atlaskit/icon/core/status-error';
25
26
  import { ConfluenceIcon, JiraIcon, AtlassianIcon } from '@atlaskit/logo';
26
27
  import Lozenge from '@atlaskit/lozenge';
28
+ import { fg } from '@atlaskit/platform-feature-flags';
27
29
  import { Box, Text, Inline, Anchor, Stack } from '@atlaskit/primitives/compiled';
28
30
  import Spinner from '@atlaskit/spinner';
29
31
  import Tooltip from '@atlaskit/tooltip';
@@ -159,7 +161,8 @@ export var SyncedLocationDropdown = function SyncedLocationDropdown(_ref4) {
159
161
  resourceId = _ref4.resourceId,
160
162
  intl = _ref4.intl,
161
163
  isSource = _ref4.isSource,
162
- localId = _ref4.localId;
164
+ localId = _ref4.localId,
165
+ api = _ref4.api;
163
166
  var formatMessage = intl.formatMessage;
164
167
  var triggerTitle = formatMessage(messages.syncedLocationDropdownTitle);
165
168
  var _useState = useState(false),
@@ -172,12 +175,14 @@ export var SyncedLocationDropdown = function SyncedLocationDropdown(_ref4) {
172
175
  var isOpen = _ref5.isOpen;
173
176
  return setIsOpen(isOpen);
174
177
  },
178
+ testId: fg('platform_synced_block_patch_1') ? 'synced-block-synced-locations-dropdown' : undefined,
175
179
  trigger: function trigger(_ref6) {
176
180
  var triggerRef = _ref6.triggerRef,
177
181
  triggerProps = _objectWithoutProperties(_ref6, _excluded);
178
182
  return /*#__PURE__*/React.createElement(Button, _extends({
179
183
  ref: triggerRef,
180
184
  areAnyNewToolbarFlagsEnabled: true,
185
+ selected: fg('platform_synced_block_patch_1') ? isOpen : undefined,
181
186
  iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
182
187
  color: "currentColor",
183
188
  spacing: "spacious",
@@ -192,7 +197,8 @@ export var SyncedLocationDropdown = function SyncedLocationDropdown(_ref4) {
192
197
  resourceId: resourceId,
193
198
  intl: intl,
194
199
  isSource: isSource,
195
- localId: localId
200
+ localId: localId,
201
+ api: api
196
202
  }));
197
203
  };
198
204
  var DropdownContent = function DropdownContent(_ref7) {
@@ -200,7 +206,8 @@ var DropdownContent = function DropdownContent(_ref7) {
200
206
  resourceId = _ref7.resourceId,
201
207
  intl = _ref7.intl,
202
208
  isSource = _ref7.isSource,
203
- localId = _ref7.localId;
209
+ localId = _ref7.localId,
210
+ api = _ref7.api;
204
211
  var formatMessage = intl.formatMessage;
205
212
  var _useState3 = useState('none'),
206
213
  _useState4 = _slicedToArray(_useState3, 2),
@@ -243,6 +250,20 @@ var DropdownContent = function DropdownContent(_ref7) {
243
250
  }();
244
251
  getReferenceData();
245
252
  }, [syncBlockStore, intl, isSource, localId, resourceId]);
253
+ 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
+ }
266
+ };
246
267
  var content = function content() {
247
268
  switch (fetchStatus) {
248
269
  case 'loading':
@@ -272,7 +293,10 @@ var DropdownContent = function DropdownContent(_ref7) {
272
293
  }),
273
294
  href: reference.url,
274
295
  target: "_blank",
275
- key: reference.title
296
+ key: reference.title,
297
+ onClick: function onClick() {
298
+ return handleLocationClick();
299
+ }
276
300
  }, /*#__PURE__*/React.createElement(ItemTitle, {
277
301
  title: reference.title || reference.url || '',
278
302
  formatMessage: formatMessage,
@@ -299,7 +323,8 @@ var LoadingScreen = function LoadingScreen() {
299
323
  var ErrorScreen = function ErrorScreen(_ref9) {
300
324
  var formatMessage = _ref9.formatMessage;
301
325
  return /*#__PURE__*/React.createElement(Box, {
302
- xcss: styles.errorContainer
326
+ xcss: styles.errorContainer,
327
+ testId: fg('platform_synced_block_patch_1') ? 'synced-locations-dropdown-content-error' : undefined
303
328
  }, /*#__PURE__*/React.createElement(Box, {
304
329
  xcss: styles.errorIcon
305
330
  }, /*#__PURE__*/React.createElement(StatusErrorIcon, {
@@ -316,7 +341,8 @@ var NoResultScreen = function NoResultScreen(_ref0) {
316
341
  var formatMessage = _ref0.formatMessage;
317
342
  return /*#__PURE__*/React.createElement(Stack, {
318
343
  xcss: styles.noResultsContainer,
319
- space: "space.100"
344
+ space: "space.100",
345
+ testId: fg('platform_synced_block_patch_1') ? 'synced-locations-dropdown-content-no-results' : undefined
320
346
  }, /*#__PURE__*/React.createElement(Text, {
321
347
  as: "p"
322
348
  }, formatMessage(messages.syncedLocationDropdownNoResults)), /*#__PURE__*/React.createElement(Text, {
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
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
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
4
  import React from 'react';
5
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
6
  import commonMessages, { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
7
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
7
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
@@ -48,11 +49,11 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
48
49
  title: formatMessage(commonMessages.delete),
49
50
  onClick: removeSyncedBlock(api),
50
51
  icon: DeleteIcon,
51
- testId: fg('platform_synced_block_dogfooding') ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete : undefined
52
- }, hoverDecorationProps(nodeType, fg('platform_synced_block_dogfooding') ? undefined : akEditorSelectedNodeClassName));
52
+ testId: SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
53
+ }, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
53
54
  items.push(deleteButton);
54
55
  } else {
55
- if (!isErroredBlock && fg('platform_synced_block_dogfooding')) {
56
+ if (!isErroredBlock) {
56
57
  var syncedLocation = {
57
58
  type: 'custom',
58
59
  fallback: [],
@@ -62,7 +63,8 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
62
63
  resourceId: resourceId,
63
64
  localId: localId,
64
65
  intl: intl,
65
- isSource: isBodiedSyncBlock
66
+ isSource: isBodiedSyncBlock,
67
+ api: api
66
68
  });
67
69
  }
68
70
  };
@@ -78,7 +80,8 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
78
80
  title: formatMessage(messages.unsyncButton),
79
81
  onClick: function onClick() {
80
82
  return unsync(syncBlockStore, isBodiedSyncBlock, view);
81
- }
83
+ },
84
+ testId: fg('platform_synced_block_patch_1') ? isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceUnsync : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceUnsync : undefined
82
85
  });
83
86
  }
84
87
  };
@@ -92,7 +95,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
92
95
  title: formatMessage(messages.copySyncBlockLabel),
93
96
  showTitle: false,
94
97
  tooltipContent: formatMessage(messages.copySyncedBlockTooltip),
95
- onClick: copySyncedBlockReferenceToClipboard(syncBlockStore, api)
98
+ onClick: copySyncedBlockReferenceToClipboard(syncBlockStore, INPUT_METHOD.SYNCED_BLOCK_TB, api)
96
99
  }, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
97
100
  items.push(copyButton);
98
101
  var disabled = !syncBlockStore.referenceManager.getSyncBlockURL(syncBlockObject.node.attrs.resourceId);
@@ -122,7 +125,8 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
122
125
  onClick: removeSyncedBlock(api),
123
126
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
124
127
  label: ""
125
- })
128
+ }),
129
+ testId: fg('platform_synced_block_patch_1') ? isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete : undefined
126
130
  }, hoverDecorationProps(nodeType))]
127
131
  }];
128
132
  items.push.apply(items, overflowMenuConfig);
@@ -1,3 +1,4 @@
1
+ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
1
2
  import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
3
  import type { Command, EditorCommand, ExtractInjectionAPI, TypeAheadInsert } from '@atlaskit/editor-common/types';
3
4
  import { type Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -11,8 +12,8 @@ type createSyncedBlockProps = {
11
12
  typeAheadInsert?: TypeAheadInsert;
12
13
  };
13
14
  export declare const createSyncedBlock: ({ tr, syncBlockStore, typeAheadInsert, fireAnalyticsEvent, }: createSyncedBlockProps) => false | Transaction;
14
- export declare const copySyncedBlockReferenceToClipboardEditorCommand: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => EditorCommand;
15
- export declare const copySyncedBlockReferenceToClipboard: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
15
+ export declare const copySyncedBlockReferenceToClipboardEditorCommand: (syncBlockStore: SyncBlockStoreManager, inputMethod: INPUT_METHOD, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => EditorCommand;
16
+ export declare const copySyncedBlockReferenceToClipboard: (syncBlockStore: SyncBlockStoreManager, inputMethod: INPUT_METHOD, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
16
17
  export declare const editSyncedBlockSource: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
17
18
  export declare const removeSyncedBlock: (api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
18
19
  export declare const removeSyncedBlockAtPos: (api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, pos: number) => void;
@@ -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;
@@ -1,3 +1,4 @@
1
+ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
1
2
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
3
  import type { EditorCommand, ExtractInjectionAPI, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
4
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
@@ -64,7 +65,7 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
64
65
  flushSyncedBlocks: () => Promise<boolean>;
65
66
  };
66
67
  commands: {
67
- copySyncedBlockReferenceToClipboard: () => EditorCommand;
68
+ copySyncedBlockReferenceToClipboard: (inputMethod: INPUT_METHOD) => EditorCommand;
68
69
  insertSyncedBlock: () => EditorCommand;
69
70
  };
70
71
  dependencies: [
@@ -46,5 +46,9 @@ export declare const SYNCED_BLOCK_BUTTON_TEST_ID: {
46
46
  readonly blockMenuCreate: "create-synced-block-block-menu-btn";
47
47
  readonly quickInsertCreate: "create-synced-block-quick-insert-btn";
48
48
  readonly syncedBlockToolbarReferenceDelete: "reference-synced-block-delete-btn";
49
+ readonly syncedBlockToolbarSourceDelete: "source-synced-block-delete-btn";
50
+ readonly syncedBlockToolbarReferenceUnsync: "reference-synced-block-unsync-btn";
51
+ readonly syncedBlockToolbarSourceUnsync: "source-synced-block-unsync-btn";
52
+ readonly syncedBlockToolbarSyncedLocationsTrigger: "synced-block-synced-locations-dropdown--trigger";
49
53
  };
50
54
  export {};
@@ -1,6 +1,9 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import type { SyncBlockSourceInfo, SyncBlockStoreManager, ReferencesSourceInfo } from '@atlaskit/editor-synced-block-provider';
4
+ import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
3
5
  interface Props {
6
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
4
7
  intl: IntlShape;
5
8
  isSource: boolean;
6
9
  localId: string;
@@ -8,5 +11,5 @@ interface Props {
8
11
  syncBlockStore: SyncBlockStoreManager;
9
12
  }
10
13
  export declare const processReferenceData: (referenceData: ReferencesSourceInfo["references"], intl: IntlShape) => SyncBlockSourceInfo[];
11
- export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, }: Props) => JSX.Element;
14
+ export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, api, }: Props) => JSX.Element;
12
15
  export {};
@@ -1,3 +1,4 @@
1
+ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
1
2
  import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
3
  import type { Command, EditorCommand, ExtractInjectionAPI, TypeAheadInsert } from '@atlaskit/editor-common/types';
3
4
  import { type Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -11,8 +12,8 @@ type createSyncedBlockProps = {
11
12
  typeAheadInsert?: TypeAheadInsert;
12
13
  };
13
14
  export declare const createSyncedBlock: ({ tr, syncBlockStore, typeAheadInsert, fireAnalyticsEvent, }: createSyncedBlockProps) => false | Transaction;
14
- export declare const copySyncedBlockReferenceToClipboardEditorCommand: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => EditorCommand;
15
- export declare const copySyncedBlockReferenceToClipboard: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
15
+ export declare const copySyncedBlockReferenceToClipboardEditorCommand: (syncBlockStore: SyncBlockStoreManager, inputMethod: INPUT_METHOD, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => EditorCommand;
16
+ export declare const copySyncedBlockReferenceToClipboard: (syncBlockStore: SyncBlockStoreManager, inputMethod: INPUT_METHOD, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
16
17
  export declare const editSyncedBlockSource: (syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
17
18
  export declare const removeSyncedBlock: (api?: ExtractInjectionAPI<SyncedBlockPlugin>) => Command;
18
19
  export declare const removeSyncedBlockAtPos: (api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, pos: number) => void;
@@ -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;
@@ -1,3 +1,4 @@
1
+ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
1
2
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
3
  import type { EditorCommand, ExtractInjectionAPI, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
4
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
@@ -64,7 +65,7 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
64
65
  flushSyncedBlocks: () => Promise<boolean>;
65
66
  };
66
67
  commands: {
67
- copySyncedBlockReferenceToClipboard: () => EditorCommand;
68
+ copySyncedBlockReferenceToClipboard: (inputMethod: INPUT_METHOD) => EditorCommand;
68
69
  insertSyncedBlock: () => EditorCommand;
69
70
  };
70
71
  dependencies: [
@@ -46,5 +46,9 @@ export declare const SYNCED_BLOCK_BUTTON_TEST_ID: {
46
46
  readonly blockMenuCreate: "create-synced-block-block-menu-btn";
47
47
  readonly quickInsertCreate: "create-synced-block-quick-insert-btn";
48
48
  readonly syncedBlockToolbarReferenceDelete: "reference-synced-block-delete-btn";
49
+ readonly syncedBlockToolbarSourceDelete: "source-synced-block-delete-btn";
50
+ readonly syncedBlockToolbarReferenceUnsync: "reference-synced-block-unsync-btn";
51
+ readonly syncedBlockToolbarSourceUnsync: "source-synced-block-unsync-btn";
52
+ readonly syncedBlockToolbarSyncedLocationsTrigger: "synced-block-synced-locations-dropdown--trigger";
49
53
  };
50
54
  export {};
@@ -1,6 +1,9 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import type { SyncBlockSourceInfo, SyncBlockStoreManager, ReferencesSourceInfo } from '@atlaskit/editor-synced-block-provider';
4
+ import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
3
5
  interface Props {
6
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
4
7
  intl: IntlShape;
5
8
  isSource: boolean;
6
9
  localId: string;
@@ -8,5 +11,5 @@ interface Props {
8
11
  syncBlockStore: SyncBlockStoreManager;
9
12
  }
10
13
  export declare const processReferenceData: (referenceData: ReferencesSourceInfo["references"], intl: IntlShape) => SyncBlockSourceInfo[];
11
- export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, }: Props) => JSX.Element;
14
+ export declare const SyncedLocationDropdown: ({ syncBlockStore, resourceId, intl, isSource, localId, api, }: Props) => JSX.Element;
12
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "5.3.11",
3
+ "version": "5.3.13",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,16 +38,15 @@
38
38
  "@atlaskit/editor-plugin-decorations": "^7.0.0",
39
39
  "@atlaskit/editor-plugin-floating-toolbar": "^9.1.0",
40
40
  "@atlaskit/editor-plugin-selection": "^7.0.0",
41
- "@atlaskit/editor-prosemirror": "^7.2.0",
41
+ "@atlaskit/editor-prosemirror": "^7.3.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.10.0",
43
- "@atlaskit/editor-synced-block-provider": "^3.18.0",
44
- "@atlaskit/editor-tables": "^2.9.0",
43
+ "@atlaskit/editor-synced-block-provider": "^3.26.0",
45
44
  "@atlaskit/editor-toolbar": "^0.19.0",
46
45
  "@atlaskit/flag": "^17.8.0",
47
46
  "@atlaskit/icon": "30.0.2",
48
47
  "@atlaskit/icon-lab": "^5.15.0",
49
48
  "@atlaskit/logo": "^19.10.0",
50
- "@atlaskit/lozenge": "^13.3.0",
49
+ "@atlaskit/lozenge": "^13.4.0",
51
50
  "@atlaskit/modal-dialog": "^14.10.0",
52
51
  "@atlaskit/platform-feature-flags": "^1.1.0",
53
52
  "@atlaskit/primitives": "^18.0.0",
@@ -105,7 +104,7 @@
105
104
  }
106
105
  },
107
106
  "platform-feature-flags": {
108
- "platform_synced_block_dogfooding": {
107
+ "platform_synced_block_patch_1": {
109
108
  "type": "boolean"
110
109
  }
111
110
  }