@atlaskit/editor-plugin-synced-block 6.0.43 → 6.0.44

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,14 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 6.0.44
4
+
5
+ ### Patch Changes
6
+
7
+ - [`38e89dd6515da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/38e89dd6515da) -
8
+ Read viewMode from the editorViewMode plugin and pass it to SyncBlockStoreManager so that synced
9
+ block side effects are suppressed when the editor is in view mode (e.g. Version History).
10
+ - Updated dependencies
11
+
3
12
  ## 6.0.43
4
13
 
5
14
  ### Patch Changes
@@ -472,7 +472,11 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
472
472
  }
473
473
  },
474
474
  filterTransaction: function filterTransaction(tr, state) {
475
- var _api$connectivity3;
475
+ var _api$editorViewMode2, _api$connectivity3;
476
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode;
477
+ if (viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8')) {
478
+ return true;
479
+ }
476
480
  var isOffline = (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity3 = api.connectivity) === null || _api$connectivity3 === void 0 || (_api$connectivity3 = _api$connectivity3.sharedState.currentState()) === null || _api$connectivity3 === void 0 ? void 0 : _api$connectivity3.mode);
477
481
  var isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
478
482
 
@@ -514,6 +518,12 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
514
518
  });
515
519
  },
516
520
  appendTransaction: function appendTransaction(trs, oldState, newState) {
521
+ var _api$editorViewMode3;
522
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode3 = api.editorViewMode) === null || _api$editorViewMode3 === void 0 || (_api$editorViewMode3 = _api$editorViewMode3.sharedState.currentState()) === null || _api$editorViewMode3 === void 0 ? void 0 : _api$editorViewMode3.mode;
523
+ if (viewMode === 'view' && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_8')) {
524
+ return null;
525
+ }
526
+
517
527
  // Update source sync block cache for user-initiated changes only
518
528
  // When fg is ON, cache updates are handled here instead of in the nodeview update()
519
529
  if ((0, _platformFeatureFlags.fg)('platform_synced_block_update_refactor')) {
@@ -22,11 +22,12 @@ var _quickInsert = require("./ui/quick-insert");
22
22
  var _SyncBlockRefresher = require("./ui/SyncBlockRefresher");
23
23
  var _toolbarComponents = require("./ui/toolbar-components");
24
24
  var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_ref) {
25
- var _api$analytics, _api$blockMenu, _config$enableSourceC, _api$toolbar, _config$enableSourceC2;
25
+ var _api$editorViewMode, _api$analytics, _api$blockMenu, _config$enableSourceC, _api$toolbar, _config$enableSourceC2;
26
26
  var config = _ref.config,
27
27
  api = _ref.api;
28
28
  var refs = {};
29
- var syncBlockStore = new _editorSyncedBlockProvider.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
29
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
30
+ var syncBlockStore = new _editorSyncedBlockProvider.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider, viewMode);
30
31
  syncBlockStore.setFireAnalyticsEvent(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent);
31
32
  api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents((0, _blockMenuComponents.getBlockMenuComponents)(api, (_config$enableSourceC = config === null || config === void 0 ? void 0 : config.enableSourceCreation) !== null && _config$enableSourceC !== void 0 ? _config$enableSourceC : false));
32
33
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api, (_config$enableSourceC2 = config === null || config === void 0 ? void 0 : config.enableSourceCreation) !== null && _config$enableSourceC2 !== void 0 ? _config$enableSourceC2 : false));
@@ -436,7 +436,11 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
436
436
  }
437
437
  },
438
438
  filterTransaction: (tr, state) => {
439
- var _api$connectivity3, _api$connectivity3$sh;
439
+ var _api$editorViewMode2, _api$editorViewMode2$, _api$connectivity3, _api$connectivity3$sh;
440
+ const viewMode = api === null || api === void 0 ? void 0 : (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : (_api$editorViewMode2$ = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2$ === void 0 ? void 0 : _api$editorViewMode2$.mode;
441
+ if (viewMode === 'view' && fg('platform_synced_block_patch_8')) {
442
+ return true;
443
+ }
440
444
  const isOffline = isOfflineMode(api === null || api === void 0 ? void 0 : (_api$connectivity3 = api.connectivity) === null || _api$connectivity3 === void 0 ? void 0 : (_api$connectivity3$sh = _api$connectivity3.sharedState.currentState()) === null || _api$connectivity3$sh === void 0 ? void 0 : _api$connectivity3$sh.mode);
441
445
  const isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
442
446
 
@@ -478,6 +482,12 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
478
482
  });
479
483
  },
480
484
  appendTransaction: (trs, oldState, newState) => {
485
+ var _api$editorViewMode3, _api$editorViewMode3$;
486
+ const viewMode = api === null || api === void 0 ? void 0 : (_api$editorViewMode3 = api.editorViewMode) === null || _api$editorViewMode3 === void 0 ? void 0 : (_api$editorViewMode3$ = _api$editorViewMode3.sharedState.currentState()) === null || _api$editorViewMode3$ === void 0 ? void 0 : _api$editorViewMode3$.mode;
487
+ if (viewMode === 'view' && fg('platform_synced_block_patch_8')) {
488
+ return null;
489
+ }
490
+
481
491
  // Update source sync block cache for user-initiated changes only
482
492
  // When fg is ON, cache updates are handled here instead of in the nodeview update()
483
493
  if (fg('platform_synced_block_update_refactor')) {
@@ -18,9 +18,10 @@ export const syncedBlockPlugin = ({
18
18
  config,
19
19
  api
20
20
  }) => {
21
- var _api$analytics, _api$analytics$action, _api$blockMenu, _config$enableSourceC, _api$toolbar, _config$enableSourceC2;
21
+ var _api$editorViewMode, _api$editorViewMode$s, _api$analytics, _api$analytics$action, _api$blockMenu, _config$enableSourceC, _api$toolbar, _config$enableSourceC2;
22
22
  const refs = {};
23
- const syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
23
+ const viewMode = api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode;
24
+ const syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider, viewMode);
24
25
  syncBlockStore.setFireAnalyticsEvent(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.fireAnalyticsEvent);
25
26
  api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(getBlockMenuComponents(api, (_config$enableSourceC = config === null || config === void 0 ? void 0 : config.enableSourceCreation) !== null && _config$enableSourceC !== void 0 ? _config$enableSourceC : false));
26
27
  api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents(api, (_config$enableSourceC2 = config === null || config === void 0 ? void 0 : config.enableSourceCreation) !== null && _config$enableSourceC2 !== void 0 ? _config$enableSourceC2 : false));
@@ -465,7 +465,11 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
465
465
  }
466
466
  },
467
467
  filterTransaction: function filterTransaction(tr, state) {
468
- var _api$connectivity3;
468
+ var _api$editorViewMode2, _api$connectivity3;
469
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode;
470
+ if (viewMode === 'view' && fg('platform_synced_block_patch_8')) {
471
+ return true;
472
+ }
469
473
  var isOffline = isOfflineMode(api === null || api === void 0 || (_api$connectivity3 = api.connectivity) === null || _api$connectivity3 === void 0 || (_api$connectivity3 = _api$connectivity3.sharedState.currentState()) === null || _api$connectivity3 === void 0 ? void 0 : _api$connectivity3.mode);
470
474
  var isConfirmedSyncBlockDeletion = Boolean(tr.getMeta('isConfirmedSyncBlockDeletion'));
471
475
 
@@ -507,6 +511,12 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
507
511
  });
508
512
  },
509
513
  appendTransaction: function appendTransaction(trs, oldState, newState) {
514
+ var _api$editorViewMode3;
515
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode3 = api.editorViewMode) === null || _api$editorViewMode3 === void 0 || (_api$editorViewMode3 = _api$editorViewMode3.sharedState.currentState()) === null || _api$editorViewMode3 === void 0 ? void 0 : _api$editorViewMode3.mode;
516
+ if (viewMode === 'view' && fg('platform_synced_block_patch_8')) {
517
+ return null;
518
+ }
519
+
510
520
  // Update source sync block cache for user-initiated changes only
511
521
  // When fg is ON, cache updates are handled here instead of in the nodeview update()
512
522
  if (fg('platform_synced_block_update_refactor')) {
@@ -15,11 +15,12 @@ import { getQuickInsertConfig } from './ui/quick-insert';
15
15
  import { SyncBlockRefresher } from './ui/SyncBlockRefresher';
16
16
  import { getToolbarComponents } from './ui/toolbar-components';
17
17
  export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
18
- var _api$analytics, _api$blockMenu, _config$enableSourceC, _api$toolbar, _config$enableSourceC2;
18
+ var _api$editorViewMode, _api$analytics, _api$blockMenu, _config$enableSourceC, _api$toolbar, _config$enableSourceC2;
19
19
  var config = _ref.config,
20
20
  api = _ref.api;
21
21
  var refs = {};
22
- var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
22
+ var viewMode = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode;
23
+ var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider, viewMode);
23
24
  syncBlockStore.setFireAnalyticsEvent(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent);
24
25
  api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(getBlockMenuComponents(api, (_config$enableSourceC = config === null || config === void 0 ? void 0 : config.enableSourceCreation) !== null && _config$enableSourceC !== void 0 ? _config$enableSourceC : false));
25
26
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents(api, (_config$enableSourceC2 = config === null || config === void 0 ? void 0 : config.enableSourceCreation) !== null && _config$enableSourceC2 !== void 0 ? _config$enableSourceC2 : false));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "6.0.43",
3
+ "version": "6.0.44",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -47,7 +47,7 @@
47
47
  "@atlaskit/editor-toolbar": "^0.20.0",
48
48
  "@atlaskit/flag": "^17.9.0",
49
49
  "@atlaskit/icon": "34.0.1",
50
- "@atlaskit/icon-lab": "^6.2.0",
50
+ "@atlaskit/icon-lab": "^6.3.0",
51
51
  "@atlaskit/logo": "^19.10.0",
52
52
  "@atlaskit/lozenge": "^13.5.0",
53
53
  "@atlaskit/modal-dialog": "^14.14.0",