@atlaskit/editor-plugin-card 0.5.3 → 0.5.5

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 0.5.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7ff427bb457`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7ff427bb457) - Add datasources to macro menu categories
8
+
9
+ ## 0.5.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`dfb663969a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dfb663969a0) - ED-19820: Fix for table scroll when insert media node when extended-resize-experience is off
14
+
3
15
  ## 0.5.3
4
16
 
5
17
  ### Patch Changes
@@ -134,6 +134,7 @@ var cardPlugin = function cardPlugin(_ref) {
134
134
  id: 'datasource',
135
135
  title: formatMessage(_messages.messages.datasourceJiraIssue),
136
136
  description: formatMessage(_messages.messages.datasourceJiraIssueDescription),
137
+ categories: ['external-content', 'development'],
137
138
  keywords: ['jira'],
138
139
  icon: function icon() {
139
140
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDatasourceJiraIssue, null);
@@ -150,6 +151,7 @@ var cardPlugin = function cardPlugin(_ref) {
150
151
  id: 'datasource',
151
152
  title: formatMessage(_messages.messages.datasourceAssetsObjects),
152
153
  description: formatMessage(_messages.messages.datasourceAssetsObjectsDescription),
154
+ categories: ['external-content', 'development'],
153
155
  keywords: ['assets'],
154
156
  icon: function icon() {
155
157
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDatasourceAssetsObjects, null);
@@ -216,6 +216,17 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
216
216
  return _editorSharedStyles.akEditorWideLayoutWidth;
217
217
  }
218
218
  }
219
+
220
+ // check if is inside of a table
221
+ }, {
222
+ key: "isNestedInTable",
223
+ value: function isNestedInTable() {
224
+ var table = this.props.view.state.schema.nodes.table;
225
+ if (!this.$pos) {
226
+ return false;
227
+ }
228
+ return !!(0, _utils.findParentNodeOfTypeClosestToPos)(this.$pos, table);
229
+ }
219
230
  }, {
220
231
  key: "calcSnapPoints",
221
232
  value: function calcSnapPoints() {
@@ -330,6 +341,21 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
330
341
  enable[side] = false;
331
342
  }
332
343
  });
344
+ var nestedInTableHandleStyles = function nestedInTableHandleStyles(isNestedInTable) {
345
+ if (!isNestedInTable) {
346
+ return;
347
+ }
348
+ return {
349
+ left: {
350
+ left: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
351
+ paddingLeft: '0px'
352
+ },
353
+ right: {
354
+ right: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
355
+ paddingRight: '0px'
356
+ }
357
+ };
358
+ };
333
359
 
334
360
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
335
361
  return (0, _react2.jsx)("div", {
@@ -351,7 +377,8 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
351
377
  scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
352
378
  highlights: this.highlights,
353
379
  innerPadding: _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide,
354
- nodeType: "embed"
380
+ nodeType: "embed",
381
+ handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
355
382
  }), children, this.getHeightDefiningComponent())));
356
383
  /* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */
357
384
  }
