@atlaskit/editor-plugin-synced-block 4.0.1 → 4.1.0
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 +11 -0
- package/dist/cjs/nodeviews/syncedBlock.js +9 -7
- package/dist/cjs/ui/SyncBlockRefresher.js +3 -3
- package/dist/es2019/nodeviews/syncedBlock.js +9 -6
- package/dist/es2019/ui/SyncBlockRefresher.js +2 -2
- package/dist/esm/nodeviews/syncedBlock.js +9 -7
- package/dist/esm/ui/SyncBlockRefresher.js +2 -2
- package/dist/types/syncedBlockPluginType.d.ts +2 -2
- package/dist/types/ui/SyncBlockLabel.d.ts +1 -1
- package/dist/types/ui/SyncBlockRefresher.d.ts +1 -0
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +2 -2
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +2 -2
- package/dist/types-ts4.5/ui/SyncBlockLabel.d.ts +1 -1
- package/dist/types-ts4.5/ui/SyncBlockRefresher.d.ts +1 -0
- package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`261fa27c56fd0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/261fa27c56fd0) -
|
|
8
|
+
EDITOR-2533 implement retry function for sync-block renderer
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 4.0.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -46,18 +46,23 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
46
46
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
+
var _this$node$attrs = this.node.attrs,
|
|
50
|
+
resourceId = _this$node$attrs.resourceId,
|
|
51
|
+
localId = _this$node$attrs.localId;
|
|
52
|
+
if (!resourceId || !localId) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
49
55
|
|
|
50
56
|
// get document node from data provider
|
|
51
|
-
|
|
52
57
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
53
58
|
localId: this.node.attrs.localId,
|
|
54
59
|
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
55
60
|
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
56
|
-
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
57
|
-
return (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(_this2.syncBlockStore, _this2.node);
|
|
58
|
-
},
|
|
59
61
|
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
60
62
|
return (0, _editorSyncedBlockProvider.useFetchSyncBlockTitle)(_this2.syncBlockStore, _this2.node);
|
|
63
|
+
},
|
|
64
|
+
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
65
|
+
return (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(_this2.syncBlockStore, resourceId, localId);
|
|
61
66
|
}
|
|
62
67
|
});
|
|
63
68
|
}
|
|
@@ -65,9 +70,6 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
65
70
|
key: "destroy",
|
|
66
71
|
value: function destroy() {
|
|
67
72
|
var _this$unsubscribe;
|
|
68
|
-
if (this.fetchIntervalId) {
|
|
69
|
-
window.clearInterval(this.fetchIntervalId);
|
|
70
|
-
}
|
|
71
73
|
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
|
|
72
74
|
_superPropGet(SyncBlock, "destroy", this, 3)([]);
|
|
73
75
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SyncBlockRefresher = void 0;
|
|
6
|
+
exports.SyncBlockRefresher = exports.SYNC_BLOCK_FETCH_INTERVAL = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
8
|
+
var SYNC_BLOCK_FETCH_INTERVAL = exports.SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
9
9
|
|
|
10
10
|
// Component that refreshes synced block subscriptions at regular intervals
|
|
11
11
|
// this is a workaround for the subscription mechanism not being real-time
|
|
@@ -18,7 +18,7 @@ var SyncBlockRefresher = exports.SyncBlockRefresher = function SyncBlockRefreshe
|
|
|
18
18
|
if (((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) === 'visible') {
|
|
19
19
|
syncBlockStoreManager.refreshSubscriptions();
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, SYNC_BLOCK_FETCH_INTERVAL);
|
|
22
22
|
return function () {
|
|
23
23
|
window.clearInterval(interval);
|
|
24
24
|
};
|
|
@@ -19,22 +19,25 @@ class SyncBlock extends ReactNodeView {
|
|
|
19
19
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
+
const {
|
|
23
|
+
resourceId,
|
|
24
|
+
localId
|
|
25
|
+
} = this.node.attrs;
|
|
26
|
+
if (!resourceId || !localId) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
22
29
|
|
|
23
30
|
// get document node from data provider
|
|
24
|
-
|
|
25
31
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
26
32
|
localId: this.node.attrs.localId,
|
|
27
33
|
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
28
34
|
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
useFetchSyncBlockTitle: () => useFetchSyncBlockTitle(this.syncBlockStore, this.node),
|
|
36
|
+
useFetchSyncBlockData: () => useFetchSyncBlockData(this.syncBlockStore, resourceId, localId)
|
|
31
37
|
});
|
|
32
38
|
}
|
|
33
39
|
destroy() {
|
|
34
40
|
var _this$unsubscribe;
|
|
35
|
-
if (this.fetchIntervalId) {
|
|
36
|
-
window.clearInterval(this.fetchIntervalId);
|
|
37
|
-
}
|
|
38
41
|
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
|
|
39
42
|
super.destroy();
|
|
40
43
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
const
|
|
2
|
+
export const SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
3
3
|
|
|
4
4
|
// Component that refreshes synced block subscriptions at regular intervals
|
|
5
5
|
// this is a workaround for the subscription mechanism not being real-time
|
|
@@ -13,7 +13,7 @@ export const SyncBlockRefresher = ({
|
|
|
13
13
|
if (((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) === 'visible') {
|
|
14
14
|
syncBlockStoreManager.refreshSubscriptions();
|
|
15
15
|
}
|
|
16
|
-
},
|
|
16
|
+
}, SYNC_BLOCK_FETCH_INTERVAL);
|
|
17
17
|
return () => {
|
|
18
18
|
window.clearInterval(interval);
|
|
19
19
|
};
|
|
@@ -39,18 +39,23 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
39
39
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
|
+
var _this$node$attrs = this.node.attrs,
|
|
43
|
+
resourceId = _this$node$attrs.resourceId,
|
|
44
|
+
localId = _this$node$attrs.localId;
|
|
45
|
+
if (!resourceId || !localId) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
42
48
|
|
|
43
49
|
// get document node from data provider
|
|
44
|
-
|
|
45
50
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
46
51
|
localId: this.node.attrs.localId,
|
|
47
52
|
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
48
53
|
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
49
|
-
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
50
|
-
return _useFetchSyncBlockData(_this2.syncBlockStore, _this2.node);
|
|
51
|
-
},
|
|
52
54
|
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
53
55
|
return _useFetchSyncBlockTitle(_this2.syncBlockStore, _this2.node);
|
|
56
|
+
},
|
|
57
|
+
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
58
|
+
return _useFetchSyncBlockData(_this2.syncBlockStore, resourceId, localId);
|
|
54
59
|
}
|
|
55
60
|
});
|
|
56
61
|
}
|
|
@@ -58,9 +63,6 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
58
63
|
key: "destroy",
|
|
59
64
|
value: function destroy() {
|
|
60
65
|
var _this$unsubscribe;
|
|
61
|
-
if (this.fetchIntervalId) {
|
|
62
|
-
window.clearInterval(this.fetchIntervalId);
|
|
63
|
-
}
|
|
64
66
|
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
|
|
65
67
|
_superPropGet(SyncBlock, "destroy", this, 3)([]);
|
|
66
68
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
var
|
|
2
|
+
export var SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
3
3
|
|
|
4
4
|
// Component that refreshes synced block subscriptions at regular intervals
|
|
5
5
|
// this is a workaround for the subscription mechanism not being real-time
|
|
@@ -12,7 +12,7 @@ export var SyncBlockRefresher = function SyncBlockRefresher(_ref) {
|
|
|
12
12
|
if (((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) === 'visible') {
|
|
13
13
|
syncBlockStoreManager.refreshSubscriptions();
|
|
14
14
|
}
|
|
15
|
-
},
|
|
15
|
+
}, SYNC_BLOCK_FETCH_INTERVAL);
|
|
16
16
|
return function () {
|
|
17
17
|
window.clearInterval(interval);
|
|
18
18
|
};
|
|
@@ -9,7 +9,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
9
9
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
10
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
12
|
-
import type {
|
|
12
|
+
import type { SyncBlockDataProvider, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
13
13
|
export type SyncedBlockEditorProps = {
|
|
14
14
|
defaultDocument: JSONDocNode;
|
|
15
15
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -34,7 +34,7 @@ export type SyncedBlockEditorProps = {
|
|
|
34
34
|
};
|
|
35
35
|
export type SyncedBlockRendererProps = {
|
|
36
36
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
|
-
useFetchSyncBlockData: () =>
|
|
37
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
38
38
|
};
|
|
39
39
|
export type SyncedBlockPluginOptions = {
|
|
40
40
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
@@ -4,5 +4,5 @@ type SyncBlockLabelProps = {
|
|
|
4
4
|
localId: string;
|
|
5
5
|
useFetchSyncBlockTitle?: () => string | undefined;
|
|
6
6
|
};
|
|
7
|
-
export declare const SyncBlockLabel: React.MemoExoticComponent<({ isSource, useFetchSyncBlockTitle, localId }: SyncBlockLabelProps) => React.JSX.Element>;
|
|
7
|
+
export declare const SyncBlockLabel: React.MemoExoticComponent<({ isSource, useFetchSyncBlockTitle, localId, }: SyncBlockLabelProps) => React.JSX.Element>;
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
2
|
+
export declare const SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
2
3
|
export declare const SyncBlockRefresher: ({ syncBlockStoreManager, }: {
|
|
3
4
|
syncBlockStoreManager: SyncBlockStoreManager;
|
|
4
5
|
}) => null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
7
|
localId: string;
|
|
8
8
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
9
|
-
useFetchSyncBlockData: () =>
|
|
9
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
10
10
|
useFetchSyncBlockTitle: () => string | undefined;
|
|
11
11
|
};
|
|
12
12
|
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
@@ -9,7 +9,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
9
9
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
10
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
12
|
-
import type {
|
|
12
|
+
import type { SyncBlockDataProvider, UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
13
13
|
export type SyncedBlockEditorProps = {
|
|
14
14
|
defaultDocument: JSONDocNode;
|
|
15
15
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -34,7 +34,7 @@ export type SyncedBlockEditorProps = {
|
|
|
34
34
|
};
|
|
35
35
|
export type SyncedBlockRendererProps = {
|
|
36
36
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
|
-
useFetchSyncBlockData: () =>
|
|
37
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
38
38
|
};
|
|
39
39
|
export type SyncedBlockPluginOptions = {
|
|
40
40
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
@@ -4,5 +4,5 @@ type SyncBlockLabelProps = {
|
|
|
4
4
|
localId: string;
|
|
5
5
|
useFetchSyncBlockTitle?: () => string | undefined;
|
|
6
6
|
};
|
|
7
|
-
export declare const SyncBlockLabel: React.MemoExoticComponent<({ isSource, useFetchSyncBlockTitle, localId }: SyncBlockLabelProps) => React.JSX.Element>;
|
|
7
|
+
export declare const SyncBlockLabel: React.MemoExoticComponent<({ isSource, useFetchSyncBlockTitle, localId, }: SyncBlockLabelProps) => React.JSX.Element>;
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
2
|
+
export declare const SYNC_BLOCK_FETCH_INTERVAL = 3000;
|
|
2
3
|
export declare const SyncBlockRefresher: ({ syncBlockStoreManager, }: {
|
|
3
4
|
syncBlockStoreManager: SyncBlockStoreManager;
|
|
4
5
|
}) => null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
4
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
5
5
|
type Props = {
|
|
6
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
7
|
localId: string;
|
|
8
8
|
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
9
|
-
useFetchSyncBlockData: () =>
|
|
9
|
+
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
10
10
|
useFetchSyncBlockTitle: () => string | undefined;
|
|
11
11
|
};
|
|
12
12
|
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.8.0",
|
|
41
|
-
"@atlaskit/editor-synced-block-provider": "^2.
|
|
41
|
+
"@atlaskit/editor-synced-block-provider": "^2.6.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
43
|
"@atlaskit/editor-toolbar": "^0.17.0",
|
|
44
44
|
"@atlaskit/icon": "28.5.3",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^110.
|
|
55
|
+
"@atlaskit/editor-common": "^110.22.0",
|
|
56
56
|
"react": "^18.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|