@atlaskit/editor-synced-block-provider 2.10.2 → 2.10.3

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 (79) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/{providers → clients}/block-service/ari.js +2 -2
  3. package/dist/cjs/{utils → clients/confluence}/ari.js +5 -5
  4. package/dist/cjs/{utils → clients/confluence}/sourceInfo.js +7 -7
  5. package/dist/cjs/clients/confluence/utils.js +9 -0
  6. package/dist/cjs/hooks/useFetchSyncBlockData.js +5 -6
  7. package/dist/cjs/hooks/useFetchSyncBlockTitle.js +1 -1
  8. package/dist/cjs/hooks/useHandleContentChanges.js +1 -1
  9. package/dist/cjs/index.js +27 -14
  10. package/dist/cjs/providers/block-service/blockServiceAPI.js +4 -4
  11. package/dist/cjs/providers/confluence/confluenceContentAPI.js +12 -12
  12. package/dist/cjs/providers/syncBlockProvider.js +14 -9
  13. package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +35 -9
  14. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +52 -10
  15. package/dist/cjs/store-manager/syncBlockStoreManager.js +14 -158
  16. package/dist/cjs/utils/utils.js +8 -4
  17. package/dist/es2019/{providers → clients}/block-service/ari.js +1 -1
  18. package/dist/es2019/{utils → clients/confluence}/ari.js +4 -4
  19. package/dist/es2019/{utils → clients/confluence}/sourceInfo.js +5 -5
  20. package/dist/es2019/clients/confluence/utils.js +3 -0
  21. package/dist/es2019/hooks/useFetchSyncBlockData.js +5 -6
  22. package/dist/es2019/hooks/useFetchSyncBlockTitle.js +1 -1
  23. package/dist/es2019/hooks/useHandleContentChanges.js +1 -1
  24. package/dist/es2019/index.js +14 -4
  25. package/dist/es2019/providers/block-service/blockServiceAPI.js +4 -4
  26. package/dist/es2019/providers/confluence/confluenceContentAPI.js +12 -12
  27. package/dist/es2019/providers/syncBlockProvider.js +14 -9
  28. package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +24 -0
  29. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +39 -1
  30. package/dist/es2019/store-manager/syncBlockStoreManager.js +12 -119
  31. package/dist/es2019/utils/utils.js +3 -3
  32. package/dist/esm/{providers → clients}/block-service/ari.js +1 -1
  33. package/dist/esm/{utils → clients/confluence}/ari.js +4 -4
  34. package/dist/esm/{utils → clients/confluence}/sourceInfo.js +7 -7
  35. package/dist/esm/clients/confluence/utils.js +3 -0
  36. package/dist/esm/hooks/useFetchSyncBlockData.js +5 -6
  37. package/dist/esm/hooks/useFetchSyncBlockTitle.js +1 -1
  38. package/dist/esm/hooks/useHandleContentChanges.js +1 -1
  39. package/dist/esm/index.js +14 -4
  40. package/dist/esm/providers/block-service/blockServiceAPI.js +4 -4
  41. package/dist/esm/providers/confluence/confluenceContentAPI.js +12 -12
  42. package/dist/esm/providers/syncBlockProvider.js +14 -9
  43. package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +36 -9
  44. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +52 -10
  45. package/dist/esm/store-manager/syncBlockStoreManager.js +14 -159
  46. package/dist/esm/utils/utils.js +7 -3
  47. package/dist/types/{providers → clients}/block-service/ari.d.ts +1 -1
  48. package/dist/types/{utils → clients/block-service}/blockService.d.ts +1 -1
  49. package/dist/types/clients/confluence/ari.d.ts +9 -0
  50. package/dist/types/{utils → clients/confluence}/contentProperty.d.ts +1 -1
  51. package/dist/types/clients/confluence/sourceInfo.d.ts +2 -0
  52. package/dist/types/clients/confluence/utils.d.ts +2 -0
  53. package/dist/types/index.d.ts +4 -3
  54. package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +5 -0
  55. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +17 -1
  56. package/dist/types/store-manager/syncBlockStoreManager.d.ts +4 -59
  57. package/dist/types/utils/utils.d.ts +1 -2
  58. package/dist/types-ts4.5/{providers → clients}/block-service/ari.d.ts +1 -1
  59. package/dist/types-ts4.5/{utils → clients/block-service}/blockService.d.ts +1 -1
  60. package/dist/types-ts4.5/clients/confluence/ari.d.ts +9 -0
  61. package/dist/types-ts4.5/{utils → clients/confluence}/contentProperty.d.ts +1 -1
  62. package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +2 -0
  63. package/dist/types-ts4.5/clients/confluence/utils.d.ts +2 -0
  64. package/dist/types-ts4.5/index.d.ts +4 -3
  65. package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +5 -0
  66. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +17 -1
  67. package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +4 -59
  68. package/dist/types-ts4.5/utils/utils.d.ts +1 -2
  69. package/package.json +2 -2
  70. package/dist/types/utils/ari.d.ts +0 -9
  71. package/dist/types/utils/sourceInfo.d.ts +0 -2
  72. package/dist/types-ts4.5/utils/ari.d.ts +0 -9
  73. package/dist/types-ts4.5/utils/sourceInfo.d.ts +0 -2
  74. /package/dist/cjs/{utils → clients/block-service}/blockService.js +0 -0
  75. /package/dist/cjs/{utils → clients/confluence}/contentProperty.js +0 -0
  76. /package/dist/es2019/{utils → clients/block-service}/blockService.js +0 -0
  77. /package/dist/es2019/{utils → clients/confluence}/contentProperty.js +0 -0
  78. /package/dist/esm/{utils → clients/block-service}/blockService.js +0 -0
  79. /package/dist/esm/{utils → clients/confluence}/contentProperty.js +0 -0
