@atlaskit/editor-plugin-synced-block 24.0.1 → 24.0.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 24.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f53a04e7c8b40`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f53a04e7c8b40) -
8
+ Restore the editor-synced-block-same-page-sync experiment guards to prevent Jira fetch-only
9
+ renderers from entering the same-document write-provider path.
10
+ - Updated dependencies
11
+
12
+ ## 24.0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 24.0.1
4
19
 
5
20
  ### Patch Changes
@@ -15,6 +15,7 @@ var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
15
15
  var _syncBlock = require("@atlaskit/editor-common/sync-block");
16
16
  var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
17
17
  var _model = require("@atlaskit/editor-prosemirror/model");
18
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
18
19
  var _getUnpublishedSourceType = require("../ui/getUnpublishedSourceType");
19
20
  var _SyncBlockLabel = require("../ui/SyncBlockLabel");
20
21
  var _isEmptySourceSyncBlock = require("./isEmptySourceSyncBlock");
@@ -33,9 +34,10 @@ var SourceSyncBlockLabel = exports.SourceSyncBlockLabel = function SourceSyncBlo
33
34
  var localId = _ref.localId,
34
35
  resourceId = _ref.resourceId,
35
36
  sourceManager = _ref.sourceManager;
37
+ var isSamePageSyncEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('editor-synced-block-same-page-sync');
36
38
  var _useState = (0, _react.useState)(function () {
37
39
  var _sourceManager$getLoc;
38
- return (sourceManager === null || sourceManager === void 0 || (_sourceManager$getLoc = sourceManager.getLocalSourceSnapshot(resourceId)) === null || _sourceManager$getLoc === void 0 ? void 0 : _sourceManager$getLoc.status) === 'unpublished';
40
+ return isSamePageSyncEnabled && (sourceManager === null || sourceManager === void 0 || (_sourceManager$getLoc = sourceManager.getLocalSourceSnapshot(resourceId)) === null || _sourceManager$getLoc === void 0 ? void 0 : _sourceManager$getLoc.status) === 'unpublished';
39
41
  }),
40
42
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
41
43
  isUnpublished = _useState2[0],
@@ -45,6 +47,9 @@ var SourceSyncBlockLabel = exports.SourceSyncBlockLabel = function SourceSyncBlo
45
47
  sourceInfo = _useState4[0],
46
48
  setSourceInfo = _useState4[1];
47
49
  (0, _react.useEffect)(function () {
50
+ if (!isSamePageSyncEnabled) {
51
+ return;
52
+ }
48
53
  var isMounted = true;
49
54
  void (sourceManager === null || sourceManager === void 0 ? void 0 : sourceManager.getSyncBlockSourceInfo(localId).then(function (nextSourceInfo) {
50
55
  if (isMounted) {
@@ -58,11 +63,11 @@ var SourceSyncBlockLabel = exports.SourceSyncBlockLabel = function SourceSyncBlo
58
63
  isMounted = false;
59
64
  unsubscribe === null || unsubscribe === void 0 || unsubscribe();
60
65
  };
61
- }, [localId, resourceId, sourceManager]);
66
+ }, [isSamePageSyncEnabled, localId, resourceId, sourceManager]);
62
67
  return /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, {
63
68
  isSource: true,
64
69
  localId: localId,
65
- unpublishedInfo: isUnpublished ? {
70
+ unpublishedInfo: isSamePageSyncEnabled && isUnpublished ? {
66
71
  sourceType: (0, _getUnpublishedSourceType.getUnpublishedSourceType)({
67
72
  sourceAri: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.sourceAri,
68
73
  sourceProduct: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.productType
@@ -24,11 +24,12 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
24
24
  resourceId = _ref.resourceId,
25
25
  localId = _ref.localId,
26
26
  api = _ref.api;
27
+ var isSamePageSyncEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('editor-synced-block-same-page-sync');
27
28
  var syncBlockFetchResult = (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(syncBlockStore, resourceId, localId, 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);
28
29
  var title = (0, _editorSyncedBlockProvider.useFetchSyncBlockTitle)(syncBlockStore, node);
29
30
  var contentUpdatedAt = syncBlockFetchResult === null || syncBlockFetchResult === void 0 || (_syncBlockFetchResult = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult === void 0 || (_syncBlockFetchResult = _syncBlockFetchResult.data) === null || _syncBlockFetchResult === void 0 ? void 0 : _syncBlockFetchResult.contentUpdatedAt;
30
31
  var isUnpublishedBlock = ((_syncBlockFetchResult2 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult2 === void 0 || (_syncBlockFetchResult2 = _syncBlockFetchResult2.data) === null || _syncBlockFetchResult2 === void 0 ? void 0 : _syncBlockFetchResult2.status) === 'unpublished';
31
- var localSameDocumentSource = (_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 ? void 0 : _syncBlockFetchResult3.localSameDocumentSource;
32
+ var localSameDocumentSource = isSamePageSyncEnabled ? (_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 ? void 0 : _syncBlockFetchResult3.localSameDocumentSource : undefined;
32
33
  var localSourceBlockInstanceId = localSameDocumentSource === null || localSameDocumentSource === void 0 ? void 0 : localSameDocumentSource.sourceBlockInstanceId;
33
34
  var _useState = (0, _react.useState)(),
34
35
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -4,6 +4,7 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
4
4
  import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
5
5
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
6
6
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
7
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
8
  import { getUnpublishedSourceType } from '../ui/getUnpublishedSourceType';
8
9
  import { SyncBlockLabel } from '../ui/SyncBlockLabel';
9
10
  import { isEmptySourceSyncBlock } from './isEmptySourceSyncBlock';
@@ -20,12 +21,16 @@ export const SourceSyncBlockLabel = ({
20
21
  resourceId,
21
22
  sourceManager
22
23
  }) => {
24
+ const isSamePageSyncEnabled = isExperimentEnabled('editor-synced-block-same-page-sync');
23
25
  const [isUnpublished, setIsUnpublished] = useState(() => {
24
26
  var _sourceManager$getLoc;
25
- return (sourceManager === null || sourceManager === void 0 ? void 0 : (_sourceManager$getLoc = sourceManager.getLocalSourceSnapshot(resourceId)) === null || _sourceManager$getLoc === void 0 ? void 0 : _sourceManager$getLoc.status) === 'unpublished';
27
+ return isSamePageSyncEnabled && (sourceManager === null || sourceManager === void 0 ? void 0 : (_sourceManager$getLoc = sourceManager.getLocalSourceSnapshot(resourceId)) === null || _sourceManager$getLoc === void 0 ? void 0 : _sourceManager$getLoc.status) === 'unpublished';
26
28
  });
27
29
  const [sourceInfo, setSourceInfo] = useState();
28
30
  useEffect(() => {
31
+ if (!isSamePageSyncEnabled) {
32
+ return;
33
+ }
29
34
  let isMounted = true;
30
35
  void (sourceManager === null || sourceManager === void 0 ? void 0 : sourceManager.getSyncBlockSourceInfo(localId).then(nextSourceInfo => {
31
36
  if (isMounted) {
@@ -37,11 +42,11 @@ export const SourceSyncBlockLabel = ({
37
42
  isMounted = false;
38
43
  unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
39
44
  };
40
- }, [localId, resourceId, sourceManager]);
45
+ }, [isSamePageSyncEnabled, localId, resourceId, sourceManager]);
41
46
  return /*#__PURE__*/React.createElement(SyncBlockLabel, {
42
47
  isSource: true,
43
48
  localId: localId,
44
- unpublishedInfo: isUnpublished ? {
49
+ unpublishedInfo: isSamePageSyncEnabled && isUnpublished ? {
45
50
  sourceType: getUnpublishedSourceType({
46
51
  sourceAri: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.sourceAri,
47
52
  sourceProduct: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.productType
@@ -15,11 +15,12 @@ const SyncBlockRendererWrapperComponent = ({
15
15
  api
16
16
  }) => {
17
17
  var _api$analytics, _api$analytics$action, _syncBlockFetchResult, _syncBlockFetchResult2, _syncBlockFetchResult3, _syncBlockFetchResult4, _syncBlockFetchResult5, _syncBlockFetchResult6, _syncBlockFetchResult7, _localSourceInfo$sour, _syncBlockFetchResult8, _syncBlockFetchResult9, _localSourceInfo$prod;
18
+ const isSamePageSyncEnabled = isExperimentEnabled('editor-synced-block-same-page-sync');
18
19
  const syncBlockFetchResult = useFetchSyncBlockData(syncBlockStore, resourceId, localId, 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);
19
20
  const title = useFetchSyncBlockTitle(syncBlockStore, node);
20
21
  const contentUpdatedAt = syncBlockFetchResult === null || syncBlockFetchResult === void 0 ? void 0 : (_syncBlockFetchResult = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult === void 0 ? void 0 : (_syncBlockFetchResult2 = _syncBlockFetchResult.data) === null || _syncBlockFetchResult2 === void 0 ? void 0 : _syncBlockFetchResult2.contentUpdatedAt;
21
22
  const isUnpublishedBlock = ((_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 ? void 0 : (_syncBlockFetchResult4 = _syncBlockFetchResult3.data) === null || _syncBlockFetchResult4 === void 0 ? void 0 : _syncBlockFetchResult4.status) === 'unpublished';
22
- const localSameDocumentSource = (_syncBlockFetchResult5 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult5 === void 0 ? void 0 : _syncBlockFetchResult5.localSameDocumentSource;
23
+ const localSameDocumentSource = isSamePageSyncEnabled ? (_syncBlockFetchResult5 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult5 === void 0 ? void 0 : _syncBlockFetchResult5.localSameDocumentSource : undefined;
23
24
  const localSourceBlockInstanceId = localSameDocumentSource === null || localSameDocumentSource === void 0 ? void 0 : localSameDocumentSource.sourceBlockInstanceId;
24
25
  const [localSourceInfo, setLocalSourceInfo] = useState();
25
26
  useEffect(() => {
@@ -7,6 +7,7 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
7
7
  import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
8
8
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
9
9
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
10
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
10
11
  import { getUnpublishedSourceType } from '../ui/getUnpublishedSourceType';
11
12
  import { SyncBlockLabel } from '../ui/SyncBlockLabel';
12
13
  import { isEmptySourceSyncBlock } from './isEmptySourceSyncBlock';
@@ -24,9 +25,10 @@ export var SourceSyncBlockLabel = function SourceSyncBlockLabel(_ref) {
24
25
  var localId = _ref.localId,
25
26
  resourceId = _ref.resourceId,
26
27
  sourceManager = _ref.sourceManager;
28
+ var isSamePageSyncEnabled = isExperimentEnabled('editor-synced-block-same-page-sync');
27
29
  var _useState = useState(function () {
28
30
  var _sourceManager$getLoc;
29
- return (sourceManager === null || sourceManager === void 0 || (_sourceManager$getLoc = sourceManager.getLocalSourceSnapshot(resourceId)) === null || _sourceManager$getLoc === void 0 ? void 0 : _sourceManager$getLoc.status) === 'unpublished';
31
+ return isSamePageSyncEnabled && (sourceManager === null || sourceManager === void 0 || (_sourceManager$getLoc = sourceManager.getLocalSourceSnapshot(resourceId)) === null || _sourceManager$getLoc === void 0 ? void 0 : _sourceManager$getLoc.status) === 'unpublished';
30
32
  }),
31
33
  _useState2 = _slicedToArray(_useState, 2),
32
34
  isUnpublished = _useState2[0],
@@ -36,6 +38,9 @@ export var SourceSyncBlockLabel = function SourceSyncBlockLabel(_ref) {
36
38
  sourceInfo = _useState4[0],
37
39
  setSourceInfo = _useState4[1];
38
40
  useEffect(function () {
41
+ if (!isSamePageSyncEnabled) {
42
+ return;
43
+ }
39
44
  var isMounted = true;
40
45
  void (sourceManager === null || sourceManager === void 0 ? void 0 : sourceManager.getSyncBlockSourceInfo(localId).then(function (nextSourceInfo) {
41
46
  if (isMounted) {
@@ -49,11 +54,11 @@ export var SourceSyncBlockLabel = function SourceSyncBlockLabel(_ref) {
49
54
  isMounted = false;
50
55
  unsubscribe === null || unsubscribe === void 0 || unsubscribe();
51
56
  };
52
- }, [localId, resourceId, sourceManager]);
57
+ }, [isSamePageSyncEnabled, localId, resourceId, sourceManager]);
53
58
  return /*#__PURE__*/React.createElement(SyncBlockLabel, {
54
59
  isSource: true,
55
60
  localId: localId,
56
- unpublishedInfo: isUnpublished ? {
61
+ unpublishedInfo: isSamePageSyncEnabled && isUnpublished ? {
57
62
  sourceType: getUnpublishedSourceType({
58
63
  sourceAri: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.sourceAri,
59
64
  sourceProduct: sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.productType
@@ -15,11 +15,12 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
15
15
  resourceId = _ref.resourceId,
16
16
  localId = _ref.localId,
17
17
  api = _ref.api;
18
+ var isSamePageSyncEnabled = isExperimentEnabled('editor-synced-block-same-page-sync');
18
19
  var syncBlockFetchResult = useFetchSyncBlockData(syncBlockStore, resourceId, localId, 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);
19
20
  var title = useFetchSyncBlockTitle(syncBlockStore, node);
20
21
  var contentUpdatedAt = syncBlockFetchResult === null || syncBlockFetchResult === void 0 || (_syncBlockFetchResult = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult === void 0 || (_syncBlockFetchResult = _syncBlockFetchResult.data) === null || _syncBlockFetchResult === void 0 ? void 0 : _syncBlockFetchResult.contentUpdatedAt;
21
22
  var isUnpublishedBlock = ((_syncBlockFetchResult2 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult2 === void 0 || (_syncBlockFetchResult2 = _syncBlockFetchResult2.data) === null || _syncBlockFetchResult2 === void 0 ? void 0 : _syncBlockFetchResult2.status) === 'unpublished';
22
- var localSameDocumentSource = (_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 ? void 0 : _syncBlockFetchResult3.localSameDocumentSource;
23
+ var localSameDocumentSource = isSamePageSyncEnabled ? (_syncBlockFetchResult3 = syncBlockFetchResult.syncBlockInstance) === null || _syncBlockFetchResult3 === void 0 ? void 0 : _syncBlockFetchResult3.localSameDocumentSource : undefined;
23
24
  var localSourceBlockInstanceId = localSameDocumentSource === null || localSameDocumentSource === void 0 ? void 0 : localSameDocumentSource.sourceBlockInstanceId;
24
25
  var _useState = useState(),
25
26
  _useState2 = _slicedToArray(_useState, 2),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "24.0.1",
3
+ "version": "24.0.3",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -21,12 +21,12 @@
21
21
  "atlaskit:src": "src/index.ts",
22
22
  "dependencies": {
23
23
  "@atlaskit/adf-schema": "^57.7.0",
24
- "@atlaskit/button": "25.4.6",
24
+ "@atlaskit/button": "25.4.7",
25
25
  "@atlaskit/dropdown-menu": "21.0.0",
26
26
  "@atlaskit/editor-json-transformer": "^10.0.0",
27
27
  "@atlaskit/editor-plugin-analytics": "^26.0.0",
28
28
  "@atlaskit/editor-plugin-block-controls": "^27.0.0",
29
- "@atlaskit/editor-plugin-block-menu": "^25.0.0",
29
+ "@atlaskit/editor-plugin-block-menu": "^25.1.0",
30
30
  "@atlaskit/editor-plugin-connectivity": "26.0.0",
31
31
  "@atlaskit/editor-plugin-content-format": "^20.0.0",
32
32
  "@atlaskit/editor-plugin-decorations": "^26.0.0",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/editor-plugin-ui-control-registry": "^20.0.0",
41
41
  "@atlaskit/editor-plugin-user-intent": "^24.0.0",
42
42
  "@atlaskit/editor-prosemirror": "^9.0.0",
43
- "@atlaskit/editor-shared-styles": "^4.3.0",
43
+ "@atlaskit/editor-shared-styles": "^4.4.0",
44
44
  "@atlaskit/editor-synced-block-provider": "^22.0.0",
45
45
  "@atlaskit/editor-toolbar": "^2.8.0",
46
46
  "@atlaskit/flag": "^19.0.0",
@@ -53,8 +53,8 @@
53
53
  "@atlaskit/platform-feature-flags": "^2.2.0",
54
54
  "@atlaskit/primitives": "^22.5.0",
55
55
  "@atlaskit/spinner": "20.4.4",
56
- "@atlaskit/tmp-editor-statsig": "^228.0.0",
57
- "@atlaskit/tokens": "20.4.0",
56
+ "@atlaskit/tmp-editor-statsig": "^229.0.0",
57
+ "@atlaskit/tokens": "20.4.1",
58
58
  "@atlaskit/tooltip": "^24.4.0",
59
59
  "@atlaskit/visually-hidden": "^4.4.0",
60
60
  "@babel/runtime": "^7.0.0",
@@ -65,7 +65,7 @@
65
65
  "memoize-one": "^6.0.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@atlaskit/editor-common": "^130.1.0",
68
+ "@atlaskit/editor-common": "^130.3.0",
69
69
  "react": "^18.2.0 || ^19.2.0",
70
70
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
71
71
  },