@atlaskit/editor-plugin-synced-block 4.2.7 → 4.2.9

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 (60) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/afm-cc/tsconfig.json +9 -0
  3. package/afm-jira/tsconfig.json +10 -1
  4. package/afm-products/tsconfig.json +9 -0
  5. package/dist/cjs/nodeviews/bodiedSyncedBlock.js +27 -5
  6. package/dist/cjs/pm-plugins/main.js +83 -39
  7. package/dist/cjs/pm-plugins/utils/ignore-dom-event.js +30 -0
  8. package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +49 -1
  9. package/dist/cjs/pm-plugins/utils/utils.js +6 -2
  10. package/dist/cjs/syncedBlockPlugin.js +16 -1
  11. package/dist/cjs/types/index.js +12 -0
  12. package/dist/cjs/ui/CreateSyncedBlockButton.js +10 -5
  13. package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +13 -11
  14. package/dist/cjs/ui/CreateSyncedBlockItem.js +17 -15
  15. package/dist/cjs/ui/DeleteConfirmationModal.js +12 -2
  16. package/dist/cjs/ui/Flag.js +67 -0
  17. package/dist/cjs/ui/floating-toolbar.js +3 -2
  18. package/dist/es2019/nodeviews/bodiedSyncedBlock.js +18 -0
  19. package/dist/es2019/pm-plugins/main.js +89 -40
  20. package/dist/es2019/pm-plugins/utils/ignore-dom-event.js +26 -0
  21. package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +41 -0
  22. package/dist/es2019/pm-plugins/utils/utils.js +6 -2
  23. package/dist/es2019/syncedBlockPlugin.js +18 -2
  24. package/dist/es2019/types/index.js +6 -0
  25. package/dist/es2019/ui/CreateSyncedBlockButton.js +10 -4
  26. package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +13 -11
  27. package/dist/es2019/ui/CreateSyncedBlockItem.js +18 -14
  28. package/dist/es2019/ui/DeleteConfirmationModal.js +13 -2
  29. package/dist/es2019/ui/Flag.js +66 -0
  30. package/dist/es2019/ui/floating-toolbar.js +3 -2
  31. package/dist/esm/nodeviews/bodiedSyncedBlock.js +27 -5
  32. package/dist/esm/pm-plugins/main.js +85 -41
  33. package/dist/esm/pm-plugins/utils/ignore-dom-event.js +24 -0
  34. package/dist/esm/pm-plugins/utils/track-sync-blocks.js +48 -0
  35. package/dist/esm/pm-plugins/utils/utils.js +6 -2
  36. package/dist/esm/syncedBlockPlugin.js +17 -2
  37. package/dist/esm/types/index.js +6 -0
  38. package/dist/esm/ui/CreateSyncedBlockButton.js +10 -5
  39. package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +13 -11
  40. package/dist/esm/ui/CreateSyncedBlockItem.js +17 -15
  41. package/dist/esm/ui/DeleteConfirmationModal.js +12 -2
  42. package/dist/esm/ui/Flag.js +58 -0
  43. package/dist/esm/ui/floating-toolbar.js +3 -2
  44. package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +1 -1
  45. package/dist/types/pm-plugins/main.d.ts +4 -2
  46. package/dist/types/pm-plugins/utils/ignore-dom-event.d.ts +8 -0
  47. package/dist/types/pm-plugins/utils/track-sync-blocks.d.ts +5 -0
  48. package/dist/types/syncedBlockPluginType.d.ts +5 -1
  49. package/dist/types/types/index.d.ts +11 -0
  50. package/dist/types/ui/DeleteConfirmationModal.d.ts +4 -1
  51. package/dist/types/ui/Flag.d.ts +8 -0
  52. package/dist/types-ts4.5/nodeviews/bodiedSyncedBlock.d.ts +1 -1
  53. package/dist/types-ts4.5/pm-plugins/main.d.ts +4 -2
  54. package/dist/types-ts4.5/pm-plugins/utils/ignore-dom-event.d.ts +8 -0
  55. package/dist/types-ts4.5/pm-plugins/utils/track-sync-blocks.d.ts +5 -0
  56. package/dist/types-ts4.5/syncedBlockPluginType.d.ts +5 -1
  57. package/dist/types-ts4.5/types/index.d.ts +11 -0
  58. package/dist/types-ts4.5/ui/DeleteConfirmationModal.d.ts +4 -1
  59. package/dist/types-ts4.5/ui/Flag.d.ts +8 -0
  60. package/package.json +6 -3
