@atlaskit/editor-synced-block-provider 2.10.1 → 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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/{providers → clients}/block-service/ari.js +2 -2
- package/dist/cjs/{utils → clients/confluence}/ari.js +6 -6
- package/dist/cjs/{utils → clients/confluence}/sourceInfo.js +7 -7
- package/dist/cjs/clients/confluence/utils.js +9 -0
- package/dist/cjs/hooks/useFetchSyncBlockData.js +5 -6
- package/dist/cjs/hooks/useFetchSyncBlockTitle.js +1 -1
- package/dist/cjs/hooks/useHandleContentChanges.js +1 -1
- package/dist/cjs/index.js +27 -14
- package/dist/cjs/providers/block-service/blockServiceAPI.js +4 -4
- package/dist/cjs/providers/confluence/confluenceContentAPI.js +33 -26
- package/dist/cjs/providers/syncBlockProvider.js +38 -3
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +86 -19
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +52 -10
- package/dist/cjs/store-manager/syncBlockStoreManager.js +14 -157
- package/dist/cjs/utils/utils.js +8 -4
- package/dist/es2019/{providers → clients}/block-service/ari.js +1 -1
- package/dist/es2019/{utils → clients/confluence}/ari.js +5 -5
- package/dist/es2019/{utils → clients/confluence}/sourceInfo.js +5 -5
- package/dist/es2019/clients/confluence/utils.js +3 -0
- package/dist/es2019/hooks/useFetchSyncBlockData.js +5 -6
- package/dist/es2019/hooks/useFetchSyncBlockTitle.js +1 -1
- package/dist/es2019/hooks/useHandleContentChanges.js +1 -1
- package/dist/es2019/index.js +14 -4
- package/dist/es2019/providers/block-service/blockServiceAPI.js +4 -4
- package/dist/es2019/providers/confluence/confluenceContentAPI.js +19 -13
- package/dist/es2019/providers/syncBlockProvider.js +38 -3
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +75 -10
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +39 -1
- package/dist/es2019/store-manager/syncBlockStoreManager.js +12 -117
- package/dist/es2019/utils/utils.js +3 -3
- package/dist/esm/{providers → clients}/block-service/ari.js +1 -1
- package/dist/esm/{utils → clients/confluence}/ari.js +5 -5
- package/dist/esm/{utils → clients/confluence}/sourceInfo.js +7 -7
- package/dist/esm/clients/confluence/utils.js +3 -0
- package/dist/esm/hooks/useFetchSyncBlockData.js +5 -6
- package/dist/esm/hooks/useFetchSyncBlockTitle.js +1 -1
- package/dist/esm/hooks/useHandleContentChanges.js +1 -1
- package/dist/esm/index.js +14 -4
- package/dist/esm/providers/block-service/blockServiceAPI.js +4 -4
- package/dist/esm/providers/confluence/confluenceContentAPI.js +33 -26
- package/dist/esm/providers/syncBlockProvider.js +38 -3
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +87 -19
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +52 -10
- package/dist/esm/store-manager/syncBlockStoreManager.js +14 -157
- package/dist/esm/utils/utils.js +7 -3
- package/dist/types/{providers → clients}/block-service/ari.d.ts +1 -1
- package/dist/types/{utils → clients/block-service}/blockService.d.ts +3 -3
- package/dist/types/clients/confluence/ari.d.ts +9 -0
- package/dist/types/{utils → clients/confluence}/contentProperty.d.ts +1 -1
- package/dist/types/clients/confluence/sourceInfo.d.ts +2 -0
- package/dist/types/clients/confluence/utils.d.ts +2 -0
- package/dist/types/common/types.d.ts +3 -1
- package/dist/types/index.d.ts +5 -4
- package/dist/types/providers/syncBlockProvider.d.ts +10 -1
- package/dist/types/providers/types.d.ts +20 -8
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +6 -0
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +17 -1
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +4 -59
- package/dist/types/utils/utils.d.ts +1 -2
- package/dist/types-ts4.5/{providers → clients}/block-service/ari.d.ts +1 -1
- package/dist/types-ts4.5/{utils → clients/block-service}/blockService.d.ts +3 -3
- package/dist/types-ts4.5/clients/confluence/ari.d.ts +9 -0
- package/dist/types-ts4.5/{utils → clients/confluence}/contentProperty.d.ts +1 -1
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +2 -0
- package/dist/types-ts4.5/clients/confluence/utils.d.ts +2 -0
- package/dist/types-ts4.5/common/types.d.ts +3 -1
- package/dist/types-ts4.5/index.d.ts +5 -4
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +10 -1
- package/dist/types-ts4.5/providers/types.d.ts +20 -8
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +6 -0
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +17 -1
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +4 -59
- package/dist/types-ts4.5/utils/utils.d.ts +1 -2
- package/package.json +5 -5
- package/dist/types/utils/ari.d.ts +0 -9
- package/dist/types/utils/sourceInfo.d.ts +0 -2
- package/dist/types-ts4.5/utils/ari.d.ts +0 -9
- package/dist/types-ts4.5/utils/sourceInfo.d.ts +0 -2
- /package/dist/cjs/{utils → clients/block-service}/blockService.js +0 -0
- /package/dist/cjs/{utils → clients/confluence}/contentProperty.js +0 -0
- /package/dist/es2019/{utils → clients/block-service}/blockService.js +0 -0
- /package/dist/es2019/{utils → clients/confluence}/contentProperty.js +0 -0
- /package/dist/esm/{utils → clients/block-service}/blockService.js +0 -0
- /package/dist/esm/{utils → clients/confluence}/contentProperty.js +0 -0
|
@@ -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
|
|
13
|
+
export declare const getLocalIdFromBlockResourceId: (ari: string) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SyncBlockProduct } from '../../common/types';
|
|
2
2
|
export type BlockContentResponse = {
|
|
3
3
|
blockAri: string;
|
|
4
4
|
blockInstanceId: string;
|
|
@@ -7,7 +7,7 @@ export type BlockContentResponse = {
|
|
|
7
7
|
createdAt: number;
|
|
8
8
|
createdBy: string;
|
|
9
9
|
isSynced: boolean;
|
|
10
|
-
product:
|
|
10
|
+
product: SyncBlockProduct;
|
|
11
11
|
sourceAri: string;
|
|
12
12
|
status: 'active' | 'deleted';
|
|
13
13
|
version: number;
|
|
@@ -26,7 +26,7 @@ export type CreateSyncedBlockRequest = {
|
|
|
26
26
|
blockAri: string;
|
|
27
27
|
blockInstanceId: string;
|
|
28
28
|
content: string;
|
|
29
|
-
product:
|
|
29
|
+
product: SyncBlockProduct;
|
|
30
30
|
sourceAri: string;
|
|
31
31
|
};
|
|
32
32
|
export declare class BlockError extends Error {
|
|
@@ -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;
|
|
@@ -2,6 +2,7 @@ import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
|
2
2
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
3
3
|
export type BlockInstanceId = string;
|
|
4
4
|
export type ResourceId = string;
|
|
5
|
+
export type SyncBlockProduct = 'confluence-page' | 'jira-work-item';
|
|
5
6
|
export type SyncBlockAttrs = {
|
|
6
7
|
localId: BlockInstanceId;
|
|
7
8
|
resourceId: ResourceId;
|
|
@@ -22,8 +23,9 @@ export interface SyncBlockData {
|
|
|
22
23
|
createdAt?: string;
|
|
23
24
|
createdBy?: string;
|
|
24
25
|
isSynced?: boolean;
|
|
26
|
+
product?: SyncBlockProduct;
|
|
25
27
|
resourceId: ResourceId;
|
|
26
|
-
|
|
28
|
+
sourceAri?: string;
|
|
27
29
|
sourceTitle?: string;
|
|
28
30
|
sourceURL?: string;
|
|
29
31
|
updatedAt?: string;
|
|
@@ -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,
|
|
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
|
-
export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlockInstance, } from './providers/types';
|
|
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';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
|
|
2
2
|
import { type SyncBlockData, type SyncBlockNode } from '../common/types';
|
|
3
|
-
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
3
|
+
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockParentInfo, type SyncBlockSourceInfo, type SyncedBlockRendererProviderOptions, type WriteSyncBlockResult } from '../providers/types';
|
|
4
4
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
5
5
|
name: string;
|
|
6
6
|
private fetchProvider;
|
|
@@ -79,5 +79,14 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
79
79
|
* @returns The synced block renderer provider options
|
|
80
80
|
*/
|
|
81
81
|
getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
82
|
+
/**
|
|
83
|
+
* Retrieve the parent info for the sync block
|
|
84
|
+
*
|
|
85
|
+
* @param resourceId
|
|
86
|
+
* @param syncBlockInstance
|
|
87
|
+
*
|
|
88
|
+
* @returns The parent info for the sync block
|
|
89
|
+
*/
|
|
90
|
+
retrieveSyncBlockParentInfo(syncBlockInstance: SyncBlockInstance | undefined): SyncBlockParentInfo | undefined;
|
|
82
91
|
}
|
|
83
92
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string, providerOptions: SyncedBlockRendererProviderOptions) => SyncBlockProvider;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MediaProvider, ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
2
|
import type { EmojiProvider } from '@atlaskit/emoji';
|
|
3
|
+
import type { MentionProvider } from '@atlaskit/mention/types';
|
|
3
4
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
4
|
-
import type {
|
|
5
|
+
import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
6
|
+
import type { SyncBlockData, ResourceId, SyncBlockError, SyncBlockNode, SyncBlockProduct } from '../common/types';
|
|
5
7
|
/**
|
|
6
8
|
* The instance of a sync block, containing its data and metadata.
|
|
7
9
|
* Mainly used for representing the state of a sync block after fetching from a data provider.
|
|
@@ -21,6 +23,10 @@ export type SyncBlockSourceInfo = {
|
|
|
21
23
|
title?: string;
|
|
22
24
|
url?: string;
|
|
23
25
|
};
|
|
26
|
+
export type SyncBlockParentInfo = {
|
|
27
|
+
contentId: string;
|
|
28
|
+
contentProduct: SyncBlockProduct;
|
|
29
|
+
};
|
|
24
30
|
export type WriteSyncBlockResult = {
|
|
25
31
|
error?: string;
|
|
26
32
|
resourceId?: string;
|
|
@@ -40,15 +46,20 @@ export interface ADFWriteProvider {
|
|
|
40
46
|
}
|
|
41
47
|
export type MediaEmojiProviderOptions = {
|
|
42
48
|
contentId: string;
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
contentProduct: SyncBlockProduct;
|
|
50
|
+
};
|
|
51
|
+
export type SyncedBlockRendererDataProviders = {
|
|
52
|
+
mentionProvider?: Promise<MentionProvider>;
|
|
53
|
+
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
54
|
+
taskDecisionProvider?: Promise<TaskDecisionProvider>;
|
|
55
|
+
};
|
|
56
|
+
export type SyncBlockRendererProviderCreator = {
|
|
57
|
+
createEmojiProvider: ((options: MediaEmojiProviderOptions) => Promise<EmojiProvider>) | undefined;
|
|
58
|
+
createMediaProvider: ((options: MediaEmojiProviderOptions) => Promise<MediaProvider>) | undefined;
|
|
45
59
|
};
|
|
46
60
|
export type SyncedBlockRendererProviderOptions = {
|
|
47
61
|
parentDataProviders?: SyncedBlockRendererDataProviders;
|
|
48
|
-
providerCreator?:
|
|
49
|
-
createEmojiProvider: ((options: MediaEmojiProviderOptions) => Promise<EmojiProvider>) | undefined;
|
|
50
|
-
createMediaProvider: ((options: MediaEmojiProviderOptions) => Promise<MediaProvider>) | undefined;
|
|
51
|
-
};
|
|
62
|
+
providerCreator?: SyncBlockRendererProviderCreator;
|
|
52
63
|
};
|
|
53
64
|
export declare abstract class SyncBlockDataProvider extends NodeDataProvider<SyncBlockNode, SyncBlockInstance> {
|
|
54
65
|
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
@@ -56,6 +67,7 @@ export declare abstract class SyncBlockDataProvider extends NodeDataProvider<Syn
|
|
|
56
67
|
abstract getSourceId(): ResourceId;
|
|
57
68
|
abstract retrieveSyncBlockSourceInfo(node: SyncBlockNode): Promise<SyncBlockSourceInfo | undefined>;
|
|
58
69
|
abstract getSyncedBlockRendererProviderOptions(): SyncedBlockRendererProviderOptions;
|
|
70
|
+
abstract retrieveSyncBlockParentInfo(syncBlockInstance: SyncBlockInstance | undefined): SyncBlockParentInfo | undefined;
|
|
59
71
|
/**
|
|
60
72
|
* Generates a resource ID from a source ID and local ID.
|
|
61
73
|
* @param sourceId - The source document ID (e.g., page ARI)
|
|
@@ -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;
|
|
@@ -32,5 +37,6 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
32
37
|
*/
|
|
33
38
|
getSyncBlockURL(resourceId: ResourceId): string | undefined;
|
|
34
39
|
getProviderFactory(resourceId: ResourceId): ProviderFactory | undefined;
|
|
40
|
+
private retrieveDynamicProviders;
|
|
35
41
|
destroy(): void;
|
|
36
42
|
}
|
|
@@ -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
|
-
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
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
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/adf-schema": "^51.4.0",
|
|
28
28
|
"@atlaskit/adf-utils": "^19.26.0",
|
|
29
|
-
"@atlaskit/css": "^0.
|
|
29
|
+
"@atlaskit/css": "^0.16.0",
|
|
30
30
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
32
32
|
"@atlaskit/node-data-provider": "^7.5.0",
|
|
33
|
-
"@atlaskit/primitives": "^16.
|
|
34
|
-
"@atlaskit/tokens": "^8.
|
|
33
|
+
"@atlaskit/primitives": "^16.2.0",
|
|
34
|
+
"@atlaskit/tokens": "^8.1.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"@compiled/react": "^0.18.6",
|
|
37
37
|
"uuid": "^3.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@atlaskit/editor-common": "^110.
|
|
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.
|
|
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,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;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|