@atlaskit/editor-plugin-synced-block 5.3.35 → 5.3.37

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 5.3.37
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 5.3.36
10
+
11
+ ### Patch Changes
12
+
13
+ - [`432dbdcd07917`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/432dbdcd07917) -
14
+ EDITOR-5500 add hasUnsavedBodiedSyncBlocks state to synced block plugin to allow confluence to
15
+ check whether changes have been saved yet before leaving the page
16
+ - Updated dependencies
17
+
3
18
  ## 5.3.35
4
19
 
5
20
  ### Patch Changes
@@ -295,7 +295,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
295
295
  selectionDecorationSet: (0, _selectionDecorations.calculateDecorations)(instance.doc, instance.selection, instance.schema),
296
296
  activeFlag: false,
297
297
  syncBlockStore: syncBlockStore,
298
- retryCreationPosMap: new Map()
298
+ retryCreationPosMap: new Map(),
299
+ hasUnsavedBodiedSyncBlockChanges: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? syncBlockStore.sourceManager.hasUnsavedChanges() : undefined
299
300
  };
300
301
  },
301
302
  apply: function apply(tr, currentPluginState, oldEditorState) {
@@ -316,7 +317,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
316
317
  selectionDecorationSet: newDecorationSet,
317
318
  syncBlockStore: syncBlockStore,
318
319
  retryCreationPosMap: newRetryCreationPosMap,
319
- bodiedSyncBlockDeletionStatus: (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus
320
+ bodiedSyncBlockDeletionStatus: (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus,
321
+ hasUnsavedBodiedSyncBlockChanges: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? syncBlockStore.sourceManager.hasUnsavedChanges() : undefined
320
322
  };
321
323
  }
322
324
  },
@@ -118,12 +118,14 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
118
118
  activeFlag = _syncedBlockPluginKey.activeFlag,
119
119
  currentSyncBlockStore = _syncedBlockPluginKey.syncBlockStore,
120
120
  bodiedSyncBlockDeletionStatus = _syncedBlockPluginKey.bodiedSyncBlockDeletionStatus,
121
- retryCreationPosMap = _syncedBlockPluginKey.retryCreationPosMap;
121
+ retryCreationPosMap = _syncedBlockPluginKey.retryCreationPosMap,
122
+ hasUnsavedBodiedSyncBlockChanges = _syncedBlockPluginKey.hasUnsavedBodiedSyncBlockChanges;
122
123
  return {
123
124
  activeFlag: activeFlag,
124
125
  syncBlockStore: currentSyncBlockStore,
125
126
  bodiedSyncBlockDeletionStatus: bodiedSyncBlockDeletionStatus,
126
- retryCreationPosMap: retryCreationPosMap
127
+ retryCreationPosMap: retryCreationPosMap,
128
+ hasUnsavedBodiedSyncBlockChanges: (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? hasUnsavedBodiedSyncBlockChanges : undefined
127
129
  };
128
130
  }
129
131
  };
@@ -257,7 +257,8 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
257
257
  selectionDecorationSet: calculateDecorations(instance.doc, instance.selection, instance.schema),
258
258
  activeFlag: false,
259
259
  syncBlockStore: syncBlockStore,
260
- retryCreationPosMap: new Map()
260
+ retryCreationPosMap: new Map(),
261
+ hasUnsavedBodiedSyncBlockChanges: fg('platform_synced_block_patch_5') ? syncBlockStore.sourceManager.hasUnsavedChanges() : undefined
261
262
  };
262
263
  },
263
264
  apply: (tr, currentPluginState, oldEditorState) => {
@@ -280,7 +281,8 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
280
281
  selectionDecorationSet: newDecorationSet,
281
282
  syncBlockStore: syncBlockStore,
282
283
  retryCreationPosMap: newRetryCreationPosMap,
283
- bodiedSyncBlockDeletionStatus: (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus
284
+ bodiedSyncBlockDeletionStatus: (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus,
285
+ hasUnsavedBodiedSyncBlockChanges: fg('platform_synced_block_patch_5') ? syncBlockStore.sourceManager.hasUnsavedChanges() : undefined
284
286
  };
285
287
  }
286
288
  },
@@ -104,13 +104,15 @@ export const syncedBlockPlugin = ({
104
104
  activeFlag,
105
105
  syncBlockStore: currentSyncBlockStore,
106
106
  bodiedSyncBlockDeletionStatus,
107
- retryCreationPosMap
107
+ retryCreationPosMap,
108
+ hasUnsavedBodiedSyncBlockChanges
108
109
  } = syncedBlockPluginKey.getState(editorState);
109
110
  return {
110
111
  activeFlag,
111
112
  syncBlockStore: currentSyncBlockStore,
112
113
  bodiedSyncBlockDeletionStatus,
113
- retryCreationPosMap
114
+ retryCreationPosMap,
115
+ hasUnsavedBodiedSyncBlockChanges: fg('platform_synced_block_patch_5') ? hasUnsavedBodiedSyncBlockChanges : undefined
114
116
  };
115
117
  }
116
118
  };
@@ -288,7 +288,8 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
288
288
  selectionDecorationSet: calculateDecorations(instance.doc, instance.selection, instance.schema),
289
289
  activeFlag: false,
290
290
  syncBlockStore: syncBlockStore,
291
- retryCreationPosMap: new Map()
291
+ retryCreationPosMap: new Map(),
292
+ hasUnsavedBodiedSyncBlockChanges: fg('platform_synced_block_patch_5') ? syncBlockStore.sourceManager.hasUnsavedChanges() : undefined
292
293
  };
293
294
  },