@@ -5,16 +5,21 @@ import { syncBlockMessages } from '@atlaskit/editor-common/messages';
5
5
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import BlockSyncedIcon from '@atlaskit/icon-lab/core/block-synced';
7
7
  import Lozenge from '@atlaskit/lozenge';
8
- import { Flex } from '@atlaskit/primitives/compiled';
9
8
  import { canBeConvertedToSyncBlock } from '../pm-plugins/utils/utils';
10
9
  export var CreateSyncedBlockItem = function CreateSyncedBlockItem(_ref) {
11
10
  var api = _ref.api;
12
- var intl = useIntl();
13
- var selection = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
14
- var _states$selectionStat;
15
- return (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection;
16
- });
17
- var isDisabled = Boolean(!selection || !canBeConvertedToSyncBlock(selection));
11
+ var _useIntl = useIntl(),
12
+ formatMessage = _useIntl.formatMessage;
13
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection', 'connectivity'], function (states) {
14
+ var _states$selectionStat, _states$connectivityS;
15
+ return {
16
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
17
+ mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
18
+ };
19
+ }),
20
+ selection = _useSharedPluginState.selection,
21
+ mode = _useSharedPluginState.mode;
22
+ var isDisabled = Boolean(!selection || !canBeConvertedToSyncBlock(selection) || mode === 'offline');
18
23
  var onClick = useCallback(function () {
19
24
  var _api$core, _api$core2;
20
25
  api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
@@ -25,18 +30,15 @@ export var CreateSyncedBlockItem = function CreateSyncedBlockItem(_ref) {
25
30
  });
26
31
  api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.focus();
27
32
  }, [api]);
28
- var message = intl.formatMessage(syncBlockMessages.createSyncBlockLabel);
29
33
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
30
34
  onClick: onClick,
31
35
  isDisabled: isDisabled,
32
36
  elemBefore: /*#__PURE__*/React.createElement(BlockSyncedIcon, {
33
37
  size: "small",
34
38
  label: ""
35
- })
36
- }, /*#__PURE__*/React.createElement(Flex, {
37
- alignItems: "center",
38
- gap: "space.050"
39
- }, message, /*#__PURE__*/React.createElement(Lozenge, {
40
- appearance: "new"
41
- }, intl.formatMessage(syncBlockMessages.newLozenge))));
39
+ }),
40
+ elemAfter: /*#__PURE__*/React.createElement(Lozenge, {
41
+ appearance: "new"
42
+ }, formatMessage(syncBlockMessages.newLozenge))
43
+ }, formatMessage(syncBlockMessages.createSyncBlockLabel));
42
44
  };
@@ -2,11 +2,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
4
  import Button from '@atlaskit/button/new';
5
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
6
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
7
  import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
7
8
  import { Text } from '@atlaskit/primitives/compiled';
8
9
  export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
9
- var syncBlockStoreManager = _ref.syncBlockStoreManager;
10
+ var syncBlockStoreManager = _ref.syncBlockStoreManager,
11
+ api = _ref.api;
10
12
  var _useState = useState(false),
11
13
  _useState2 = _slicedToArray(_useState, 2),
12
14
  isOpen = _useState2[0],
@@ -15,6 +17,13 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
15
17
  _useState4 = _slicedToArray(_useState3, 2),
16
18
  syncBlockCount = _useState4[0],
17
19
  setSyncBlockCount = _useState4[1];
20
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['connectivity'], function (states) {
21
+ var _states$connectivityS;
22
+ return {
23
+ mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
24
+ };
25
+ }),
26
+ mode = _useSharedPluginState.mode;
18
27
  var _useIntl = useIntl(),
19
28
  formatMessage = _useIntl.formatMessage;
20
29
  var resolverRef = React.useRef(undefined);
@@ -55,6 +64,7 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
55
64
  }, formatMessage(messages.deleteConfirmationModalCancelButton)), /*#__PURE__*/React.createElement(Button, {
56
65
  appearance: "warning",
57
66
  onClick: handleClose(true),
58
- autoFocus: true
67
+ autoFocus: true,
68
+ isDisabled: mode === 'offline'
59
69
  }, formatMessage(messages.deleteConfirmationModalDeleteButton)))));
60
70
  };
