@atlaskit/editor-plugin-synced-block 3.10.0 → 4.0.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 +22 -0
- package/dist/cjs/nodeviews/syncedBlock.js +6 -4
- package/dist/cjs/pm-plugins/main.js +5 -1
- package/dist/cjs/syncedBlockPlugin.js +3 -3
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +3 -1
- package/dist/cjs/ui/floating-toolbar.js +1 -5
- package/dist/es2019/nodeviews/syncedBlock.js +4 -3
- package/dist/es2019/pm-plugins/main.js +3 -1
- package/dist/es2019/syncedBlockPlugin.js +2 -2
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +3 -1
- package/dist/es2019/ui/floating-toolbar.js +1 -1
- package/dist/esm/nodeviews/syncedBlock.js +6 -4
- package/dist/esm/pm-plugins/main.js +5 -1
- package/dist/esm/syncedBlockPlugin.js +3 -3
- package/dist/esm/ui/SyncBlockRendererWrapper.js +3 -1
- package/dist/esm/ui/floating-toolbar.js +1 -5
- package/dist/types/syncedBlockPluginType.d.ts +7 -5
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +5 -3
- package/dist/types/ui/floating-toolbar.d.ts +2 -3
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +7 -5
- package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +5 -3
- package/dist/types-ts4.5/ui/floating-toolbar.d.ts +2 -3
- package/package.json +3 -3
- package/afm-post-office/tsconfig.json +0 -68
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`181018115c031`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/181018115c031) -
|
|
8
|
+
EDITOR-2438 Pass data providers to Synced Block nested renderer
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 3.11.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [`424619eee38cb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/424619eee38cb) -
|
|
19
|
+
EDITOR-2451 add tests and refactor
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 3.10.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -40,8 +40,9 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
40
40
|
key: "render",
|
|
41
41
|
value: function render() {
|
|
42
42
|
var _this$options,
|
|
43
|
-
|
|
44
|
-
_this$
|
|
43
|
+
_this$options2,
|
|
44
|
+
_this$options3,
|
|
45
|
+
_this2 = this;
|
|
45
46
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
46
47
|
return null;
|
|
47
48
|
}
|
|
@@ -49,10 +50,11 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
49
50
|
// get document node from data provider
|
|
50
51
|
|
|
51
52
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
53
|
+
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
54
|
+
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
52
55
|
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
53
56
|
return (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(_this2.syncBlockStore, _this2.node);
|
|
54
|
-
}
|
|
55
|
-
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer
|
|
57
|
+
}
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
}, {
|
|
@@ -17,7 +17,11 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
17
17
|
return new _safePlugin.SafePlugin({
|
|
18
18
|
key: syncedBlockPluginKey,
|
|
19
19
|
state: {
|
|
20
|
-
init: function init() {
|
|
20
|
+
init: function init(_, instance) {
|
|
21
|
+
var syncBlockNodes = instance.doc.children.filter(function (node) {
|
|
22
|
+
return node.type.name === 'syncBlock';
|
|
23
|
+
});
|
|
24
|
+
syncBlockStore.fetchSyncBlocksData(syncBlockNodes);
|
|
21
25
|
return {};
|
|
22
26
|
},
|
|
23
27
|
apply: function apply(tr, currentPluginState) {
|
|
@@ -21,7 +21,7 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
21
21
|
var _api$blockMenu;
|
|
22
22
|
var config = _ref.config,
|
|
23
23
|
api = _ref.api;
|
|
24
|
-
var syncBlockStore = new _editorSyncedBlockProvider.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.
|
|
24
|
+
var syncBlockStore = new _editorSyncedBlockProvider.SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
|
|
25
25
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents((0, _blockMenuComponents.getBlockMenuComponents)(api));
|
|
26
26
|
return {
|
|
27
27
|
name: 'syncedBlock',
|
|
@@ -82,8 +82,8 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
82
82
|
}
|
|
83
83
|
}];
|
|
84
84
|
},
|
|
85
|
-
floatingToolbar: function floatingToolbar(state, intl
|
|
86
|
-
return (0, _floatingToolbar.getToolbarConfig)(state, intl,
|
|
85
|
+
floatingToolbar: function floatingToolbar(state, intl) {
|
|
86
|
+
return (0, _floatingToolbar.getToolbarConfig)(state, intl, api, syncBlockStore);
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
contentComponent: function contentComponent() {
|
|
@@ -11,13 +11,15 @@ var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
|
11
11
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
12
12
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
13
13
|
var getSyncedBlockRenderer = _ref.getSyncedBlockRenderer,
|
|
14
|
-
useFetchSyncBlockData = _ref.useFetchSyncBlockData
|
|
14
|
+
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
15
|
+
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders;
|
|
15
16
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
16
17
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
17
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
18
19
|
,
|
|
19
20
|
className: _syncBlock.SyncBlockSharedCssClassName.renderer
|
|
20
21
|
}, getSyncedBlockRenderer({
|
|
22
|
+
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
21
23
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
22
24
|
})));
|
|
23
25
|
};
|
|
@@ -19,12 +19,8 @@ var _utils2 = require("../pm-plugins/utils/utils");
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
-
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
22
|
+
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore) {
|
|
23
23
|
var _api$decorations;
|
|
24
|
-
var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
25
|
-
var _providerFactory = arguments.length > 3 ? arguments[3] : undefined;
|
|
26
|
-
var api = arguments.length > 4 ? arguments[4] : undefined;
|
|
27
|
-
var syncBlockStore = arguments.length > 5 ? arguments[5] : undefined;
|
|
28
24
|
var syncBlockObject = (0, _utils2.findSyncBlockOrBodiedSyncBlock)(state);
|
|
29
25
|
if (!syncBlockObject) {
|
|
30
26
|
return;
|
|
@@ -15,7 +15,7 @@ class SyncBlock extends ReactNodeView {
|
|
|
15
15
|
return domRef;
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
|
-
var _this$options, _this$options2;
|
|
18
|
+
var _this$options, _this$options2, _this$options3;
|
|
19
19
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
@@ -23,8 +23,9 @@ class SyncBlock extends ReactNodeView {
|
|
|
23
23
|
// get document node from data provider
|
|
24
24
|
|
|
25
25
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
27
|
+
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
28
|
+
useFetchSyncBlockData: () => useFetchSyncBlockData(this.syncBlockStore, this.node)
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
destroy() {
|
|
@@ -11,7 +11,9 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
11
11
|
return new SafePlugin({
|
|
12
12
|
key: syncedBlockPluginKey,
|
|
13
13
|
state: {
|
|
14
|
-
init() {
|
|
14
|
+
init(_, instance) {
|
|
15
|
+
const syncBlockNodes = instance.doc.children.filter(node => node.type.name === 'syncBlock');
|
|
16
|
+
syncBlockStore.fetchSyncBlocksData(syncBlockNodes);
|
|
15
17
|
return {};
|
|
16
18
|
},
|
|
17
19
|
apply: (tr, currentPluginState) => {
|
|
@@ -15,7 +15,7 @@ export const syncedBlockPlugin = ({
|
|
|
15
15
|
api
|
|
16
16
|
}) => {
|
|
17
17
|
var _api$blockMenu;
|
|
18
|
-
const syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.
|
|
18
|
+
const syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
|
|
19
19
|
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(getBlockMenuComponents(api));
|
|
20
20
|
return {
|
|
21
21
|
name: 'syncedBlock',
|
|
@@ -68,7 +68,7 @@ export const syncedBlockPlugin = ({
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}],
|
|
71
|
-
floatingToolbar: (state, intl
|
|
71
|
+
floatingToolbar: (state, intl) => getToolbarConfig(state, intl, api, syncBlockStore)
|
|
72
72
|
},
|
|
73
73
|
contentComponent: () => {
|
|
74
74
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SyncBlockRefresher, {
|
|
@@ -4,7 +4,8 @@ import { SyncBlockLabel } from './SyncBlockLabel';
|
|
|
4
4
|
const SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
5
5
|
const SyncBlockRendererWrapperComponent = ({
|
|
6
6
|
getSyncedBlockRenderer,
|
|
7
|
-
useFetchSyncBlockData
|
|
7
|
+
useFetchSyncBlockData,
|
|
8
|
+
syncBlockRendererDataProviders
|
|
8
9
|
}) => {
|
|
9
10
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SyncBlockLabel, null), /*#__PURE__*/React.createElement("div", {
|
|
10
11
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
@@ -12,6 +13,7 @@ const SyncBlockRendererWrapperComponent = ({
|
|
|
12
13
|
,
|
|
13
14
|
className: SyncBlockSharedCssClassName.renderer
|
|
14
15
|
}, getSyncedBlockRenderer({
|
|
16
|
+
syncBlockRendererDataProviders,
|
|
15
17
|
useFetchSyncBlockData
|
|
16
18
|
})));
|
|
17
19
|
};
|
|
@@ -7,7 +7,7 @@ import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
|
7
7
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
8
8
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
9
9
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
10
|
-
export const getToolbarConfig = (state, intl,
|
|
10
|
+
export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
|
|
11
11
|
var _api$decorations;
|
|
12
12
|
const syncBlockObject = findSyncBlockOrBodiedSyncBlock(state);
|
|
13
13
|
if (!syncBlockObject) {
|
|
@@ -33,8 +33,9 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
33
33
|
key: "render",
|
|
34
34
|
value: function render() {
|
|
35
35
|
var _this$options,
|
|
36
|
-
|
|
37
|
-
_this$
|
|
36
|
+
_this$options2,
|
|
37
|
+
_this$options3,
|
|
38
|
+
_this2 = this;
|
|
38
39
|
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.getSyncedBlockRenderer)) {
|
|
39
40
|
return null;
|
|
40
41
|
}
|
|
@@ -42,10 +43,11 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
42
43
|
// get document node from data provider
|
|
43
44
|
|
|
44
45
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
46
|
+
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer,
|
|
47
|
+
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
45
48
|
useFetchSyncBlockData: function useFetchSyncBlockData() {
|
|
46
49
|
return _useFetchSyncBlockData(_this2.syncBlockStore, _this2.node);
|
|
47
|
-
}
|
|
48
|
-
getSyncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.getSyncedBlockRenderer
|
|
50
|
+
}
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
}, {
|
|
@@ -11,7 +11,11 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
11
11
|
return new SafePlugin({
|
|
12
12
|
key: syncedBlockPluginKey,
|
|
13
13
|
state: {
|
|
14
|
-
init: function init() {
|
|
14
|
+
init: function init(_, instance) {
|
|
15
|
+
var syncBlockNodes = instance.doc.children.filter(function (node) {
|
|
16
|
+
return node.type.name === 'syncBlock';
|
|
17
|
+
});
|
|
18
|
+
syncBlockStore.fetchSyncBlocksData(syncBlockNodes);
|
|
15
19
|
return {};
|
|
16
20
|
},
|
|
17
21
|
apply: function apply(tr, currentPluginState) {
|
|
@@ -14,7 +14,7 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
|
|
|
14
14
|
var _api$blockMenu;
|
|
15
15
|
var config = _ref.config,
|
|
16
16
|
api = _ref.api;
|
|
17
|
-
var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.
|
|
17
|
+
var syncBlockStore = new SyncBlockStoreManager(config === null || config === void 0 ? void 0 : config.syncBlockDataProvider);
|
|
18
18
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(getBlockMenuComponents(api));
|
|
19
19
|
return {
|
|
20
20
|
name: 'syncedBlock',
|
|
@@ -75,8 +75,8 @@ export var syncedBlockPlugin = function syncedBlockPlugin(_ref) {
|
|
|
75
75
|
}
|
|
76
76
|
}];
|
|
77
77
|
},
|
|
78
|
-
floatingToolbar: function floatingToolbar(state, intl
|
|
79
|
-
return getToolbarConfig(state, intl,
|
|
78
|
+
floatingToolbar: function floatingToolbar(state, intl) {
|
|
79
|
+
return getToolbarConfig(state, intl, api, syncBlockStore);
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
contentComponent: function contentComponent() {
|
|
@@ -4,13 +4,15 @@ import { SyncBlockLabel } from './SyncBlockLabel';
|
|
|
4
4
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
5
5
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
6
6
|
var getSyncedBlockRenderer = _ref.getSyncedBlockRenderer,
|
|
7
|
-
useFetchSyncBlockData = _ref.useFetchSyncBlockData
|
|
7
|
+
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
8
|
+
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders;
|
|
8
9
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SyncBlockLabel, null), /*#__PURE__*/React.createElement("div", {
|
|
9
10
|
"data-testid": SyncBlockRendererWrapperDataId
|
|
10
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
11
12
|
,
|
|
12
13
|
className: SyncBlockSharedCssClassName.renderer
|
|
13
14
|
}, getSyncedBlockRenderer({
|
|
15
|
+
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
14
16
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
15
17
|
})));
|
|
16
18
|
};
|
|
@@ -10,12 +10,8 @@ import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
|
10
10
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
11
11
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock } from '../editor-commands';
|
|
12
12
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
13
|
-
export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
13
|
+
export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore) {
|
|
14
14
|
var _api$decorations;
|
|
15
|
-
var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
16
|
-
var _providerFactory = arguments.length > 3 ? arguments[3] : undefined;
|
|
17
|
-
var api = arguments.length > 4 ? arguments[4] : undefined;
|
|
18
|
-
var syncBlockStore = arguments.length > 5 ? arguments[5] : undefined;
|
|
19
15
|
var syncBlockObject = findSyncBlockOrBodiedSyncBlock(state);
|
|
20
16
|
if (!syncBlockObject) {
|
|
21
17
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -8,7 +9,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
8
9
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
9
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
10
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
11
|
-
import type {
|
|
12
|
+
import type { SyncBlockInstance, SyncBlockDataProvider } from '@atlaskit/editor-synced-block-provider';
|
|
12
13
|
export type SyncedBlockEditorProps = {
|
|
13
14
|
defaultDocument: JSONDocNode;
|
|
14
15
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -32,12 +33,13 @@ export type SyncedBlockEditorProps = {
|
|
|
32
33
|
popupsMountPoint: HTMLElement;
|
|
33
34
|
};
|
|
34
35
|
export type SyncedBlockRendererProps = {
|
|
35
|
-
|
|
36
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
|
+
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
36
38
|
};
|
|
37
39
|
export type SyncedBlockPluginOptions = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
|
+
syncBlockDataProvider: SyncBlockDataProvider;
|
|
42
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
41
43
|
};
|
|
42
44
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
43
45
|
actions: {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
3
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
5
|
type Props = {
|
|
5
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
6
|
-
|
|
7
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
8
|
+
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
7
9
|
};
|
|
8
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, }: Props) => React.JSX.Element>;
|
|
10
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, }: Props) => React.JSX.Element>;
|
|
9
11
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import type { SyncedBlockPlugin
|
|
7
|
-
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape,
|
|
5
|
+
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
6
|
+
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, syncBlockStore: SyncBlockStoreManager) => FloatingToolbarConfig | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -8,7 +9,7 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
8
9
|
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
9
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
10
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
11
|
-
import type {
|
|
12
|
+
import type { SyncBlockInstance, SyncBlockDataProvider } from '@atlaskit/editor-synced-block-provider';
|
|
12
13
|
export type SyncedBlockEditorProps = {
|
|
13
14
|
defaultDocument: JSONDocNode;
|
|
14
15
|
onChange: (editorView: EditorView, meta: {
|
|
@@ -32,12 +33,13 @@ export type SyncedBlockEditorProps = {
|
|
|
32
33
|
popupsMountPoint: HTMLElement;
|
|
33
34
|
};
|
|
34
35
|
export type SyncedBlockRendererProps = {
|
|
35
|
-
|
|
36
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
|
+
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
36
38
|
};
|
|
37
39
|
export type SyncedBlockPluginOptions = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
|
+
syncBlockDataProvider: SyncBlockDataProvider;
|
|
42
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
41
43
|
};
|
|
42
44
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
43
45
|
actions: {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { SyncBlockInstance } from '@atlaskit/editor-synced-block-provider';
|
|
3
4
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
4
5
|
type Props = {
|
|
5
6
|
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
6
|
-
|
|
7
|
+
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
8
|
+
useFetchSyncBlockData: () => SyncBlockInstance | null;
|
|
7
9
|
};
|
|
8
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, }: Props) => React.JSX.Element>;
|
|
10
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ getSyncedBlockRenderer, useFetchSyncBlockData, syncBlockRendererDataProviders, }: Props) => React.JSX.Element>;
|
|
9
11
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
|
|
6
|
-
import type { SyncedBlockPlugin
|
|
7
|
-
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape,
|
|
5
|
+
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
6
|
+
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, syncBlockStore: SyncBlockStoreManager) => FloatingToolbarConfig | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.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.5.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
43
|
"@atlaskit/editor-toolbar": "^0.17.0",
|
|
44
44
|
"@atlaskit/icon": "28.5.3",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^110.
|
|
50
|
+
"@atlaskit/editor-common": "^110.21.0",
|
|
51
51
|
"react": "^18.2.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.post-office.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../post-office/tsDist/@atlaskit__editor-plugin-synced-block/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*",
|
|
18
|
-
"../src/**/examples/*",
|
|
19
|
-
"../src/**/examples/**/*",
|
|
20
|
-
"../src/**/*.stories.*",
|
|
21
|
-
"../src/**/stories/*",
|
|
22
|
-
"../src/**/stories/**/*"
|
|
23
|
-
],
|
|
24
|
-
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../../design-system/button/afm-post-office/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-json-transformer/afm-post-office/tsconfig.json"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"path": "../../editor-plugin-analytics/afm-post-office/tsconfig.json"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../editor-plugin-block-menu/afm-post-office/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../editor-plugin-decorations/afm-post-office/tsconfig.json"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"path": "../../editor-plugin-floating-toolbar/afm-post-office/tsconfig.json"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"path": "../../editor-plugin-selection/afm-post-office/tsconfig.json"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"path": "../../editor-shared-styles/afm-post-office/tsconfig.json"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"path": "../../editor-synced-block-provider/afm-post-office/tsconfig.json"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"path": "../../editor-tables/afm-post-office/tsconfig.json"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"path": "../../editor-toolbar/afm-post-office/tsconfig.json"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"path": "../../../design-system/icon/afm-post-office/tsconfig.json"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"path": "../../../design-system/modal-dialog/afm-post-office/tsconfig.json"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
}
|