@atlaskit/editor-plugin-card 0.14.24 → 0.14.25
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/nodeviews/datasource.js +2 -1
- package/dist/cjs/pm-plugins/main.js +14 -6
- package/dist/es2019/nodeviews/datasource.js +2 -1
- package/dist/es2019/pm-plugins/main.js +14 -6
- package/dist/esm/nodeviews/datasource.js +2 -1
- package/dist/esm/pm-plugins/main.js +14 -6
- package/dist/types/nodeviews/datasource.d.ts +2 -0
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +2 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.14.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#63612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63612) [`30f0f85d5af6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30f0f85d5af6) - Disable datasource table resize button when the component is nested inside another component.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 0.14.24
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -183,6 +183,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
183
183
|
_this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
184
184
|
var sharedState = props === null || props === void 0 || (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.width) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.sharedState;
|
|
185
185
|
_this2.tableWidth = sharedState === null || sharedState === void 0 || (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
186
|
+
_this2.isNodeNested = props.isNodeNested;
|
|
186
187
|
sharedState === null || sharedState === void 0 || sharedState.onChange(function (_ref3) {
|
|
187
188
|
var nextSharedState = _ref3.nextSharedState;
|
|
188
189
|
if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.width && _this2.tableWidth !== (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width)) {
|
|
@@ -211,7 +212,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
211
212
|
}, (0, _react2.jsx)("div", {
|
|
212
213
|
className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
213
214
|
style: {
|
|
214
|
-
minWidth: (0, _utils.calcBreakoutWidth)(attrs.layout, this.tableWidth)
|
|
215
|
+
minWidth: this.isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(attrs.layout, this.tableWidth)
|
|
215
216
|
}
|
|
216
217
|
}, (0, _react2.jsx)(DatasourceComponent, {
|
|
217
218
|
node: this.node,
|
|
@@ -155,12 +155,16 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
155
155
|
var _node$attrs2;
|
|
156
156
|
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
157
157
|
var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
|
|
158
|
+
var isNested = selection.$anchor.depth > 0;
|
|
158
159
|
|
|
159
|
-
// we
|
|
160
|
-
|
|
161
|
-
datasourceTableRef
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
// we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
|
|
161
|
+
if (!isNested) {
|
|
162
|
+
// we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
|
|
163
|
+
dispatch((0, _actions.setCardLayoutAndDatasourceTableRef)({
|
|
164
|
+
datasourceTableRef: datasourceTableRef,
|
|
165
|
+
layout: layout
|
|
166
|
+
})(tr));
|
|
167
|
+
}
|
|
164
168
|
}
|
|
165
169
|
} else {
|
|
166
170
|
if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
|
|
@@ -223,6 +227,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
223
227
|
if (isDatasource) {
|
|
224
228
|
var _node$attrs4;
|
|
225
229
|
if (options.allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
|
|
230
|
+
var datasourcePosition = typeof getPos === 'function' && getPos();
|
|
231
|
+
var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
|
|
232
|
+
var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
|
|
226
233
|
return new _datasource.Datasource({
|
|
227
234
|
node: node,
|
|
228
235
|
view: view,
|
|
@@ -230,7 +237,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
230
237
|
portalProviderAPI: portalProviderAPI,
|
|
231
238
|
eventDispatcher: eventDispatcher,
|
|
232
239
|
hasIntlContext: hasIntlContext,
|
|
233
|
-
pluginInjectionApi: pluginInjectionApi
|
|
240
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
241
|
+
isNodeNested: isNodeNested
|
|
234
242
|
}).init();
|
|
235
243
|
} else {
|
|
236
244
|
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
@@ -150,6 +150,7 @@ export class Datasource extends ReactNodeView {
|
|
|
150
150
|
super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
151
151
|
const sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.width) === null || _props$pluginInjectio2 === void 0 ? void 0 : _props$pluginInjectio2.sharedState;
|
|
152
152
|
this.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
153
|
+
this.isNodeNested = props.isNodeNested;
|
|
153
154
|
sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(({
|
|
154
155
|
nextSharedState
|
|
155
156
|
}) => {
|
|
@@ -177,7 +178,7 @@ export class Datasource extends ReactNodeView {
|
|
|
177
178
|
}, jsx("div", {
|
|
178
179
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
179
180
|
style: {
|
|
180
|
-
minWidth: calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
181
|
+
minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
181
182
|
}
|
|
182
183
|
}, jsx(DatasourceComponent, {
|
|
183
184
|
node: this.node,
|
|
@@ -144,12 +144,16 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
144
144
|
var _node$attrs2;
|
|
145
145
|
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
146
146
|
const layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
|
|
147
|
+
const isNested = selection.$anchor.depth > 0;
|
|
147
148
|
|
|
148
|
-
// we
|
|
149
|
-
|
|
150
|
-
datasourceTableRef
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
// we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
|
|
150
|
+
if (!isNested) {
|
|
151
|
+
// we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
|
|
152
|
+
dispatch(setCardLayoutAndDatasourceTableRef({
|
|
153
|
+
datasourceTableRef,
|
|
154
|
+
layout
|
|
155
|
+
})(tr));
|
|
156
|
+
}
|
|
153
157
|
}
|
|
154
158
|
} else {
|
|
155
159
|
if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
|
|
@@ -214,6 +218,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
214
218
|
if (isDatasource) {
|
|
215
219
|
var _node$attrs4, _node$attrs4$datasour;
|
|
216
220
|
if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
|
|
221
|
+
const datasourcePosition = typeof getPos === 'function' && getPos();
|
|
222
|
+
const datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
|
|
223
|
+
const isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
|
|
217
224
|
return new Datasource({
|
|
218
225
|
node,
|
|
219
226
|
view,
|
|
@@ -221,7 +228,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
221
228
|
portalProviderAPI,
|
|
222
229
|
eventDispatcher,
|
|
223
230
|
hasIntlContext,
|
|
224
|
-
pluginInjectionApi
|
|
231
|
+
pluginInjectionApi,
|
|
232
|
+
isNodeNested
|
|
225
233
|
}).init();
|
|
226
234
|
} else {
|
|
227
235
|
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
@@ -177,6 +177,7 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
177
177
|
_this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
178
178
|
var sharedState = props === null || props === void 0 || (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.width) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.sharedState;
|
|
179
179
|
_this2.tableWidth = sharedState === null || sharedState === void 0 || (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
180
|
+
_this2.isNodeNested = props.isNodeNested;
|
|
180
181
|
sharedState === null || sharedState === void 0 || sharedState.onChange(function (_ref3) {
|
|
181
182
|
var nextSharedState = _ref3.nextSharedState;
|
|
182
183
|
if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.width && _this2.tableWidth !== (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width)) {
|
|
@@ -205,7 +206,7 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
205
206
|
}, jsx("div", {
|
|
206
207
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
207
208
|
style: {
|
|
208
|
-
minWidth: calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
209
|
+
minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
209
210
|
}
|
|
210
211
|
}, jsx(DatasourceComponent, {
|
|
211
212
|
node: this.node,
|
|
@@ -143,12 +143,16 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
143
143
|
var _node$attrs2;
|
|
144
144
|
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
145
145
|
var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
|
|
146
|
+
var isNested = selection.$anchor.depth > 0;
|
|
146
147
|
|
|
147
|
-
// we
|
|
148
|
-
|
|
149
|
-
datasourceTableRef
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
// we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
|
|
149
|
+
if (!isNested) {
|
|
150
|
+
// we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
|
|
151
|
+
dispatch(setCardLayoutAndDatasourceTableRef({
|
|
152
|
+
datasourceTableRef: datasourceTableRef,
|
|
153
|
+
layout: layout
|
|
154
|
+
})(tr));
|
|
155
|
+
}
|
|
152
156
|
}
|
|
153
157
|
} else {
|
|
154
158
|
if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
|
|
@@ -211,6 +215,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
211
215
|
if (isDatasource) {
|
|
212
216
|
var _node$attrs4;
|
|
213
217
|
if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
|
|
218
|
+
var datasourcePosition = typeof getPos === 'function' && getPos();
|
|
219
|
+
var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
|
|
220
|
+
var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
|
|
214
221
|
return new Datasource({
|
|
215
222
|
node: node,
|
|
216
223
|
view: view,
|
|
@@ -218,7 +225,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
218
225
|
portalProviderAPI: portalProviderAPI,
|
|
219
226
|
eventDispatcher: eventDispatcher,
|
|
220
227
|
hasIntlContext: hasIntlContext,
|
|
221
|
-
pluginInjectionApi: pluginInjectionApi
|
|
228
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
229
|
+
isNodeNested: isNodeNested
|
|
222
230
|
}).init();
|
|
223
231
|
} else {
|
|
224
232
|
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
@@ -18,6 +18,7 @@ export interface DatasourceProps extends ReactComponentProps {
|
|
|
18
18
|
eventDispatcher: EventDispatcher;
|
|
19
19
|
hasIntlContext: boolean;
|
|
20
20
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
21
|
+
isNodeNested?: boolean;
|
|
21
22
|
}
|
|
22
23
|
interface DatasourceComponentProps extends ReactComponentProps, Pick<DatasourceProps, 'node' | 'view' | 'getPos'> {
|
|
23
24
|
}
|
|
@@ -39,6 +40,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
|
|
|
39
40
|
}
|
|
40
41
|
export declare class Datasource extends ReactNodeView<DatasourceProps> {
|
|
41
42
|
private tableWidth;
|
|
43
|
+
private isNodeNested;
|
|
42
44
|
constructor(props: DatasourceProps);
|
|
43
45
|
createDomRef(): HTMLElement;
|
|
44
46
|
render(): jsx.JSX.Element;
|
|
@@ -18,6 +18,7 @@ export interface DatasourceProps extends ReactComponentProps {
|
|
|
18
18
|
eventDispatcher: EventDispatcher;
|
|
19
19
|
hasIntlContext: boolean;
|
|
20
20
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
21
|
+
isNodeNested?: boolean;
|
|
21
22
|
}
|
|
22
23
|
interface DatasourceComponentProps extends ReactComponentProps, Pick<DatasourceProps, 'node' | 'view' | 'getPos'> {
|
|
23
24
|
}
|
|
@@ -39,6 +40,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
|
|
|
39
40
|
}
|
|
40
41
|
export declare class Datasource extends ReactNodeView<DatasourceProps> {
|
|
41
42
|
private tableWidth;
|
|
43
|
+
private isNodeNested;
|
|
42
44
|
constructor(props: DatasourceProps);
|
|
43
45
|
createDomRef(): HTMLElement;
|
|
44
46
|
render(): jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.25",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@atlaskit/adf-schema": "^35.2.0",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
37
37
|
"@atlaskit/custom-steps": "^0.0.10",
|
|
38
|
-
"@atlaskit/editor-common": "^76.
|
|
38
|
+
"@atlaskit/editor-common": "^76.31.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
41
41
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
51
51
|
"@atlaskit/link-client-extension": "^1.8.0",
|
|
52
52
|
"@atlaskit/link-datasource": "^1.19.0",
|
|
53
|
-
"@atlaskit/linking-common": "^5.
|
|
53
|
+
"@atlaskit/linking-common": "^5.1.0",
|
|
54
54
|
"@atlaskit/linking-types": "^8.5.0",
|
|
55
55
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
56
56
|
"@atlaskit/primitives": "^1.15.0",
|