@atlaskit/editor-plugin-synced-block 3.0.5 → 3.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 +17 -0
- package/dist/cjs/nodeviews/syncedBlock.js +3 -3
- package/dist/es2019/nodeviews/syncedBlock.js +5 -5
- package/dist/esm/nodeviews/syncedBlock.js +3 -3
- package/dist/types/syncedBlockPluginType.d.ts +1 -2
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +1 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`9e7a5a0bb1869`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9e7a5a0bb1869) -
|
|
8
|
+
Add content api sync block provider
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 3.0.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 3.0.5
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -74,7 +74,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
74
74
|
}
|
|
75
75
|
// write data
|
|
76
76
|
var node = (0, _editorSyncedBlockProvider.convertSyncBlockPMNodeToSyncBlockData)(this.node, false);
|
|
77
|
-
(_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.
|
|
77
|
+
(_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.dataProvider) === null || _this$options === void 0 || _this$options.writeNodesData([node], [{
|
|
78
78
|
content: updatedDoc.toJSON()
|
|
79
79
|
}]);
|
|
80
80
|
}
|
|
@@ -84,7 +84,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
84
84
|
var _this$options2;
|
|
85
85
|
// set inner editor view
|
|
86
86
|
var nodes = [(0, _editorSyncedBlockProvider.convertSyncBlockPMNodeToSyncBlockData)(this.node, false)];
|
|
87
|
-
(_this$options2 = this.options) === null || _this$options2 === void 0 || (_this$options2 = _this$options2.
|
|
87
|
+
(_this$options2 = this.options) === null || _this$options2 === void 0 || (_this$options2 = _this$options2.dataProvider) === null || _this$options2 === void 0 || _this$options2.fetchNodesData(nodes).then(function (data) {
|
|
88
88
|
var _data$;
|
|
89
89
|
var tr = editorView.state.tr;
|
|
90
90
|
if (data && (_data$ = data[0]) !== null && _data$ !== void 0 && _data$.content) {
|
|
@@ -134,7 +134,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
134
134
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
135
135
|
useFetchDocNode: function useFetchDocNode() {
|
|
136
136
|
var _this3$options;
|
|
137
|
-
return (0, _editorSyncedBlockProvider.useFetchDocNode)(_this3.view, _this3.node, defaultSyncBlockRendererDocument, (_this3$options = _this3.options) === null || _this3$options === void 0 ? void 0 : _this3$options.
|
|
137
|
+
return (0, _editorSyncedBlockProvider.useFetchDocNode)(_this3.view, _this3.node, defaultSyncBlockRendererDocument, (_this3$options = _this3.options) === null || _this3$options === void 0 ? void 0 : _this3$options.dataProvider);
|
|
138
138
|
},
|
|
139
139
|
getSyncedBlockRenderer: (_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.getSyncedBlockRenderer
|
|
140
140
|
});
|
|
@@ -42,21 +42,21 @@ class SyncBlock extends ReactNodeView {
|
|
|
42
42
|
return this.syncBlockStore.isSourceBlock(this.node);
|
|
43
43
|
}
|
|
44
44
|
handleContentChanges(updatedDoc) {
|
|
45
|
-
var _this$options, _this$options$
|
|
45
|
+
var _this$options, _this$options$dataPro;
|
|
46
46
|
if (!this.isSource) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
// write data
|
|
50
50
|
const node = convertSyncBlockPMNodeToSyncBlockData(this.node, false);
|
|
51
|
-
(_this$options = this.options) === null || _this$options === void 0 ? void 0 : (_this$options$
|
|
51
|
+
(_this$options = this.options) === null || _this$options === void 0 ? void 0 : (_this$options$dataPro = _this$options.dataProvider) === null || _this$options$dataPro === void 0 ? void 0 : _this$options$dataPro.writeNodesData([node], [{
|
|
52
52
|
content: updatedDoc.toJSON()
|
|
53
53
|
}]);
|
|
54
54
|
}
|
|
55
55
|
setInnerEditorView(editorView) {
|
|
56
|
-
var _this$options2, _this$options2$
|
|
56
|
+
var _this$options2, _this$options2$dataPr;
|
|
57
57
|
// set inner editor view
|
|
58
58
|
const nodes = [convertSyncBlockPMNodeToSyncBlockData(this.node, false)];
|
|
59
|
-
(_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$
|
|
59
|
+
(_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$dataPr = _this$options2.dataProvider) === null || _this$options2$dataPr === void 0 ? void 0 : _this$options2$dataPr.fetchNodesData(nodes).then(data => {
|
|
60
60
|
var _data$;
|
|
61
61
|
const tr = editorView.state.tr;
|
|
62
62
|
if (data && (_data$ = data[0]) !== null && _data$ !== void 0 && _data$.content) {
|
|
@@ -94,7 +94,7 @@ class SyncBlock extends ReactNodeView {
|
|
|
94
94
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
95
95
|
useFetchDocNode: () => {
|
|
96
96
|
var _this$options6;
|
|
97
|
-
return useFetchDocNode(this.view, this.node, defaultSyncBlockRendererDocument, (_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.
|
|
97
|
+
return useFetchDocNode(this.view, this.node, defaultSyncBlockRendererDocument, (_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.dataProvider);
|
|
98
98
|
},
|
|
99
99
|
getSyncedBlockRenderer: (_this$options7 = this.options) === null || _this$options7 === void 0 ? void 0 : _this$options7.getSyncedBlockRenderer
|
|
100
100
|
});
|
|
@@ -67,7 +67,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
67
67
|
}
|
|
68
68
|
// write data
|
|
69
69
|
var node = convertSyncBlockPMNodeToSyncBlockData(this.node, false);
|
|
70
|
-
(_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.
|
|
70
|
+
(_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.dataProvider) === null || _this$options === void 0 || _this$options.writeNodesData([node], [{
|
|
71
71
|
content: updatedDoc.toJSON()
|
|
72
72
|
}]);
|
|
73
73
|
}
|
|
@@ -77,7 +77,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
77
77
|
var _this$options2;
|
|
78
78
|
// set inner editor view
|
|
79
79
|
var nodes = [convertSyncBlockPMNodeToSyncBlockData(this.node, false)];
|
|
80
|
-
(_this$options2 = this.options) === null || _this$options2 === void 0 || (_this$options2 = _this$options2.
|
|
80
|
+
(_this$options2 = this.options) === null || _this$options2 === void 0 || (_this$options2 = _this$options2.dataProvider) === null || _this$options2 === void 0 || _this$options2.fetchNodesData(nodes).then(function (data) {
|
|
81
81
|
var _data$;
|
|
82
82
|
var tr = editorView.state.tr;
|
|
83
83
|
if (data && (_data$ = data[0]) !== null && _data$ !== void 0 && _data$.content) {
|
|
@@ -127,7 +127,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
127
127
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
128
128
|
useFetchDocNode: function useFetchDocNode() {
|
|
129
129
|
var _this3$options;
|
|
130
|
-
return _useFetchDocNode(_this3.view, _this3.node, defaultSyncBlockRendererDocument, (_this3$options = _this3.options) === null || _this3$options === void 0 ? void 0 : _this3$options.
|
|
130
|
+
return _useFetchDocNode(_this3.view, _this3.node, defaultSyncBlockRendererDocument, (_this3$options = _this3.options) === null || _this3$options === void 0 ? void 0 : _this3$options.dataProvider);
|
|
131
131
|
},
|
|
132
132
|
getSyncedBlockRenderer: (_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.getSyncedBlockRenderer
|
|
133
133
|
});
|
|
@@ -6,7 +6,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
6
6
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
7
7
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
8
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
9
|
-
import type { SyncBlockDataProvider
|
|
9
|
+
import type { SyncBlockDataProvider } from '@atlaskit/editor-synced-block-provider';
|
|
10
10
|
export type SyncedBlockEditorProps = {
|
|
11
11
|
defaultDocument: JSONDocNode;
|
|
12
12
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -36,7 +36,6 @@ export type SyncedBlockPluginOptions = {
|
|
|
36
36
|
dataProvider?: SyncBlockDataProvider;
|
|
37
37
|
getSyncedBlockEditor?: (props: SyncedBlockEditorProps) => React.JSX.Element;
|
|
38
38
|
getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
39
|
-
syncedBlockProvider?: SyncedBlockProvider;
|
|
40
39
|
};
|
|
41
40
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
42
41
|
dependencies: [SelectionPlugin, FloatingToolbarPlugin, DecorationsPlugin];
|
|
@@ -6,7 +6,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
6
6
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
7
7
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
8
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
9
|
-
import type { SyncBlockDataProvider
|
|
9
|
+
import type { SyncBlockDataProvider } from '@atlaskit/editor-synced-block-provider';
|
|
10
10
|
export type SyncedBlockEditorProps = {
|
|
11
11
|
defaultDocument: JSONDocNode;
|
|
12
12
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -36,7 +36,6 @@ export type SyncedBlockPluginOptions = {
|
|
|
36
36
|
dataProvider?: SyncBlockDataProvider;
|
|
37
37
|
getSyncedBlockEditor?: (props: SyncedBlockEditorProps) => React.JSX.Element;
|
|
38
38
|
getSyncedBlockRenderer?: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
39
|
-
syncedBlockProvider?: SyncedBlockProvider;
|
|
40
39
|
};
|
|
41
40
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
42
41
|
dependencies: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^51.2.0",
|
|
32
|
-
"@atlaskit/button": "23.
|
|
32
|
+
"@atlaskit/button": "23.5.0",
|
|
33
33
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
34
34
|
"@atlaskit/editor-plugin-floating-toolbar": "^8.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-selection": "^6.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
37
37
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
38
|
-
"@atlaskit/editor-synced-block-provider": "^0.
|
|
38
|
+
"@atlaskit/editor-synced-block-provider": "^0.3.0",
|
|
39
39
|
"@atlaskit/icon": "28.3.0",
|
|
40
40
|
"@atlaskit/modal-dialog": "^14.4.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|