294
295
  apply: function apply(tr, currentPluginState, oldEditorState) {
@@ -309,7 +310,8 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
309
310
  selectionDecorationSet: newDecorationSet,
310
311
  syncBlockStore: syncBlockStore,
311
312
  retryCreationPosMap: newRetryCreationPosMap,
312
- bodiedSyncBlockDeletionStatus: (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus
313
+ bodiedSyncBlockDeletionStatus: (_meta$bodiedSyncBlock = meta === null || meta === void 0 ? void 0 : meta.bodiedSyncBlockDeletionStatus) !== null && _meta$bodiedSyncBlock !== void 0 ? _meta$bodiedSyncBlock : bodiedSyncBlockDeletionStatus,
314
+ hasUnsavedBodiedSyncBlockChanges: fg('platform_synced_block_patch_5') ? syncBlockStore.sourceManager.hasUnsavedChanges() : undefined
313
315
  };
314
316
  }
315
317
  },
@@ -111,12 +111,14 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
111
111
  activeFlag = _syncedBlockPluginKey.activeFlag,
112
112
  currentSyncBlockStore = _syncedBlockPluginKey.syncBlockStore,
113
113
  bodiedSyncBlockDeletionStatus = _syncedBlockPluginKey.bodiedSyncBlockDeletionStatus,
114
- retryCreationPosMap = _syncedBlockPluginKey.retryCreationPosMap;
114
+ retryCreationPosMap = _syncedBlockPluginKey.retryCreationPosMap,
115
+ hasUnsavedBodiedSyncBlockChanges = _syncedBlockPluginKey.hasUnsavedBodiedSyncBlockChanges;
115
116
  return {
116
117
  activeFlag: activeFlag,
117
118
  syncBlockStore: currentSyncBlockStore,
118
119
  bodiedSyncBlockDeletionStatus: bodiedSyncBlockDeletionStatus,
119
- retryCreationPosMap: retryCreationPosMap
120
+ retryCreationPosMap: retryCreationPosMap,
121
+ hasUnsavedBodiedSyncBlockChanges: fg('platform_synced_block_patch_5') ? hasUnsavedBodiedSyncBlockChanges : undefined
120
122
  };
121
123
  }
122
124
  };
@@ -9,6 +9,7 @@ export declare const syncedBlockPluginKey: PluginKey<any>;
9
9
  type SyncedBlockPluginState = {
10
10
  activeFlag: ActiveFlag;
11
11
  bodiedSyncBlockDeletionStatus?: BodiedSyncBlockDeletionStatus;
12
+ hasUnsavedBodiedSyncBlockChanges?: boolean;
12
13
  retryCreationPosMap: RetryCreationPosMap;
13
14
  selectionDecorationSet: DecorationSet;
14
15
  syncBlockStore: SyncBlockStoreManager;
@@ -46,6 +46,10 @@ export type SyncedBlockSharedState = {
46
46
  * The current sync block store manager, used to manage fetching and updating sync block data
47
47
  */
48
48
  syncBlockStore: SyncBlockStoreManager;
49
+ /**
50
+ * Whether there are unsaved bodiedSyncBlock changes in the cache
51
+ */
52
+ hasUnsavedBodiedSyncBlockChanges: boolean;
49
53
  };
50
54
  export type SyncBlockAttrs = {
51
55
  localId: string;
@@ -9,6 +9,7 @@ export declare const syncedBlockPluginKey: PluginKey<any>;
9
9
  type SyncedBlockPluginState = {
10
10
  activeFlag: ActiveFlag;
11
11
  bodiedSyncBlockDeletionStatus?: BodiedSyncBlockDeletionStatus;
12
+ hasUnsavedBodiedSyncBlockChanges?: boolean;
12
13
  retryCreationPosMap: RetryCreationPosMap;
13
14
  selectionDecorationSet: DecorationSet;
14
15
  syncBlockStore: SyncBlockStoreManager;
@@ -46,6 +46,10 @@ export type SyncedBlockSharedState = {
46
46
  * The current sync block store manager, used to manage fetching and updating sync block data
47
47
  */
48
48
  syncBlockStore: SyncBlockStoreManager;
49
+ /**
50
+ * Whether there are unsaved bodiedSyncBlock changes in the cache
51
+ */
52
+ hasUnsavedBodiedSyncBlockChanges: boolean;
49
53
  };
50
54
  export type SyncBlockAttrs = {
51
55
  localId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "5.3.35",
3
+ "version": "5.3.37",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,7 +28,7 @@
28
28
  "sideEffects": false,
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
- "@atlaskit/adf-schema": "^52.0.0",
31
+ "@atlaskit/adf-schema": "^52.1.0",
32
32
  "@atlaskit/button": "23.9.9",
33
33
  "@atlaskit/dropdown-menu": "16.5.0",
34
34
  "@atlaskit/editor-json-transformer": "^8.31.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/platform-feature-flags": "^1.1.0",
52
52
  "@atlaskit/primitives": "^18.0.0",
53
53
  "@atlaskit/spinner": "19.0.10",
54
- "@atlaskit/tokens": "11.0.1",
54
+ "@atlaskit/tokens": "11.0.2",
55
55
  "@atlaskit/tooltip": "^20.14.0",
56
56
  "@atlaskit/visually-hidden": "^3.0.0",
57
57
  "@babel/runtime": "^7.0.0",
@@ -61,7 +61,7 @@
61
61
  "react-intl-next": "npm:react-intl@^5.18.1"
62
62
  },
63
63
  "peerDependencies": {
64
- "@atlaskit/editor-common": "^111.20.0",
64
+ "@atlaskit/editor-common": "^111.21.0",
65
65
  "react": "^18.2.0"
66
66
  },
67
67
  "devDependencies": {