@@ -17,6 +17,11 @@ export declare class ReferenceSyncBlockStoreManager {
17
17
  */
18
18
  refreshSubscriptions(): Promise<void>;
19
19
  private retrieveSyncBlockSourceInfo;
20
+ /**
21
+ * Fetch sync block data for a given array of sync block nodes.
22
+ * @param syncBlockNodes - The array of sync block nodes to fetch data for
23
+ * @returns The fetched sync block data results
24
+ */
20
25
  fetchSyncBlocksData(syncBlockNodes: SyncBlockNode[]): Promise<SyncBlockInstance[]>;
21
26
  private updateCache;
22
27
  private updateSourceTitleSubscriptions;
@@ -14,6 +14,7 @@ export declare class SourceSyncBlockStoreManager {
14
14
  private pendingResourceId?;
15
15
  private creationCallback?;
16
16
  constructor(dataProvider?: SyncBlockDataProvider);
17
+ isSourceBlock(node: PMNode): boolean;
17
18
  /**
18
19
  * Add/update a sync block node to/from the local cache
19
20
  * @param syncBlockNode - The sync block node to update
@@ -24,21 +25,36 @@ export declare class SourceSyncBlockStoreManager {
24
25
  *
25
26
  * @returns true if saving all nodes successfully, false if fail to save some/all nodes
26
27
  */
27
- flushBodiedSyncBlocks(): Promise<boolean>;
28
+ flush(): Promise<boolean>;
28
29
  setEditorView(editorView: EditorView | undefined): void;
29
30
  registerPendingCreation(resourceId: ResourceId): void;
31
+ /**
32
+ * Register callback function (which inserts node, handles focus etc) to be used later when creation to backend succeed
33
+ */
30
34
  registerCreationCallback(callback: CreationCallback): void;
31
35
  /**
32
36
  * Fires callback to insert node (if creation is successful) and clears pending creation data
33
37
  * @param success
34
38
  */
35
39
  commitPendingCreation(success: boolean): void;
40
+ /**
41
+ *
42
+ * @returns true if waiting for the result of saving new bodiedSyncBlock to backend
43
+ */
36
44
  hasPendingCreation(): boolean;
37
45
  registerConfirmationCallback(callback: ConfirmationCallback): () => void;
38
46
  requireConfirmationBeforeDelete(): boolean;
47
+ /**
48
+ * @returns attributes for a new bodiedSyncBlock node
49
+ */
39
50
  generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
51
+ /**
52
+ * Create a bodiedSyncBlock node with empty content to backend
53
+ * @param attrs attributes Ids of the node
54
+ */
40
55
  createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
41
56
  private setPendingDeletion;
42
57
  deleteSyncBlocksWithConfirmation(tr: Transaction, syncBlockIds: SyncBlockAttrs[]): Promise<void>;
43
58
  rebaseTransaction(incomingTr: Transaction, state: EditorState): void;
59
+ destroy(): void;
44
60
  }
@@ -1,66 +1,11 @@
1
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
3
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
- import type { ResourceId, SyncBlockAttrs } from '../common/types';
6
- import type { SubscriptionCallback, SyncBlockDataProvider, SyncBlockInstance, TitleSubscriptionCallback } from '../providers/types';
1
+ import type { SyncBlockDataProvider } from '../providers/types';
7
2
  import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
8
- import { type ConfirmationCallback, type CreationCallback } from './sourceSyncBlockStoreManager';
3
+ import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
9
4
  export declare class SyncBlockStoreManager {
10
5
  private referenceSyncBlockStoreManager;
11
6
  private sourceSyncBlockStoreManager;
12
7
  constructor(dataProvider?: SyncBlockDataProvider);
13
- /**
14
- * Fetch sync block data for a given array of sync block nodes.
15
- * @param nodes - The array of sync block nodes to fetch data for
16
- * @returns The fetched sync block data results
17
- */
18
- fetchSyncBlocksData(nodes: PMNode[]): Promise<SyncBlockInstance[]>;
19
- getReferenceSyncBlockStoreManager(): ReferenceSyncBlockStoreManager;
20
- /**
21
- * Add/update a sync block node to/from the local cache
22
- * @param syncBlockNode - The sync block node to update
23
- */
24
- updateSyncBlockData(syncBlockNode: PMNode): boolean;
25
- /**
26
- * Save content of bodiedSyncBlock nodes in local cache to backend
27
- *
28
- * @returns true if saving all nodes successfully, false if fail to save some/all nodes
29
- */
30
- flushBodiedSyncBlocks(): Promise<boolean>;
31
- /**
32
- * Get the URL for a sync block.
33
- * @param resourceId - The resource ID of the sync block to get the URL for
34
- * @returns
35
- */
36
- getSyncBlockURL(resourceId: ResourceId): string | undefined;
37
- setEditorView(editorView: EditorView | undefined): void;
38
- isSourceBlock(node: PMNode): boolean;
39
- registerConfirmationCallback(callback: ConfirmationCallback): () => void;
40
- requireConfirmationBeforeDelete(): boolean;
41
- /**
42
- * Register callback function (which inserts node, handles focus etc) to be used later when creation to backend succeed
43
- */
44
- registerCreationCallback(callback: CreationCallback): void;
45
- /**
46
- *
47
- * @returns true if waiting for the result of saving new bodiedSyncBlock to backend
48
- */
49
- hasPendingCreation(): boolean;
50
- /**
51
- * @returns attributes for a new bodiedSyncBlock node
52
- */
53
- generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
54
- /**
55
- * Save bodiedSyncBlock with empty content to backend
56
- * @param attrs attributes Ids of the node
57
- */
58
- createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
59
- subscribeToSyncBlockData(node: PMNode, callback: SubscriptionCallback): () => void;
60
- subscribeToSyncBlockSourceTitle(node: PMNode, callback: TitleSubscriptionCallback): () => void;
61
- refreshSubscriptions(): void;
62
- deleteSyncBlocksWithConfirmation(tr: Transaction, syncBlockIds: SyncBlockAttrs[]): Promise<void>;
63
- rebaseTransaction(incomingTr: Transaction, state: EditorState): void;
64
- getReferenceSyncBlockProviderFactory(resourceId: ResourceId): ProviderFactory | undefined;
8
+ get referenceManager(): ReferenceSyncBlockStoreManager;
9
+ get sourceManager(): SourceSyncBlockStoreManager;
65
10
  destroy(): void;
66
11
  }
@@ -1,10 +1,9 @@
1
1
  import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode } from '../common/types';
