@atlaskit/editor-synced-block-provider 2.6.0 → 2.7.1
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 +16 -0
- package/dist/cjs/hooks/useFetchSyncBlockData.js +2 -2
- package/dist/cjs/index.js +9 -4
- package/dist/cjs/providers/confluence/confluenceContentAPI.js +86 -73
- package/dist/cjs/providers/syncBlockProvider.js +52 -75
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +7 -7
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +78 -17
- package/dist/cjs/store-manager/syncBlockStoreManager.js +41 -8
- package/dist/cjs/utils/errorHandling.js +13 -0
- package/dist/cjs/utils/sourceInfo.js +119 -0
- package/dist/cjs/utils/utils.js +32 -1
- package/dist/es2019/hooks/useFetchSyncBlockData.js +1 -1
- package/dist/es2019/index.js +2 -3
- package/dist/es2019/providers/confluence/confluenceContentAPI.js +62 -40
- package/dist/es2019/providers/syncBlockProvider.js +18 -37
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +4 -4
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +64 -12
- package/dist/es2019/store-manager/syncBlockStoreManager.js +31 -8
- package/dist/es2019/utils/errorHandling.js +7 -0
- package/dist/es2019/utils/sourceInfo.js +89 -0
- package/dist/es2019/utils/utils.js +31 -0
- package/dist/esm/hooks/useFetchSyncBlockData.js +1 -1
- package/dist/esm/index.js +2 -3
- package/dist/esm/providers/confluence/confluenceContentAPI.js +79 -66
- package/dist/esm/providers/syncBlockProvider.js +52 -75
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +5 -5
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +79 -18
- package/dist/esm/store-manager/syncBlockStoreManager.js +41 -8
- package/dist/esm/utils/errorHandling.js +7 -0
- package/dist/esm/utils/sourceInfo.js +114 -0
- package/dist/esm/utils/utils.js +31 -0
- package/dist/types/index.d.ts +1 -2
- package/dist/types/providers/confluence/confluenceContentAPI.d.ts +2 -2
- package/dist/types/providers/syncBlockProvider.d.ts +5 -4
- package/dist/types/providers/types.d.ts +7 -3
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +15 -3
- package/dist/types/store-manager/syncBlockStoreManager.d.ts +20 -3
- package/dist/types/utils/errorHandling.d.ts +1 -0
- package/dist/types/utils/sourceInfo.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +6 -1
- package/dist/types-ts4.5/index.d.ts +1 -2
- package/dist/types-ts4.5/providers/confluence/confluenceContentAPI.d.ts +2 -2
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +5 -4
- package/dist/types-ts4.5/providers/types.d.ts +7 -3
- package/dist/types-ts4.5/store-manager/referenceSyncBlockStoreManager.d.ts +1 -1
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +15 -3
- package/dist/types-ts4.5/store-manager/syncBlockStoreManager.d.ts +20 -3
- package/dist/types-ts4.5/utils/errorHandling.d.ts +1 -0
- package/dist/types-ts4.5/utils/sourceInfo.d.ts +2 -0
- package/dist/types-ts4.5/utils/utils.d.ts +6 -1
- package/package.json +2 -2
- package/dist/cjs/utils/createSyncBlock.js +0 -15
- package/dist/es2019/utils/createSyncBlock.js +0 -9
- package/dist/esm/utils/createSyncBlock.js +0 -9
- package/dist/types/utils/createSyncBlock.d.ts +0 -2
- package/dist/types-ts4.5/utils/createSyncBlock.d.ts +0 -2
|
@@ -19,18 +19,22 @@ export type SyncBlockSourceInfo = {
|
|
|
19
19
|
title?: string;
|
|
20
20
|
url?: string;
|
|
21
21
|
};
|
|
22
|
+
export type WriteSyncBlockResult = {
|
|
23
|
+
error?: string;
|
|
24
|
+
resourceId?: string;
|
|
25
|
+
};
|
|
22
26
|
export interface ADFFetchProvider {
|
|
23
27
|
fetchData: (resourceId: ResourceId) => Promise<SyncBlockInstance>;
|
|
24
28
|
}
|
|
25
29
|
export interface ADFWriteProvider {
|
|
26
30
|
deleteData: (resourceId: string) => Promise<DeleteSyncBlockResult>;
|
|
27
|
-
writeData: (data: SyncBlockData) => Promise<
|
|
31
|
+
writeData: (data: SyncBlockData) => Promise<WriteSyncBlockResult>;
|
|
28
32
|
}
|
|
29
33
|
export declare abstract class SyncBlockDataProvider extends NodeDataProvider<SyncBlockNode, SyncBlockInstance> {
|
|
30
|
-
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<
|
|
34
|
+
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
31
35
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
32
36
|
abstract getSourceId(): ResourceId;
|
|
33
|
-
abstract
|
|
37
|
+
abstract retrieveSyncBlockSourceInfo(node: SyncBlockNode): Promise<SyncBlockSourceInfo | undefined>;
|
|
34
38
|
}
|
|
35
39
|
export type SubscriptionCallback = (data: SyncBlockInstance) => void;
|
|
36
40
|
export type TitleSubscriptionCallback = (title: string) => void;
|
|
@@ -14,7 +14,7 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
14
14
|
* @returns {Promise<void>}
|
|
15
15
|
*/
|
|
16
16
|
refreshSubscriptions(): Promise<void>;
|
|
17
|
-
private
|
|
17
|
+
private retrieveSyncBlockSourceInfo;
|
|
18
18
|
fetchSyncBlocksData(syncBlockNodes: SyncBlockNode[]): Promise<SyncBlockInstance[]>;
|
|
19
19
|
private updateCache;
|
|
20
20
|
private updateSourceTitleSubscriptions;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ResourceId, SyncBlockAttrs } from '../common/types';
|
|
5
5
|
import type { SyncBlockDataProvider } from '../providers/types';
|
|
6
6
|
export type ConfirmationCallback = () => Promise<boolean>;
|
|
7
|
+
export type CreationCallback = () => void;
|
|
7
8
|
export declare class SourceSyncBlockStoreManager {
|
|
8
9
|
private dataProvider?;
|
|
9
10
|
private editorView?;
|
|
10
11
|
private syncBlockCache;
|
|
11
12
|
private confirmationCallback?;
|
|
12
13
|
private confirmationTransaction?;
|
|
14
|
+
private pendingResourceId?;
|
|
15
|
+
private creationCallback?;
|
|
13
16
|
constructor(dataProvider?: SyncBlockDataProvider);
|
|
14
17
|
/**
|
|
15
18
|
* Add/update a sync block node to/from the local cache
|
|
@@ -23,9 +26,18 @@ export declare class SourceSyncBlockStoreManager {
|
|
|
23
26
|
*/
|
|
24
27
|
flushBodiedSyncBlocks(): Promise<boolean>;
|
|
25
28
|
setEditorView(editorView: EditorView | undefined): void;
|
|
29
|
+
registerPendingCreation(resourceId: ResourceId): void;
|
|
30
|
+
registerCreationCallback(callback: CreationCallback): void;
|
|
31
|
+
/**
|
|
32
|
+
* Fires callback to insert node (if creation is successful) and clears pending creation data
|
|
33
|
+
* @param success
|
|
34
|
+
*/
|
|
35
|
+
commitPendingCreation(success: boolean): void;
|
|
36
|
+
hasPendingCreation(): boolean;
|
|
26
37
|
registerConfirmationCallback(callback: ConfirmationCallback): () => void;
|
|
27
38
|
requireConfirmationBeforeDelete(): boolean;
|
|
28
|
-
|
|
39
|
+
generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
|
|
40
|
+
createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
|
|
29
41
|
deleteSyncBlocksWithConfirmation(tr: Transaction, syncBlockIds: SyncBlockAttrs[]): Promise<void>;
|
|
30
42
|
rebaseTransaction(incomingTr: Transaction, state: EditorState): void;
|
|
31
43
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
2
2
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { ResourceId, SyncBlockAttrs
|
|
4
|
+
import type { ResourceId, SyncBlockAttrs } from '../common/types';
|
|
5
5
|
import type { SubscriptionCallback, SyncBlockDataProvider, SyncBlockInstance, TitleSubscriptionCallback } from '../providers/types';
|
|
6
6
|
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
7
|
-
import { type ConfirmationCallback } from './sourceSyncBlockStoreManager';
|
|
7
|
+
import { type ConfirmationCallback, type CreationCallback } from './sourceSyncBlockStoreManager';
|
|
8
8
|
export declare class SyncBlockStoreManager {
|
|
9
9
|
private referenceSyncBlockStoreManager;
|
|
10
10
|
private sourceSyncBlockStoreManager;
|
|
@@ -37,7 +37,24 @@ export declare class SyncBlockStoreManager {
|
|
|
37
37
|
isSourceBlock(node: PMNode): boolean;
|
|
38
38
|
registerConfirmationCallback(callback: ConfirmationCallback): () => void;
|
|
39
39
|
requireConfirmationBeforeDelete(): boolean;
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Register callback function (which inserts node, handles focus etc) to be used later when creation to backend succeed
|
|
42
|
+
*/
|
|
43
|
+
registerCreationCallback(callback: CreationCallback): void;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @returns true if waiting for the result of saving new bodiedSyncBlock to backend
|
|
47
|
+
*/
|
|
48
|
+
hasPendingCreation(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* @returns attributes for a new bodiedSyncBlock node
|
|
51
|
+
*/
|
|
52
|
+
generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
|
|
53
|
+
/**
|
|
54
|
+
* Save bodiedSyncBlock with empty content to backend
|
|
55
|
+
* @param attrs attributes Ids of the node
|
|
56
|
+
*/
|
|
57
|
+
createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
|
|
41
58
|
subscribeToSyncBlockData(node: PMNode, callback: SubscriptionCallback): () => void;
|
|
42
59
|
subscribeToSyncBlockSourceTitle(node: PMNode, callback: TitleSubscriptionCallback): () => void;
|
|
43
60
|
refreshSubscriptions(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { JSONNode } from '@atlaskit/editor-json-transformer';
|
|
1
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { SyncBlockData } from '../common/types';
|
|
3
|
+
import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode } from '../common/types';
|
|
3
4
|
import type { PAGE_TYPE } from './ari';
|
|
4
5
|
export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
|
|
5
6
|
export declare const isBlogPageType: (pageType: PAGE_TYPE) => boolean;
|
|
7
|
+
export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
|
|
8
|
+
export declare const createBodiedSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
|
|
9
|
+
export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
|
|
10
|
+
export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
|
|
@@ -11,6 +11,5 @@ export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlo
|
|
|
11
11
|
export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
|
|
12
12
|
export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
|
|
13
13
|
export { getConfluencePageAri, getPageIdAndTypeFromAri } from './utils/ari';
|
|
14
|
-
export { createSyncBlockNode } from './utils/
|
|
14
|
+
export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, } from './utils/utils';
|
|
15
15
|
export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
|
|
16
|
-
export { convertSyncBlockPMNodeToSyncBlockData } from './utils/utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SyncBlockData } from '../../common/types';
|
|
2
|
-
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance } from '../types';
|
|
2
|
+
import type { ADFFetchProvider, ADFWriteProvider, DeleteSyncBlockResult, SyncBlockInstance, WriteSyncBlockResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for Content API providers
|
|
5
5
|
*/
|
|
@@ -22,7 +22,7 @@ declare class ConfluenceADFWriteProvider implements ADFWriteProvider {
|
|
|
22
22
|
private config;
|
|
23
23
|
constructor(config: ContentAPIConfig);
|
|
24
24
|
private createNewContentProperty;
|
|
25
|
-
writeData(data: SyncBlockData): Promise<
|
|
25
|
+
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
26
26
|
deleteData(resourceId: string): Promise<DeleteSyncBlockResult>;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -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 } from '../providers/types';
|
|
3
|
+
import { SyncBlockDataProvider, type ADFFetchProvider, type ADFWriteProvider, type DeleteSyncBlockResult, type SyncBlockInstance, type SyncBlockSourceInfo, type WriteSyncBlockResult } from '../providers/types';
|
|
4
4
|
export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
5
5
|
name: string;
|
|
6
6
|
private fetchProvider;
|
|
@@ -15,11 +15,12 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
|
|
|
15
15
|
* @param nodes
|
|
16
16
|
* @param data
|
|
17
17
|
*
|
|
18
|
-
* @returns
|
|
18
|
+
* @returns Array of {resourceId?: string, error?: string}.
|
|
19
|
+
* resourceId: resource id of the node if write successfully , error: reason for when write failed
|
|
19
20
|
*/
|
|
20
|
-
writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<
|
|
21
|
+
writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
21
22
|
deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
22
23
|
getSourceId(): string;
|
|
23
|
-
|
|
24
|
+
retrieveSyncBlockSourceInfo(node: SyncBlockNode): Promise<SyncBlockSourceInfo | undefined>;
|
|
24
25
|
}
|
|
25
26
|
export declare const useMemoizedSyncedBlockProvider: (fetchProvider: ADFFetchProvider, writeProvider: ADFWriteProvider, sourceId: string) => SyncBlockProvider;
|
|
@@ -19,18 +19,22 @@ export type SyncBlockSourceInfo = {
|
|
|
19
19
|
title?: string;
|
|
20
20
|
url?: string;
|
|
21
21
|
};
|
|
22
|
+
export type WriteSyncBlockResult = {
|
|
23
|
+
error?: string;
|
|
24
|
+
resourceId?: string;
|
|
25
|
+
};
|
|
22
26
|
export interface ADFFetchProvider {
|
|
23
27
|
fetchData: (resourceId: ResourceId) => Promise<SyncBlockInstance>;
|
|
24
28
|
}
|
|
25
29
|
export interface ADFWriteProvider {
|
|
26
30
|
deleteData: (resourceId: string) => Promise<DeleteSyncBlockResult>;
|
|
27
|
-
writeData: (data: SyncBlockData) => Promise<
|
|
31
|
+
writeData: (data: SyncBlockData) => Promise<WriteSyncBlockResult>;
|
|
28
32
|
}
|
|
29
33
|
export declare abstract class SyncBlockDataProvider extends NodeDataProvider<SyncBlockNode, SyncBlockInstance> {
|
|
30
|
-
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<
|
|
34
|
+
abstract writeNodesData(nodes: SyncBlockNode[], data: SyncBlockData[]): Promise<Array<WriteSyncBlockResult>>;
|
|
31
35
|
abstract deleteNodesData(resourceIds: string[]): Promise<Array<DeleteSyncBlockResult>>;
|
|
32
36
|
abstract getSourceId(): ResourceId;
|
|
33
|
-
abstract
|
|
37
|
+
abstract retrieveSyncBlockSourceInfo(node: SyncBlockNode): Promise<SyncBlockSourceInfo | undefined>;
|
|
34
38
|
}
|
|
35
39
|
export type SubscriptionCallback = (data: SyncBlockInstance) => void;
|
|
36
40
|
export type TitleSubscriptionCallback = (title: string) => void;
|
|
@@ -14,7 +14,7 @@ export declare class ReferenceSyncBlockStoreManager {
|
|
|
14
14
|
* @returns {Promise<void>}
|
|
15
15
|
*/
|
|
16
16
|
refreshSubscriptions(): Promise<void>;
|
|
17
|
-
private
|
|
17
|
+
private retrieveSyncBlockSourceInfo;
|
|
18
18
|
fetchSyncBlocksData(syncBlockNodes: SyncBlockNode[]): Promise<SyncBlockInstance[]>;
|
|
19
19
|
private updateCache;
|
|
20
20
|
private updateSourceTitleSubscriptions;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ResourceId, SyncBlockAttrs } from '../common/types';
|
|
5
5
|
import type { SyncBlockDataProvider } from '../providers/types';
|
|
6
6
|
export type ConfirmationCallback = () => Promise<boolean>;
|
|
7
|
+
export type CreationCallback = () => void;
|
|
7
8
|
export declare class SourceSyncBlockStoreManager {
|
|
8
9
|
private dataProvider?;
|
|
9
10
|
private editorView?;
|
|
10
11
|
private syncBlockCache;
|
|
11
12
|
private confirmationCallback?;
|
|
12
13
|
private confirmationTransaction?;
|
|
14
|
+
private pendingResourceId?;
|
|
15
|
+
private creationCallback?;
|
|
13
16
|
constructor(dataProvider?: SyncBlockDataProvider);
|
|
14
17
|
/**
|
|
15
18
|
* Add/update a sync block node to/from the local cache
|
|
@@ -23,9 +26,18 @@ export declare class SourceSyncBlockStoreManager {
|
|
|
23
26
|
*/
|
|
24
27
|
flushBodiedSyncBlocks(): Promise<boolean>;
|
|
25
28
|
setEditorView(editorView: EditorView | undefined): void;
|
|
29
|
+
registerPendingCreation(resourceId: ResourceId): void;
|
|
30
|
+
registerCreationCallback(callback: CreationCallback): void;
|
|
31
|
+
/**
|
|
32
|
+
* Fires callback to insert node (if creation is successful) and clears pending creation data
|
|
33
|
+
* @param success
|
|
34
|
+
*/
|
|
35
|
+
commitPendingCreation(success: boolean): void;
|
|
36
|
+
hasPendingCreation(): boolean;
|
|
26
37
|
registerConfirmationCallback(callback: ConfirmationCallback): () => void;
|
|
27
38
|
requireConfirmationBeforeDelete(): boolean;
|
|
28
|
-
|
|
39
|
+
generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
|
|
40
|
+
createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
|
|
29
41
|
deleteSyncBlocksWithConfirmation(tr: Transaction, syncBlockIds: SyncBlockAttrs[]): Promise<void>;
|
|
30
42
|
rebaseTransaction(incomingTr: Transaction, state: EditorState): void;
|
|
31
43
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
2
2
|
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { ResourceId, SyncBlockAttrs
|
|
4
|
+
import type { ResourceId, SyncBlockAttrs } from '../common/types';
|
|
5
5
|
import type { SubscriptionCallback, SyncBlockDataProvider, SyncBlockInstance, TitleSubscriptionCallback } from '../providers/types';
|
|
6
6
|
import { ReferenceSyncBlockStoreManager } from './referenceSyncBlockStoreManager';
|
|
7
|
-
import { type ConfirmationCallback } from './sourceSyncBlockStoreManager';
|
|
7
|
+
import { type ConfirmationCallback, type CreationCallback } from './sourceSyncBlockStoreManager';
|
|
8
8
|
export declare class SyncBlockStoreManager {
|
|
9
9
|
private referenceSyncBlockStoreManager;
|
|
10
10
|
private sourceSyncBlockStoreManager;
|
|
@@ -37,7 +37,24 @@ export declare class SyncBlockStoreManager {
|
|
|
37
37
|
isSourceBlock(node: PMNode): boolean;
|
|
38
38
|
registerConfirmationCallback(callback: ConfirmationCallback): () => void;
|
|
39
39
|
requireConfirmationBeforeDelete(): boolean;
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Register callback function (which inserts node, handles focus etc) to be used later when creation to backend succeed
|
|
42
|
+
*/
|
|
43
|
+
registerCreationCallback(callback: CreationCallback): void;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @returns true if waiting for the result of saving new bodiedSyncBlock to backend
|
|
47
|
+
*/
|
|
48
|
+
hasPendingCreation(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* @returns attributes for a new bodiedSyncBlock node
|
|
51
|
+
*/
|
|
52
|
+
generateBodiedSyncBlockAttrs(): SyncBlockAttrs;
|
|
53
|
+
/**
|
|
54
|
+
* Save bodiedSyncBlock with empty content to backend
|
|
55
|
+
* @param attrs attributes Ids of the node
|
|
56
|
+
*/
|
|
57
|
+
createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
|
|
41
58
|
subscribeToSyncBlockData(node: PMNode, callback: SubscriptionCallback): () => void;
|
|
42
59
|
subscribeToSyncBlockSourceTitle(node: PMNode, callback: TitleSubscriptionCallback): () => void;
|
|
43
60
|
refreshSubscriptions(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stringifyError: (error: unknown) => string | undefined;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { JSONNode } from '@atlaskit/editor-json-transformer';
|
|
1
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { SyncBlockData } from '../common/types';
|
|
3
|
+
import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode } from '../common/types';
|
|
3
4
|
import type { PAGE_TYPE } from './ari';
|
|
4
5
|
export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
|
|
5
6
|
export declare const isBlogPageType: (pageType: PAGE_TYPE) => boolean;
|
|
7
|
+
export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
|
|
8
|
+
export declare const createBodiedSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
|
|
9
|
+
export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
|
|
10
|
+
export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/css": "^0.15.0",
|
|
30
30
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
32
|
-
"@atlaskit/node-data-provider": "^7.
|
|
32
|
+
"@atlaskit/node-data-provider": "^7.5.0",
|
|
33
33
|
"@atlaskit/primitives": "^16.1.0",
|
|
34
34
|
"@atlaskit/tokens": "^7.1.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
85
|
-
"version": "2.
|
|
85
|
+
"version": "2.7.1",
|
|
86
86
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
87
87
|
"author": "Atlassian Pty Ltd",
|
|
88
88
|
"license": "Apache-2.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createSyncBlockNode = void 0;
|
|
7
|
-
var createSyncBlockNode = exports.createSyncBlockNode = function createSyncBlockNode(localId, resourceId) {
|
|
8
|
-
return {
|
|
9
|
-
type: 'syncBlock',
|
|
10
|
-
attrs: {
|
|
11
|
-
localId: localId,
|
|
12
|
-
resourceId: resourceId
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
};
|