@atlaskit/editor-plugin-synced-block 4.1.0 → 4.1.1
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 +7 -0
- package/dist/cjs/editor-commands/index.js +2 -2
- package/dist/cjs/nodeviews/syncedBlock.js +2 -4
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +2 -4
- package/dist/es2019/editor-commands/index.js +2 -2
- package/dist/es2019/nodeviews/syncedBlock.js +3 -4
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +2 -4
- package/dist/esm/editor-commands/index.js +2 -2
- package/dist/esm/nodeviews/syncedBlock.js +2 -4
- package/dist/esm/ui/SyncBlockRendererWrapper.js +2 -4
- package/dist/types/syncedBlockPluginType.d.ts +1 -4
- package/dist/types/ui/SyncBlockRendererWrapper.d.ts +2 -4
- package/dist/types-ts4.5/syncedBlockPluginType.d.ts +1 -4
- package/dist/types-ts4.5/ui/SyncBlockRendererWrapper.d.ts +2 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 4.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`aa14795cecd60`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aa14795cecd60) -
|
|
8
|
+
EDITOR-2350 Pass media options to sync block nested renderer.
|
|
9
|
+
|
|
3
10
|
## 4.1.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -22,7 +22,7 @@ var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_
|
|
|
22
22
|
|
|
23
23
|
// If the selection is empty, we want to insert the sync block on a new line
|
|
24
24
|
if (tr.selection.empty) {
|
|
25
|
-
var storeSyncBlockNode = syncBlockStore.
|
|
25
|
+
var storeSyncBlockNode = syncBlockStore.createBodiedSyncBlockNode();
|
|
26
26
|
var paragraphNode = paragraph.createAndFill({});
|
|
27
27
|
var newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_objectSpread({}, storeSyncBlockNode.attrs), paragraphNode ? [paragraphNode] : []);
|
|
28
28
|
if (!newBodiedSyncBlockNode) {
|
|
@@ -39,7 +39,7 @@ var createSyncedBlock = exports.createSyncedBlock = function createSyncedBlock(_
|
|
|
39
39
|
// TODO: EDITOR-1665 - Raise an error analytics event
|
|
40
40
|
return false;
|
|
41
41
|
} else {
|
|
42
|
-
var _storeSyncBlockNode = syncBlockStore.
|
|
42
|
+
var _storeSyncBlockNode = syncBlockStore.createBodiedSyncBlockNode();
|
|
43
43
|
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_objectSpread({}, _storeSyncBlockNode.attrs), conversionInfo.contentToInclude);
|
|
44
44
|
if (!_newBodiedSyncBlockNode) {
|
|
45
45
|
return false;
|
|
@@ -41,9 +41,8 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
41
41
|
value: function render() {
|
|
42
42
|
var _this$options,
|
|
43
43
|
_this$options2,
|
|
44
|
-
_this$options3,
|
|
45
44
|
_this2 = this;
|
|
46
|
-
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.
|
|
45
|
+
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
|
|
47
46
|
return null;
|
|
48
47
|
}
|
|
49
48
|
var _this$node$attrs = this.node.attrs,
|
|
@@ -56,8 +55,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
56
55
|
// get document node from data provider
|
|
57
56
|
return /*#__PURE__*/_react.default.createElement(_SyncBlockRendererWrapper.SyncBlockRendererWrapper, {
|
|
58
57
|
localId: this.node.attrs.localId,
|
|
59
|
-
|
|
60
|
-
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
58
|
+
syncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.syncedBlockRenderer,
|
|
61
59
|
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
62
60
|
return (0, _editorSyncedBlockProvider.useFetchSyncBlockTitle)(_this2.syncBlockStore, _this2.node);
|
|
63
61
|
},
|
|
@@ -10,9 +10,8 @@ var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
|
10
10
|
var _SyncBlockLabel = require("./SyncBlockLabel");
|
|
11
11
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
12
12
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
13
|
-
var
|
|
13
|
+
var syncedBlockRenderer = _ref.syncedBlockRenderer,
|
|
14
14
|
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
15
|
-
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders,
|
|
16
15
|
localId = _ref.localId,
|
|
17
16
|
useFetchSyncBlockTitle = _ref.useFetchSyncBlockTitle;
|
|
18
17
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -20,8 +19,7 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
20
19
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
21
20
|
,
|
|
22
21
|
className: _syncBlock.SyncBlockSharedCssClassName.renderer
|
|
23
|
-
},
|
|
24
|
-
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
22
|
+
}, syncedBlockRenderer({
|
|
25
23
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
26
24
|
})), /*#__PURE__*/_react.default.createElement(_SyncBlockLabel.SyncBlockLabel, {
|
|
27
25
|
isSource: false,
|
|
@@ -18,7 +18,7 @@ export const createSyncedBlock = ({
|
|
|
18
18
|
|
|
19
19
|
// If the selection is empty, we want to insert the sync block on a new line
|
|
20
20
|
if (tr.selection.empty) {
|
|
21
|
-
const storeSyncBlockNode = syncBlockStore.
|
|
21
|
+
const storeSyncBlockNode = syncBlockStore.createBodiedSyncBlockNode();
|
|
22
22
|
const paragraphNode = paragraph.createAndFill({});
|
|
23
23
|
const newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill({
|
|
24
24
|
...storeSyncBlockNode.attrs
|
|
@@ -37,7 +37,7 @@ export const createSyncedBlock = ({
|
|
|
37
37
|
// TODO: EDITOR-1665 - Raise an error analytics event
|
|
38
38
|
return false;
|
|
39
39
|
} else {
|
|
40
|
-
const storeSyncBlockNode = syncBlockStore.
|
|
40
|
+
const storeSyncBlockNode = syncBlockStore.createBodiedSyncBlockNode();
|
|
41
41
|
const newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill({
|
|
42
42
|
...storeSyncBlockNode.attrs
|
|
43
43
|
}, conversionInfo.contentToInclude);
|
|
@@ -15,8 +15,8 @@ class SyncBlock extends ReactNodeView {
|
|
|
15
15
|
return domRef;
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
|
-
var _this$options, _this$options2
|
|
19
|
-
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.
|
|
18
|
+
var _this$options, _this$options2;
|
|
19
|
+
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
const {
|
|
@@ -30,8 +30,7 @@ class SyncBlock extends ReactNodeView {
|
|
|
30
30
|
// get document node from data provider
|
|
31
31
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
32
32
|
localId: this.node.attrs.localId,
|
|
33
|
-
|
|
34
|
-
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
33
|
+
syncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.syncedBlockRenderer,
|
|
35
34
|
useFetchSyncBlockTitle: () => useFetchSyncBlockTitle(this.syncBlockStore, this.node),
|
|
36
35
|
useFetchSyncBlockData: () => useFetchSyncBlockData(this.syncBlockStore, resourceId, localId)
|
|
37
36
|
});
|
|
@@ -3,9 +3,8 @@ import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block'
|
|
|
3
3
|
import { SyncBlockLabel } from './SyncBlockLabel';
|
|
4
4
|
const SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
5
5
|
const SyncBlockRendererWrapperComponent = ({
|
|
6
|
-
|
|
6
|
+
syncedBlockRenderer,
|
|
7
7
|
useFetchSyncBlockData,
|
|
8
|
-
syncBlockRendererDataProviders,
|
|
9
8
|
localId,
|
|
10
9
|
useFetchSyncBlockTitle
|
|
11
10
|
}) => {
|
|
@@ -14,8 +13,7 @@ const SyncBlockRendererWrapperComponent = ({
|
|
|
14
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
15
14
|
,
|
|
16
15
|
className: SyncBlockSharedCssClassName.renderer
|
|
17
|
-
},
|
|
18
|
-
syncBlockRendererDataProviders,
|
|
16
|
+
}, syncedBlockRenderer({
|
|
19
17
|
useFetchSyncBlockData
|
|
20
18
|
})), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
21
19
|
isSource: false,
|
|
@@ -15,7 +15,7 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
|
|
|
15
15
|
|
|
16
16
|
// If the selection is empty, we want to insert the sync block on a new line
|
|
17
17
|
if (tr.selection.empty) {
|
|
18
|
-
var storeSyncBlockNode = syncBlockStore.
|
|
18
|
+
var storeSyncBlockNode = syncBlockStore.createBodiedSyncBlockNode();
|
|
19
19
|
var paragraphNode = paragraph.createAndFill({});
|
|
20
20
|
var newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_objectSpread({}, storeSyncBlockNode.attrs), paragraphNode ? [paragraphNode] : []);
|
|
21
21
|
if (!newBodiedSyncBlockNode) {
|
|
@@ -32,7 +32,7 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
|
|
|
32
32
|
// TODO: EDITOR-1665 - Raise an error analytics event
|
|
33
33
|
return false;
|
|
34
34
|
} else {
|
|
35
|
-
var _storeSyncBlockNode = syncBlockStore.
|
|
35
|
+
var _storeSyncBlockNode = syncBlockStore.createBodiedSyncBlockNode();
|
|
36
36
|
var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_objectSpread({}, _storeSyncBlockNode.attrs), conversionInfo.contentToInclude);
|
|
37
37
|
if (!_newBodiedSyncBlockNode) {
|
|
38
38
|
return false;
|
|
@@ -34,9 +34,8 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
34
34
|
value: function render() {
|
|
35
35
|
var _this$options,
|
|
36
36
|
_this$options2,
|
|
37
|
-
_this$options3,
|
|
38
37
|
_this2 = this;
|
|
39
|
-
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.
|
|
38
|
+
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
|
|
40
39
|
return null;
|
|
41
40
|
}
|
|
42
41
|
var _this$node$attrs = this.node.attrs,
|
|
@@ -49,8 +48,7 @@ var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
49
48
|
// get document node from data provider
|
|
50
49
|
return /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
|
|
51
50
|
localId: this.node.attrs.localId,
|
|
52
|
-
|
|
53
|
-
syncBlockRendererDataProviders: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncBlockRendererDataProviders,
|
|
51
|
+
syncedBlockRenderer: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.syncedBlockRenderer,
|
|
54
52
|
useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
|
|
55
53
|
return _useFetchSyncBlockTitle(_this2.syncBlockStore, _this2.node);
|
|
56
54
|
},
|
|
@@ -3,9 +3,8 @@ import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block'
|
|
|
3
3
|
import { SyncBlockLabel } from './SyncBlockLabel';
|
|
4
4
|
var SyncBlockRendererWrapperDataId = 'sync-block-plugin-renderer-wrapper';
|
|
5
5
|
var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperComponent(_ref) {
|
|
6
|
-
var
|
|
6
|
+
var syncedBlockRenderer = _ref.syncedBlockRenderer,
|
|
7
7
|
useFetchSyncBlockData = _ref.useFetchSyncBlockData,
|
|
8
|
-
syncBlockRendererDataProviders = _ref.syncBlockRendererDataProviders,
|
|
9
8
|
localId = _ref.localId,
|
|
10
9
|
useFetchSyncBlockTitle = _ref.useFetchSyncBlockTitle;
|
|
11
10
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -13,8 +12,7 @@ var SyncBlockRendererWrapperComponent = function SyncBlockRendererWrapperCompone
|
|
|
13
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
14
13
|
,
|
|
15
14
|
className: SyncBlockSharedCssClassName.renderer
|
|
16
|
-
},
|
|
17
|
-
syncBlockRendererDataProviders: syncBlockRendererDataProviders,
|
|
15
|
+
}, syncedBlockRenderer({
|
|
18
16
|
useFetchSyncBlockData: useFetchSyncBlockData
|
|
19
17
|
})), /*#__PURE__*/React.createElement(SyncBlockLabel, {
|
|
20
18
|
isSource: false,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
-
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
5
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -33,13 +32,11 @@ export type SyncedBlockEditorProps = {
|
|
|
33
32
|
popupsMountPoint: HTMLElement;
|
|
34
33
|
};
|
|
35
34
|
export type SyncedBlockRendererProps = {
|
|
36
|
-
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
35
|
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
38
36
|
};
|
|
39
37
|
export type SyncedBlockPluginOptions = {
|
|
40
|
-
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
38
|
syncBlockDataProvider: SyncBlockDataProvider;
|
|
42
|
-
|
|
39
|
+
syncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
43
40
|
};
|
|
44
41
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
45
42
|
actions: {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
4
3
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
5
4
|
type Props = {
|
|
6
|
-
|
|
5
|
+
syncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
6
|
localId: string;
|
|
8
|
-
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
9
7
|
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
10
8
|
useFetchSyncBlockTitle: () => string | undefined;
|
|
11
9
|
};
|
|
12
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({
|
|
10
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ syncedBlockRenderer, useFetchSyncBlockData, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
13
11
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
-
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
5
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -33,13 +32,11 @@ export type SyncedBlockEditorProps = {
|
|
|
33
32
|
popupsMountPoint: HTMLElement;
|
|
34
33
|
};
|
|
35
34
|
export type SyncedBlockRendererProps = {
|
|
36
|
-
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
37
35
|
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
38
36
|
};
|
|
39
37
|
export type SyncedBlockPluginOptions = {
|
|
40
|
-
getSyncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
41
38
|
syncBlockDataProvider: SyncBlockDataProvider;
|
|
42
|
-
|
|
39
|
+
syncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
43
40
|
};
|
|
44
41
|
export type SyncedBlockPlugin = NextEditorPlugin<'syncedBlock', {
|
|
45
42
|
actions: {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { SyncedBlockRendererDataProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
2
|
import type { UseFetchSyncBlockDataResult } from '@atlaskit/editor-synced-block-provider';
|
|
4
3
|
import type { SyncedBlockRendererProps } from '../syncedBlockPluginType';
|
|
5
4
|
type Props = {
|
|
6
|
-
|
|
5
|
+
syncedBlockRenderer: (props: SyncedBlockRendererProps) => React.JSX.Element;
|
|
7
6
|
localId: string;
|
|
8
|
-
syncBlockRendererDataProviders: SyncedBlockRendererDataProviders;
|
|
9
7
|
useFetchSyncBlockData: () => UseFetchSyncBlockDataResult;
|
|
10
8
|
useFetchSyncBlockTitle: () => string | undefined;
|
|
11
9
|
};
|
|
12
|
-
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({
|
|
10
|
+
export declare const SyncBlockRendererWrapper: React.MemoExoticComponent<({ syncedBlockRenderer, useFetchSyncBlockData, localId, useFetchSyncBlockTitle, }: Props) => React.JSX.Element>;
|
|
13
11
|
export {};
|