@@ -127,6 +127,7 @@ export const cardPlugin = ({
127
127
  id: 'datasource',
128
128
  title: formatMessage(messages.datasourceJiraIssue),
129
129
  description: formatMessage(messages.datasourceJiraIssueDescription),
130
+ categories: ['external-content', 'development'],
130
131
  keywords: ['jira'],
131
132
  icon: () => /*#__PURE__*/React.createElement(IconDatasourceJiraIssue, null),
132
133
  action(insert) {
@@ -141,6 +142,7 @@ export const cardPlugin = ({
141
142
  id: 'datasource',
142
143
  title: formatMessage(messages.datasourceAssetsObjects),
143
144
  description: formatMessage(messages.datasourceAssetsObjectsDescription),
145
+ categories: ['external-content', 'development'],
144
146
  keywords: ['assets'],
145
147
  icon: () => /*#__PURE__*/React.createElement(IconDatasourceAssetsObjects, null),
146
148
  action(insert) {
@@ -194,6 +194,17 @@ export default class ResizableEmbedCard extends React.Component {
194
194
  return akEditorWideLayoutWidth;
195
195
  }
196
196
  }
197
+
198
+ // check if is inside of a table
199
+ isNestedInTable() {
200
+ const {
201
+ table
202
+ } = this.props.view.state.schema.nodes;
203
+ if (!this.$pos) {
204
+ return false;
205
+ }
206
+ return !!findParentNodeOfTypeClosestToPos(this.$pos, table);
207
+ }
197
208
  calcSnapPoints() {
198
209
  const {
199
210
  offsetLeft
@@ -304,6 +315,21 @@ export default class ResizableEmbedCard extends React.Component {
304
315
  enable[side] = false;
305
316
  }
306
317
  });
318
+ const nestedInTableHandleStyles = isNestedInTable => {
319
+ if (!isNestedInTable) {
320
+ return;
321
+ }
322
+ return {
323
+ left: {
324
+ left: `calc(${"var(--ds-space-025, 0.125em)"} * -0.5)`,
325
+ paddingLeft: '0px'
326
+ },
327
+ right: {
328
+ right: `calc(${"var(--ds-space-025, 0.125em)"} * -0.5)`,
329
+ paddingRight: '0px'
330
+ }
331
+ };
332
+ };
307
333
 
308
334
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
309
335
  return jsx("div", {
@@ -325,7 +351,8 @@ export default class ResizableEmbedCard extends React.Component {
325
351
  scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
326
352
  highlights: this.highlights,
327
353
  innerPadding: akEditorMediaResizeHandlerPaddingWide,
328
- nodeType: "embed"
354
+ nodeType: "embed",
355
+ handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
329
356
  }), children, this.getHeightDefiningComponent())));
330
357
  /* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */
331
358
  }
@@ -127,6 +127,7 @@ export var cardPlugin = function cardPlugin(_ref) {
127
127
  id: 'datasource',
128
128
  title: formatMessage(messages.datasourceJiraIssue),
129
129
  description: formatMessage(messages.datasourceJiraIssueDescription),
130
+ categories: ['external-content', 'development'],
130
131
  keywords: ['jira'],
131
132
  icon: function icon() {
132
133
  return /*#__PURE__*/React.createElement(IconDatasourceJiraIssue, null);
@@ -143,6 +144,7 @@ export var cardPlugin = function cardPlugin(_ref) {
143
144
  id: 'datasource',
144
145
  title: formatMessage(messages.datasourceAssetsObjects),
145
146
  description: formatMessage(messages.datasourceAssetsObjectsDescription),
147
+ categories: ['external-content', 'development'],
146
148
  keywords: ['assets'],
147
149
  icon: function icon() {
148
150
  return /*#__PURE__*/React.createElement(IconDatasourceAssetsObjects, null);
@@ -210,6 +210,17 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
210
210
  return akEditorWideLayoutWidth;
211
211
  }
212
212
  }
213
+
214
+ // check if is inside of a table
215
+ }, {
216
+ key: "isNestedInTable",
217
+ value: function isNestedInTable() {
218
+ var table = this.props.view.state.schema.nodes.table;
219
+ if (!this.$pos) {
220
+ return false;
221
+ }
222
+ return !!findParentNodeOfTypeClosestToPos(this.$pos, table);
223
+ }
213
224
  }, {
214
225
  key: "calcSnapPoints",
215
226
  value: function calcSnapPoints() {
@@ -324,6 +335,21 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
324
335
  enable[side] = false;
325
336
  }
326
337
  });
338
+ var nestedInTableHandleStyles = function nestedInTableHandleStyles(isNestedInTable) {
339
+ if (!isNestedInTable) {
340
+ return;
341
+ }
342
+ return {
343
+ left: {
344
+ left: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
345
+ paddingLeft: '0px'
346
+ },
347
+ right: {
348
+ right: "calc(".concat("var(--ds-space-025, 0.125em)", " * -0.5)"),
349
+ paddingRight: '0px'
350
+ }
351
+ };
352
+ };
327
353
 
328
354
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
329
355
  return jsx("div", {
@@ -345,7 +371,8 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
345
371
  scaleFactor: !this.wrappedLayout && !this.insideInlineLike ? 2 : 1,
346
372
  highlights: this.highlights,
347
373
  innerPadding: akEditorMediaResizeHandlerPaddingWide,
348
- nodeType: "embed"
374
+ nodeType: "embed",
375
+ handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
349
376
  }), children, this.getHeightDefiningComponent())));
350
377
  /* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */
351
378
  }
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { RichMediaLayout } from '@atlaskit/adf-schema';
5
- import { ResizerProps } from '@atlaskit/editor-common/ui';
4
+ import type { RichMediaLayout } from '@atlaskit/adf-schema';
5
+ import type { ResizerProps } from '@atlaskit/editor-common/ui';
6
6
  type State = {
7
7
  offsetLeft: number;
8
8
  resizedPctWidth?: number;
@@ -39,6 +39,7 @@ export default class ResizableEmbedCard extends React.Component<Props, State> {
39
39
  calcColumnLeftOffset: () => number;
40
40
  wrapper?: HTMLElement;
41
41
  get wideLayoutWidth(): number;
42
+ isNestedInTable(): boolean;
42
43
  calcSnapPoints(): number[];
43
44
  calcPxWidth: (useLayout?: RichMediaLayout) => number;
44
45
  get insideInlineLike(): boolean;
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { RichMediaLayout } from '@atlaskit/adf-schema';
5
- import { ResizerProps } from '@atlaskit/editor-common/ui';
4
+ import type { RichMediaLayout } from '@atlaskit/adf-schema';
5
+ import type { ResizerProps } from '@atlaskit/editor-common/ui';
6
6
  type State = {
7
7
  offsetLeft: number;
8
8
  resizedPctWidth?: number;
@@ -39,6 +39,7 @@ export default class ResizableEmbedCard extends React.Component<Props, State> {
39
39
  calcColumnLeftOffset: () => number;
40
40
  wrapper?: HTMLElement;
41
41
  get wideLayoutWidth(): number;
42
+ isNestedInTable(): boolean;
42
43
  calcSnapPoints(): number[];
43
44
  calcPxWidth: (useLayout?: RichMediaLayout) => number;
44
45
  get insideInlineLike(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -47,9 +47,9 @@
47
47
  "@atlaskit/link-analytics": "^8.2.0",
48
48
  "@atlaskit/link-datasource": "^1.0.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.0",
50
- "@atlaskit/smart-card": "^26.20.0",
50
+ "@atlaskit/smart-card": "^26.23.0",
51
51
  "@atlaskit/theme": "^12.6.0",
52
- "@atlaskit/tokens": "^1.20.0",
52
+ "@atlaskit/tokens": "^1.21.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@emotion/react": "^11.7.1",
55
55
  "lodash": "^4.17.21",