@atlaskit/editor-synced-block-provider 4.2.8 → 4.2.10
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 +22 -0
- package/dist/cjs/clients/block-service/blockService.js +24 -8
- package/dist/cjs/providers/block-service/blockServiceAPI.js +198 -82
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +23 -6
- package/dist/es2019/clients/block-service/blockService.js +16 -4
- package/dist/es2019/providers/block-service/blockServiceAPI.js +74 -1
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +25 -7
- package/dist/esm/clients/block-service/blockService.js +24 -7
- package/dist/esm/providers/block-service/blockServiceAPI.js +199 -83
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +23 -6
- package/dist/types/clients/block-service/blockService.d.ts +8 -0
- package/dist/types/providers/block-service/blockServiceAPI.d.ts +1 -0
- package/dist/types-ts4.5/clients/block-service/blockService.d.ts +8 -0
- package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +1 -0
- package/package.json +5 -2
|
@@ -76,14 +76,31 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
76
76
|
if (!localId || !resourceId) {
|
|
77
77
|
throw new Error('Local ID or resource ID is not set');
|
|
78
78
|
}
|
|
79
|
-
var syncBlockData = convertSyncBlockPMNodeToSyncBlockData(syncBlockNode);
|
|
80
79
|
var cachedBlock = this.syncBlockCache.get(resourceId);
|
|
81
|
-
if (
|
|
82
|
-
|
|
80
|
+
if (fg('platform_synced_block_update_refactor')) {
|
|
81
|
+
var _cachedBlock$contentF;
|
|
82
|
+
// Fast path: if the PM content fragment hasn't changed, skip serialization entirely
|
|
83
|
+
// Fragment.eq() leverages ProseMirror's structural sharing for O(1) comparison
|
|
84
|
+
if (cachedBlock !== null && cachedBlock !== void 0 && (_cachedBlock$contentF = cachedBlock.contentFragment) !== null && _cachedBlock$contentF !== void 0 && _cachedBlock$contentF.eq(syncBlockNode.content)) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
var syncBlockData = convertSyncBlockPMNodeToSyncBlockData(syncBlockNode);
|
|
88
|
+
if (cachedBlock) {
|
|
89
|
+
this.hasReceivedContentChange = true;
|
|
90
|
+
}
|
|
91
|
+
this.syncBlockCache.set(resourceId, _objectSpread(_objectSpread({}, syncBlockData), {}, {
|
|
92
|
+
isDirty: true,
|
|
93
|
+
contentFragment: syncBlockNode.content
|
|
94
|
+
}));
|
|
95
|
+
} else {
|
|
96
|
+
var _syncBlockData = convertSyncBlockPMNodeToSyncBlockData(syncBlockNode);
|
|
97
|
+
if (cachedBlock && !isEqual(_syncBlockData.content, cachedBlock.content)) {
|
|
98
|
+
this.hasReceivedContentChange = true;
|
|
99
|
+
}
|
|
100
|
+
this.syncBlockCache.set(resourceId, _objectSpread(_objectSpread({}, _syncBlockData), {}, {
|
|
101
|
+
isDirty: true
|
|
102
|
+
}));
|
|
83
103
|
}
|
|
84
|
-
this.syncBlockCache.set(resourceId, _objectSpread(_objectSpread({}, syncBlockData), {}, {
|
|
85
|
-
isDirty: true
|
|
86
|
-
}));
|
|
87
104
|
return true;
|
|
88
105
|
} catch (error) {
|
|
89
106
|
var _this$fireAnalyticsEv;
|
|
@@ -134,6 +134,14 @@ export declare class BlockError extends Error {
|
|
|
134
134
|
readonly status: number;
|
|
135
135
|
constructor(status: number);
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Thrown when Block Service returns RESOURCE_NOT_FOUND for a block.
|
|
139
|
+
* This typically happens when an orphan block (e.g. from a copied page) is deleted.
|
|
140
|
+
* The caller should create the block first, then delete it to ensure a proper soft-delete record.
|
|
141
|
+
*/
|
|
142
|
+
export declare class BlockNotFoundError extends Error {
|
|
143
|
+
constructor();
|
|
144
|
+
}
|
|
137
145
|
export declare class BlockTimeoutError extends Error {
|
|
138
146
|
constructor();
|
|
139
147
|
}
|
|
@@ -95,6 +95,7 @@ declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
|
95
95
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
96
96
|
createData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
97
97
|
deleteData(resourceId: string, deleteReason: string | undefined): Promise<DeleteSyncBlockResult>;
|
|
98
|
+
private deleteOrphanBlock;
|
|
98
99
|
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
99
100
|
generateResourceId(): ResourceId;
|
|
100
101
|
generateBlockAri(resourceId: ResourceId): string;
|
|
@@ -134,6 +134,14 @@ export declare class BlockError extends Error {
|
|
|
134
134
|
readonly status: number;
|
|
135
135
|
constructor(status: number);
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Thrown when Block Service returns RESOURCE_NOT_FOUND for a block.
|
|
139
|
+
* This typically happens when an orphan block (e.g. from a copied page) is deleted.
|
|
140
|
+
* The caller should create the block first, then delete it to ensure a proper soft-delete record.
|
|
141
|
+
*/
|
|
142
|
+
export declare class BlockNotFoundError extends Error {
|
|
143
|
+
constructor();
|
|
144
|
+
}
|
|
137
145
|
export declare class BlockTimeoutError extends Error {
|
|
138
146
|
constructor();
|
|
139
147
|
}
|
|
@@ -95,6 +95,7 @@ declare class BlockServiceADFWriteProvider implements ADFWriteProvider {
|
|
|
95
95
|
writeData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
96
96
|
createData(data: SyncBlockData): Promise<WriteSyncBlockResult>;
|
|
97
97
|
deleteData(resourceId: string, deleteReason: string | undefined): Promise<DeleteSyncBlockResult>;
|
|
98
|
+
private deleteOrphanBlock;
|
|
98
99
|
generateResourceIdForReference(sourceId: ResourceId): ResourceId;
|
|
99
100
|
generateResourceId(): ResourceId;
|
|
100
101
|
generateBlockAri(resourceId: ResourceId): string;
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
30
30
|
"@atlaskit/node-data-provider": "^9.0.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
32
|
+
"@atlaskit/tmp-editor-statsig": "^52.0.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@compiled/react": "^0.20.0",
|
|
35
35
|
"graphql-ws": "^5.14.2",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"name": "@atlaskit/editor-synced-block-provider",
|
|
84
|
-
"version": "4.2.
|
|
84
|
+
"version": "4.2.10",
|
|
85
85
|
"description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
|
|
86
86
|
"author": "Atlassian Pty Ltd",
|
|
87
87
|
"license": "Apache-2.0",
|
|
@@ -95,6 +95,9 @@
|
|
|
95
95
|
"platform_synced_block_patch_7": {
|
|
96
96
|
"type": "boolean"
|
|
97
97
|
},
|
|
98
|
+
"platform_synced_block_update_refactor": {
|
|
99
|
+
"type": "boolean"
|
|
100
|
+
},
|
|
98
101
|
"platform_synced_block_patch_8": {
|
|
99
102
|
"type": "boolean"
|
|
100
103
|
}
|