@@ -0,0 +1,58 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import React from 'react';
3
+ import { useIntl } from 'react-intl-next';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
+ import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
+ import AkFlag, { FlagGroup } from '@atlaskit/flag';
7
+ import StatusErrorIcon from '@atlaskit/icon/core/status-error';
8
+ import { syncedBlockPluginKey } from '../pm-plugins/main';
9
+ import { FLAG_ID } from '../types';
10
+ var flagMap = _defineProperty(_defineProperty(_defineProperty({}, FLAG_ID.CANNOT_DELETE_WHEN_OFFLINE, {
11
+ title: messages.failToDeleteTitle,
12
+ description: messages.failToDeleteWhenOfflineDescription
13
+ }), FLAG_ID.CANNOT_EDIT_WHEN_OFFLINE, {
14
+ title: messages.failToEditTitle,
15
+ description: messages.failToEditWhenOfflineDescription
16
+ }), FLAG_ID.CANNOT_CREATE_WHEN_OFFLINE, {
17
+ title: messages.failToCreateTitle,
18
+ description: messages.failToCreateWhenOfflineDescription
19
+ });
20
+ export var Flag = function Flag(_ref) {
21
+ var api = _ref.api;
22
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['syncedBlock'], function (states) {
23
+ var _states$syncedBlockSt;
24
+ return {
25
+ showFlag: (_states$syncedBlockSt = states.syncedBlockState) === null || _states$syncedBlockSt === void 0 ? void 0 : _states$syncedBlockSt.showFlag
26
+ };
27
+ }),
28
+ showFlag = _useSharedPluginState.showFlag;
29
+ var _useIntl = useIntl(),
30
+ formatMessage = _useIntl.formatMessage;
31
+ if (!showFlag) {
32
+ return;
33
+ }
34
+ var _flagMap$showFlag = flagMap[showFlag],
35
+ title = _flagMap$showFlag.title,
36
+ description = _flagMap$showFlag.description;
37
+ var onDismissed = function onDismissed() {
38
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
39
+ var tr = _ref2.tr;
40
+ tr.setMeta(syncedBlockPluginKey, {
41
+ showFlag: false
42
+ });
43
+ return tr;
44
+ });
45
+ api === null || api === void 0 || api.core.actions.focus();
46
+ };
47
+ return /*#__PURE__*/React.createElement(FlagGroup, null, /*#__PURE__*/React.createElement(AkFlag, {
48
+ onDismissed: onDismissed,
49
+ title: formatMessage(title),
50
+ description: formatMessage(description),
51
+ id: showFlag,
52
+ testId: showFlag,
53
+ icon: /*#__PURE__*/React.createElement(StatusErrorIcon, {
54
+ label: "",
55
+ color: "var(--ds-icon-danger, #C9372C)"
56
+ })
57
+ }));
58
+ };
@@ -11,7 +11,7 @@ import LinkExternalIcon from '@atlaskit/icon/core/link-external';
11
11
  import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
12
12
  import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
13
13
  export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore) {
14
- var _api$decorations;
14
+ var _api$decorations, _api$connectivity;
15
15
  var syncBlockObject = findSyncBlockOrBodiedSyncBlock(state.schema, state.selection);
16
16
  if (!syncBlockObject) {
17
17
  return;
@@ -83,6 +83,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
83
83
  nodeType: nodeType,
84
84
  items: items,
85
85
  scrollable: true,
86
- groupLabel: formatMessage(messages.syncBlockGroup)
86
+ groupLabel: formatMessage(messages.syncBlockGroup),
87
+ visible: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) !== 'offline'
87
88
  };
88
89
  };
@@ -14,8 +14,8 @@ export interface BodiedSyncBlockNodeViewProps extends ReactComponentProps {
14
14
  node: PMNode;
15
15
  pluginOptions: SyncedBlockPluginOptions | undefined;
16
16
  portalProviderAPI: PortalProviderAPI;
17
- view: EditorView;
18
17
  syncBlockStore: SyncBlockStoreManager;
18
+ view: EditorView;
19
19
  }