4
- import type { PAGE_TYPE } from './ari';
5
4
  export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
6
- export declare const isBlogPageType: (pageType: PAGE_TYPE) => boolean;
7
5
  export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
8
6
  export declare const createBodiedSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
9
7
  export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
10
8
  export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
9
+ export declare const convertPMNodesToSyncBlockNodes: (nodes: PMNode[]) => SyncBlockNode[];
@@ -10,4 +10,4 @@ export declare const blockResourceIdFromSourceAndLocalId: (sourceId: string, loc
10
10
  * @param ari - the block ARI. E.G ari:cloud:blocks:cloudId:synced-block/localId
11
11
  * @returns the localId of the block node. A randomly generated UUID
12
12
  */
13
- export declare const getLocalIdFromResourceId: (ari: string) => string;
13
+ export declare const getLocalIdFromBlockResourceId: (ari: string) => string;
@@ -1,4 +1,4 @@
1
- import type { SyncBlockProduct } from '../common/types';
1
+ import type { SyncBlockProduct } from '../../common/types';
2
2
  export type BlockContentResponse = {
3
3
  blockAri: string;
4
4
  blockInstanceId: string;
@@ -0,0 +1,9 @@
1
+ export type PAGE_TYPE = 'page' | 'blogpost';
2
+ export declare const getConfluencePageAri: (pageId: string, cloudId: string, pageType?: PAGE_TYPE) => string;
3
+ export declare const getPageIdAndTypeFromConfluencePageAri: (ari: string) => {
4
+ id: string;
5
+ type: PAGE_TYPE;
6
+ };
7
+ export declare const getLocalIdFromConfluencePageAri: (ari: string) => string;
8
+ export declare const getPageARIFromContentPropertyResourceId: (resourceId: string) => string;
9
+ export declare const resourceIdFromConfluencePageSourceIdAndLocalId: (sourceId: string, localId: string) => string;
@@ -1,4 +1,4 @@
1
- import type { SyncBlockData } from '../common/types';
1
+ import type { SyncBlockData } from '../../common/types';
2
2
  import { type PAGE_TYPE } from './ari';
3
3
  type GetContentPropertyOptions = {
4
4
  cloudId: string;
@@ -0,0 +1,2 @@
1
+ import type { SyncBlockSourceInfo } from '../../providers/types';
2
+ export declare const fetchConfluenceSourceInfo: (pageAri: string, localId?: string) => Promise<SyncBlockSourceInfo | undefined>;
@@ -0,0 +1,2 @@
1
+ import type { PAGE_TYPE } from './ari';
2
+ export declare const isBlogPageType: (pageType: PAGE_TYPE) => boolean;
@@ -4,13 +4,14 @@ export type { SyncBlockData, SyncBlockNode } from './common/types';
4
4
  export { useFetchSyncBlockData, type UseFetchSyncBlockDataResult, } from './hooks/useFetchSyncBlockData';
5
5
  export { useFetchSyncBlockTitle } from './hooks/useFetchSyncBlockTitle';
6
6
  export { useHandleContentChanges } from './hooks/useHandleContentChanges';
7
- export { blockResourceIdFromSourceAndLocalId, getLocalIdFromResourceId, } from './providers/block-service/ari';
7
+ export { blockResourceIdFromSourceAndLocalId, getLocalIdFromBlockResourceId, } from './clients/block-service/ari';
8
+ export { getConfluencePageAri, getLocalIdFromConfluencePageAri, getPageARIFromContentPropertyResourceId, getPageIdAndTypeFromConfluencePageAri, resourceIdFromConfluencePageSourceIdAndLocalId, } from './clients/confluence/ari';
8
9
  export { useMemoizedBlockServiceAPIProviders } from './providers/block-service/blockServiceAPI';
9
10
  export { createContentAPIProvidersWithDefaultKey, useMemoizedContentAPIProviders, } from './providers/confluence/confluenceContentAPI';
11
+ export { fetchConfluenceSourceInfo } from './clients/confluence/sourceInfo';
10
12
  export { SyncBlockProvider as SyncedBlockProvider, useMemoizedSyncedBlockProvider, } from './providers/syncBlockProvider';
11
13
  export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlockInstance, MediaEmojiProviderOptions, SyncedBlockRendererProviderOptions, SyncBlockRendererProviderCreator, } from './providers/types';
12
14
  export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
13
15
  export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
14
- export { getConfluencePageAri, getLocalIdFromAri, getPageARIFromResourceId, getPageIdAndTypeFromAri, resourceIdFromSourceAndLocalId, } from './utils/ari';
15
- export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, } from './utils/utils';
16
16
  export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
17
+ export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, } from './utils/utils';
@@ -17,6 +17,11 @@ export declare class ReferenceSyncBlockStoreManager {
17
17
  */
18
18
  refreshSubscriptions(): Promise<void>;
19
19
  private retrieveSyncBlockSourceInfo;
20
+ /**
21
+ * Fetch sync block data for a given array of sync block nodes.
22
+ * @param syncBlockNodes - The array of sync block nodes to fetch data for
23
+ * @returns The fetched sync block data results
24
+ */
20
25
  fetchSyncBlocksData(syncBlockNodes: SyncBlockNode[]): Promise<SyncBlockInstance[]>;
21
26
  private updateCache;
22
27
  private updateSourceTitleSubscriptions;
@@ -14,6 +14,7 @@ export declare class SourceSyncBlockStoreManager {
14
14
  private pendingResourceId?;
15
15
  private creationCallback?;
16
16
  constructor(dataProvider?: SyncBlockDataProvider);
17
+ isSourceBlock(node: PMNode): boolean;
17
18
  /**
18
19
  * Add/update a sync block node to/from the local cache
19
20
  * @param syncBlockNode - The sync block node to update
@@ -24,21 +25,36 @@ export declare class SourceSyncBlockStoreManager {
24
25
  *
25
26
  * @returns true if saving all nodes successfully, false if fail to save some/all nodes
26
27
  */
27
- flushBodiedSyncBlocks(): Promise<boolean>;
28
+ flush(): Promise<boolean>;
28
29
  setEditorView(editorView: EditorView | undefined): void;
29
30
  registerPendingCreation(resourceId: ResourceId): void;
31
+ /**
32
+ * Register callback function (which inserts node, handles focus etc) to be used later when creation to backend succeed
33
+ */
30
34
  registerCreationCallback(callback: CreationCallback): void;
31
35
  /**
32
36
  * Fires callback to insert node (if creation is successful) and clears pending creation data
33
37
  * @param success
34
38
  */
35
39
  commitPendingCreation(success: boolean): void;
40
+ /**
41
+ *
42
+ * @returns true if waiting for the result of saving new bodiedSyncBlock to backend
43
+ */
36
44
  hasPendingCreation(): boolean;
37
45
  registerConfirmationCallback(callback: ConfirmationCallback): () => void;
38
46
  requireConfirmationBeforeDelete(): boolean;
47
+ /**
48
+ * @returns attributes for a new bodiedSyncBlock node
49
+ */
39
50
  generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
51
+ /**
52
+ * Create a bodiedSyncBlock node with empty content to backend
53
+ * @param attrs attributes Ids of the node
54
+ */
40
55
  createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
41
56
  private setPendingDeletion;
42
57
  deleteSyncBlocksWithConfirmation(tr: Transaction, syncBlockIds: SyncBlockAttrs[]): Promise<void>;
43
58
  rebaseTransaction(incomingTr: Transaction, state: EditorState): void;
59
+ destroy(): void;
44
60
  }
@@ -1,66 +1,11 @@
1
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
3
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
- import type { ResourceId, SyncBlockAttrs } from '../common/types';
6
- import type { SubscriptionCallback, SyncBlockDataProvider, SyncBlockInstance, TitleSubscriptionCallback } from '../providers/types';
1
+ import type { SyncBlockDataProvider } from '../providers/types';
7
2
  import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
8
- import { type ConfirmationCallback, type CreationCallback } from './sourceSyncBlockStoreManager';
3
+ import { SourceSyncBlockStoreManager } from './sourceSyncBlockStoreManager';
9
4
  export declare class SyncBlockStoreManager {
10
5
  private referenceSyncBlockStoreManager;
11
6
  private sourceSyncBlockStoreManager;
12
7
  constructor(dataProvider?: SyncBlockDataProvider);
13
- /**
14
- * Fetch sync block data for a given array of sync block nodes.
15
- * @param nodes - The array of sync block nodes to fetch data for
16
- * @returns The fetched sync block data results
17
- */
18
- fetchSyncBlocksData(nodes: PMNode[]): Promise<SyncBlockInstance[]>;
19
- getReferenceSyncBlockStoreManager(): ReferenceSyncBlockStoreManager;
20
- /**
21
- * Add/update a sync block node to/from the local cache
22
- * @param syncBlockNode - The sync block node to update
23
- */
24
- updateSyncBlockData(syncBlockNode: PMNode): boolean;
25
- /**
26
- * Save content of bodiedSyncBlock nodes in local cache to backend
27
- *
28
- * @returns true if saving all nodes successfully, false if fail to save some/all nodes
29
- */
30
- flushBodiedSyncBlocks(): Promise<boolean>;
31
- /**
32
- * Get the URL for a sync block.
33
- * @param resourceId - The resource ID of the sync block to get the URL for
34
- * @returns
35
- */
36
- getSyncBlockURL(resourceId: ResourceId): string | undefined;
37
- setEditorView(editorView: EditorView | undefined): void;
38
- isSourceBlock(node: PMNode): boolean;
39
- registerConfirmationCallback(callback: ConfirmationCallback): () => void;
40
- requireConfirmationBeforeDelete(): boolean;
41
- /**
42
- * Register callback function (which inserts node, handles focus etc) to be used later when creation to backend succeed
43
- */
44
- registerCreationCallback(callback: CreationCallback): void;
45
- /**
46
- *
47
- * @returns true if waiting for the result of saving new bodiedSyncBlock to backend
48
- */
49
- hasPendingCreation(): boolean;
50
- /**
51
- * @returns attributes for a new bodiedSyncBlock node
52
- */
53
- generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
54
- /**
55
- * Save bodiedSyncBlock with empty content to backend
56
- * @param attrs attributes Ids of the node
57
- */
58
- createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
59
- subscribeToSyncBlockData(node: PMNode, callback: SubscriptionCallback): () => void;
60
- subscribeToSyncBlockSourceTitle(node: PMNode, callback: TitleSubscriptionCallback): () => void;
61
- refreshSubscriptions(): void;
62
- deleteSyncBlocksWithConfirmation(tr: Transaction, syncBlockIds: SyncBlockAttrs[]): Promise<void>;
63
- rebaseTransaction(incomingTr: Transaction, state: EditorState): void;
64
- getReferenceSyncBlockProviderFactory(resourceId: ResourceId): ProviderFactory | undefined;
8
+ get referenceManager(): ReferenceSyncBlockStoreManager;
9
+ get sourceManager(): SourceSyncBlockStoreManager;
65
10
  destroy(): void;
66
11
  }
@@ -1,10 +1,9 @@
1
1
  import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode } from '../common/types';