20
20
  export interface BodiedSyncBlockNodeViewProperties {
21
21
  api?: ExtractInjectionAPI<SyncedBlockPlugin>;
@@ -1,12 +1,14 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
6
6
  import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
7
+ import { FLAG_ID } from '../types';
7
8
  export declare const syncedBlockPluginKey: PluginKey<any>;
8
9
  type SyncedBlockPluginState = {
9
- decorationSet: DecorationSet;
10
+ selectionDecorationSet: DecorationSet;
11
+ showFlag: FLAG_ID | false;
10
12
  };
11
13
  export declare const createPlugin: (options: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => SafePlugin<SyncedBlockPluginState>;
12
14
  export {};
@@ -0,0 +1,8 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { SyncedBlockPlugin } from '../../syncedBlockPluginType';
4
+ /**
5
+ *
6
+ * @returns true if should ignore event happens within bodiedSyncBlock node when offline
7
+ */
8
+ export declare const shouldIgnoreDomEvent: (view: EditorView, event: MouseEvent | PointerEvent, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined) => true | undefined;
@@ -5,3 +5,8 @@ export declare const trackSyncBlocks: (storeManager: SyncBlockStoreManager, tr:
5
5
  removed: SyncBlockAttrs[];
6
6
  added: SyncBlockAttrs[];
7
7
  };
8
+ /**
9
+ *
10
+ * @returns true if steps modifies children node within bodiedSyncBlock
11
+ */
12
+ export declare const hasEditInSyncBlock: (tr: Transaction, state: EditorState) => boolean;
@@ -4,12 +4,14 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
5
  import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
6
6
  import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
7
+ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
7
8
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
8
9
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
9
10
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
10
11
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
11
12
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
12
13
  import type { SyncBlockDataProvider, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
14
+ import type { SyncedBlockSharedState } from './types';
13
15
  export type SyncedBlockEditorProps = {
14
16
  defaultDocument: JSONDocNode;
15
17
  onChange: (editorView: EditorView, meta: {
@@ -61,9 +63,11 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
61
63
  OptionalPlugin<BlockControlsPlugin>,
62
64
  OptionalPlugin<ToolbarPlugin>,
63
65
  OptionalPlugin<BlockMenuPlugin>,
64
- OptionalPlugin<AnalyticsPlugin>
66
+ OptionalPlugin<AnalyticsPlugin>,
67
+ OptionalPlugin<ConnectivityPlugin>
65
68
  ];
66
69
  pluginConfiguration: SyncedBlockPluginOptions | undefined;
70
+ sharedState: SyncedBlockSharedState | undefined;
67
71
  }>;
68
72
  export type SyncBlockAttrs = {
69
73
  localId: string;
@@ -0,0 +1,11 @@
1
+ export declare enum FLAG_ID {
2
+ CANNOT_DELETE_WHEN_OFFLINE = "cannot-delete-when-offline",
3
+ CANNOT_EDIT_WHEN_OFFLINE = "cannot-edit-when-offline",
4
+ CANNOT_CREATE_WHEN_OFFLINE = "cannot-create-when-offline"
5
+ }
6
+ export type SyncedBlockSharedState = {
7
+ /**
8
+ * Whether to show a flag (usually for errors, e.g. fail to delete)
9
+ */
10
+ showFlag: FLAG_ID | false;
11
+ };
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
3
- export declare const DeleteConfirmationModal: ({ syncBlockStoreManager, }: {
4
+ import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
5
+ export declare const DeleteConfirmationModal: ({ syncBlockStoreManager, api, }: {
6
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
4
7
  syncBlockStoreManager: SyncBlockStoreManager;
5
8
  }) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
4
+ type Props = {
5
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
6
+ };
7
+ export declare const Flag: ({ api }: Props) => React.JSX.Element | undefined;
8
+ export {};
@@ -14,8 +14,8 @@ export interface BodiedSyncBlockNodeViewProps extends ReactComponentProps {
14
14
  node: PMNode;
15
15
  pluginOptions: SyncedBlockPluginOptions | undefined;
16
16
  portalProviderAPI: PortalProviderAPI;
17
- view: EditorView;
18
17
  syncBlockStore: SyncBlockStoreManager;
18
+ view: EditorView;
19
19
  }
20
20
  export interface BodiedSyncBlockNodeViewProperties {
21
21
  api?: ExtractInjectionAPI<SyncedBlockPlugin>;
@@ -1,12 +1,14 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
6
6
  import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
7
+ import { FLAG_ID } from '../types';
7
8
  export declare const syncedBlockPluginKey: PluginKey<any>;
8
9
  type SyncedBlockPluginState = {
9
- decorationSet: DecorationSet;
10
+ selectionDecorationSet: DecorationSet;
11
+ showFlag: FLAG_ID | false;
10
12
  };
11
13
  export declare const createPlugin: (options: SyncedBlockPluginOptions | undefined, pmPluginFactoryParams: PMPluginFactoryParams, syncBlockStore: SyncBlockStoreManager, api?: ExtractInjectionAPI<SyncedBlockPlugin>) => SafePlugin<SyncedBlockPluginState>;
12
14
  export {};
@@ -0,0 +1,8 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { SyncedBlockPlugin } from '../../syncedBlockPluginType';
4
+ /**
5
+ *
6
+ * @returns true if should ignore event happens within bodiedSyncBlock node when offline
7
+ */
8
+ export declare const shouldIgnoreDomEvent: (view: EditorView, event: MouseEvent | PointerEvent, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined) => true | undefined;
@@ -5,3 +5,8 @@ export declare const trackSyncBlocks: (storeManager: SyncBlockStoreManager, tr:
5
5
  removed: SyncBlockAttrs[];
6
6
  added: SyncBlockAttrs[];
7
7
  };
8
+ /**
9
+ *
10
+ * @returns true if steps modifies children node within bodiedSyncBlock
11
+ */
12
+ export declare const hasEditInSyncBlock: (tr: Transaction, state: EditorState) => boolean;
@@ -4,12 +4,14 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
5
  import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
6
6
  import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
7
+ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
7
8
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
8
9
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
9
10
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
10
11
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
11
12
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
12
13
  import type { SyncBlockDataProvider, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
14
+ import type { SyncedBlockSharedState } from './types';
13
15
  export type SyncedBlockEditorProps = {
14
16
  defaultDocument: JSONDocNode;
15
17
  onChange: (editorView: EditorView, meta: {
@@ -61,9 +63,11 @@ export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
61
63
  OptionalPlugin<BlockControlsPlugin>,
62
64
  OptionalPlugin<ToolbarPlugin>,
63
65
  OptionalPlugin<BlockMenuPlugin>,
64
- OptionalPlugin<AnalyticsPlugin>
66
+ OptionalPlugin<AnalyticsPlugin>,
67
+ OptionalPlugin<ConnectivityPlugin>
65
68
  ];
66
69
  pluginConfiguration: SyncedBlockPluginOptions | undefined;
70
+ sharedState: SyncedBlockSharedState | undefined;
67
71
  }>;
68
72
  export type SyncBlockAttrs = {
69
73
  localId: string;
@@ -0,0 +1,11 @@
1
+ export declare enum FLAG_ID {
2
+ CANNOT_DELETE_WHEN_OFFLINE = "cannot-delete-when-offline",
3
+ CANNOT_EDIT_WHEN_OFFLINE = "cannot-edit-when-offline",
4
+ CANNOT_CREATE_WHEN_OFFLINE = "cannot-create-when-offline"
5
+ }
6
+ export type SyncedBlockSharedState = {
7
+ /**
8
+ * Whether to show a flag (usually for errors, e.g. fail to delete)
9
+ */
10
+ showFlag: FLAG_ID | false;
11
+ };
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
3
  import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
3
- export declare const DeleteConfirmationModal: ({ syncBlockStoreManager, }: {
4
+ import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
5
+ export declare const DeleteConfirmationModal: ({ syncBlockStoreManager, api, }: {
6
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
4
7
  syncBlockStoreManager: SyncBlockStoreManager;
5
8
  }) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
4
+ type Props = {
5
+ api?: ExtractInjectionAPI<SyncedBlockPlugin>;
6
+ };
7
+ export declare const Flag: ({ api }: Props) => React.JSX.Element | undefined;
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "4.2.7",
3
+ "version": "4.2.9",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,27 +33,30 @@
33
33
  "@atlaskit/editor-json-transformer": "^8.31.0",
34
34
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
35
35
  "@atlaskit/editor-plugin-block-menu": "^5.0.0",
36
+ "@atlaskit/editor-plugin-connectivity": "6.0.0",
36
37
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
37
38
  "@atlaskit/editor-plugin-floating-toolbar": "^8.2.0",
38
39
  "@atlaskit/editor-plugin-selection": "^6.1.0",
39
40
  "@atlaskit/editor-prosemirror": "7.0.0",
40
41
  "@atlaskit/editor-shared-styles": "^3.9.0",
41
- "@atlaskit/editor-synced-block-provider": "^2.8.0",
42
+ "@atlaskit/editor-synced-block-provider": "^2.9.0",
42
43
  "@atlaskit/editor-tables": "^2.9.0",
43
44
  "@atlaskit/editor-toolbar": "^0.17.0",
45
+ "@atlaskit/flag": "^17.5.0",
44
46
  "@atlaskit/icon": "29.0.0",
45
47
  "@atlaskit/icon-lab": "^5.12.0",
46
48
  "@atlaskit/logo": "^19.9.0",
47
49
  "@atlaskit/lozenge": "^13.1.0",
48
50
  "@atlaskit/modal-dialog": "^14.7.0",
49
51
  "@atlaskit/primitives": "^16.1.0",
52
+ "@atlaskit/tokens": "8.0.0",
50
53
  "@atlaskit/tooltip": "^20.8.0",
51
54
  "@atlaskit/visually-hidden": "^3.0.0",
52
55
  "@babel/runtime": "^7.0.0",
53
56
  "react-intl-next": "npm:react-intl@^5.18.1"
54
57
  },
55
58
  "peerDependencies": {
56
- "@atlaskit/editor-common": "^110.29.0",
59
+ "@atlaskit/editor-common": "^110.31.0",
57
60
  "react": "^18.2.0"
58
61
  },
59
62
  "devDependencies": {