4
- import type { PAGE_TYPE } from './ari';
5
4
  export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
6
- export declare const isBlogPageType: (pageType: PAGE_TYPE) => boolean;
7
5
  export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
8
6
  export declare const createBodiedSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
9
7
  export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
10
8
  export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
9
+ export declare const convertPMNodesToSyncBlockNodes: (nodes: PMNode[]) => SyncBlockNode[];
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "uuid": "^3.1.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "@atlaskit/editor-common": "^110.32.0",
40
+ "@atlaskit/editor-common": "^110.33.0",
41
41
  "react": "^18.2.0"
42
42
  },
43
43
  "devDependencies": {
@@ -83,7 +83,7 @@
83
83
  }
84
84
  },
85
85
  "name": "@atlaskit/editor-synced-block-provider",
86
- "version": "2.10.2",
86
+ "version": "2.10.3",
87
87
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
88
88
  "author": "Atlassian Pty Ltd",
89
89
  "license": "Apache-2.0",
@@ -1,9 +0,0 @@
1
- export type PAGE_TYPE = 'page' | 'blogpost';
2
- export declare const getConfluencePageAri: (pageId: string, cloudId: string, pageType?: PAGE_TYPE) => string;
3
- export declare const getPageIdAndTypeFromAri: (ari: string) => {
4
- id: string;
5
- type: PAGE_TYPE;
6
- };
7
- export declare const getLocalIdFromAri: (ari: string) => string;
8
- export declare const getPageARIFromResourceId: (resourceId: string) => string;
9
- export declare const resourceIdFromSourceAndLocalId: (sourceId: string, localId: string) => string;
@@ -1,2 +0,0 @@
1
- import type { SyncBlockSourceInfo } from '../providers/types';
2
- export declare const fetchSourceInfo: (pageAri: string, localId?: string) => Promise<SyncBlockSourceInfo | undefined>;
@@ -1,9 +0,0 @@
1
- export type PAGE_TYPE = 'page' | 'blogpost';
2
- export declare const getConfluencePageAri: (pageId: string, cloudId: string, pageType?: PAGE_TYPE) => string;
3
- export declare const getPageIdAndTypeFromAri: (ari: string) => {
4
- id: string;
5
- type: PAGE_TYPE;
6
- };
7
- export declare const getLocalIdFromAri: (ari: string) => string;
8
- export declare const getPageARIFromResourceId: (resourceId: string) => string;
9
- export declare const resourceIdFromSourceAndLocalId: (sourceId: string, localId: string) => string;
@@ -1,2 +0,0 @@
1
- import type { SyncBlockSourceInfo } from '../providers/types';
2
- export declare const fetchSourceInfo: (pageAri: string, localId?: string) => Promise<SyncBlockSourceInfo | undefined>;