@atlaskit/editor-plugin-card 6.3.1 → 6.3.2

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,14 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 6.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#159351](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159351)
8
+ [`8932459025c73`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8932459025c73) -
9
+ Move card removal to unmounting of component.
10
+ - Updated dependencies
11
+
3
12
  ## 6.3.1
4
13
 
5
14
  ### Patch Changes
@@ -60,6 +60,7 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
60
60
  })(view.state.tr));
61
61
  })();
62
62
  });
63
+ (0, _defineProperty2.default)(_this, "removeCardDispatched", false);
63
64
  (0, _defineProperty2.default)(_this, "gapCursorSpan", function () {
64
65
  // Don't render in EdgeHTMl version <= 18 (Edge version 44)
65
66
  // as it forces the edit popup to render 24px lower than it should
@@ -84,6 +85,26 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
84
85
  }
85
86
  (0, _inherits2.default)(BlockCardComponent, _React$PureComponent);
86
87
  return (0, _createClass2.default)(BlockCardComponent, [{
88
+ key: "componentWillUnmount",
89
+ value: function componentWillUnmount() {
90
+ if ((0, _platformFeatureFlags.fg)('platform_editor_fix_advanced_code_crash')) {
91
+ this.removeCard();
92
+ }
93
+ }
94
+ }, {
95
+ key: "removeCard",
96
+ value: function removeCard() {
97
+ if (this.removeCardDispatched && (0, _platformFeatureFlags.fg)('platform_editor_cards_maxcallstackfix')) {
98
+ return;
99
+ }
100
+ this.removeCardDispatched = true;
101
+ var tr = this.props.view.state.tr;
102
+ (0, _actions.removeCard)({
103
+ id: this.props.id
104
+ })(tr);
105
+ this.props.view.dispatch(tr);
106
+ }
107
+ }, {
87
108
  key: "render",
88
109
  value: function render() {
89
110
  var _this$props2 = this.props,
@@ -187,7 +208,11 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
187
208
  value: function destroy() {
188
209
  var _this$unsubscribe;
189
210
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
190
- this.removeCard();
211
+ if ((0, _platformFeatureFlags.fg)('platform_editor_fix_advanced_code_crash')) {
212
+ _superPropGet(BlockCard, "destroy", this, 3)([]);
213
+ } else {
214
+ this.removeCard();
215
+ }
191
216
  }
192
217
  }, {
193
218
  key: "removeCard",
@@ -273,11 +273,32 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
273
273
  throw err;
274
274
  }
275
275
  });
276
+ (0, _defineProperty2.default)(_this, "removeCardDispatched", false);
276
277
  _this.scrollContainer = (0, _ui.findOverflowScrollParent)(props.view.dom) || undefined;
277
278
  return _this;
278
279
  }
279
280
  (0, _inherits2.default)(EmbedCardComponent, _React$PureComponent);
280
281
  return (0, _createClass2.default)(EmbedCardComponent, [{
282
+ key: "componentWillUnmount",
283
+ value: function componentWillUnmount() {
284
+ if ((0, _platformFeatureFlags.fg)('platform_editor_fix_advanced_code_crash')) {
285
+ this.removeCard();
286
+ }
287
+ }
288
+ }, {
289
+ key: "removeCard",
290
+ value: function removeCard() {
291
+ if (this.removeCardDispatched && (0, _platformFeatureFlags.fg)('platform_editor_cards_maxcallstackfix')) {
292
+ return;
293
+ }
294
+ this.removeCardDispatched = true;
295
+ var tr = this.props.view.state.tr;
296
+ (0, _actions.removeCard)({
297
+ id: this.props.id
298
+ })(tr);
299
+ this.props.view.dispatch(tr);
300
+ }
301
+ }, {
281
302
  key: "render",
282
303
  value: function render() {
283
304
  var _this$props = this.props,
@@ -421,7 +442,11 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
421
442
  value: function destroy() {
422
443
  var _this$unsubscribe;
423
444
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
424
- this.removeCard();
445
+ if ((0, _platformFeatureFlags.fg)('platform_editor_fix_advanced_code_crash')) {
446
+ _superPropGet(EmbedCard, "destroy", this, 3)([]);
447
+ } else {
448
+ this.removeCard();
449
+ }
425
450
  }
426
451
  }, {
427
452
  key: "removeCard",
@@ -46,6 +46,7 @@ export class BlockCardComponent extends React.PureComponent {
46
46
  })(view.state.tr));
47
47
  })();
48
48
  });
49
+ _defineProperty(this, "removeCardDispatched", false);
49
50
  _defineProperty(this, "gapCursorSpan", () => {
50
51
  // Don't render in EdgeHTMl version <= 18 (Edge version 44)
51
52
  // as it forces the edit popup to render 24px lower than it should
@@ -68,6 +69,24 @@ export class BlockCardComponent extends React.PureComponent {
68
69
  });
69
70
  this.scrollContainer = findOverflowScrollParent(props.view.dom) || undefined;
70
71
  }
72
+ componentWillUnmount() {
73
+ if (fg('platform_editor_fix_advanced_code_crash')) {
74
+ this.removeCard();
75
+ }
76
+ }
77
+ removeCard() {
78
+ if (this.removeCardDispatched && fg('platform_editor_cards_maxcallstackfix')) {
79
+ return;
80
+ }
81
+ this.removeCardDispatched = true;
82
+ const {
83
+ tr
84
+ } = this.props.view.state;
85
+ removeCard({
86
+ id: this.props.id
87
+ })(tr);
88
+ this.props.view.dispatch(tr);
89
+ }
71
90
  render() {
72
91
  const {
73
92
  node,
@@ -151,7 +170,11 @@ export class BlockCard extends ReactNodeView {
151
170
  destroy() {
152
171
  var _this$unsubscribe;
153
172
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
154
- this.removeCard();
173
+ if (fg('platform_editor_fix_advanced_code_crash')) {
174
+ super.destroy();
175
+ } else {
176
+ this.removeCard();
177
+ }
155
178
  }
156
179
  removeCard() {
157
180
  if (this.removeCardDispatched && fg('platform_editor_cards_maxcallstackfix')) {
@@ -268,8 +268,27 @@ export class EmbedCardComponent extends React.PureComponent {
268
268
  throw err;
269
269
  }
270
270
  });
271
+ _defineProperty(this, "removeCardDispatched", false);
271
272
  this.scrollContainer = findOverflowScrollParent(props.view.dom) || undefined;
272
273
  }
274
+ componentWillUnmount() {
275
+ if (fg('platform_editor_fix_advanced_code_crash')) {
276
+ this.removeCard();
277
+ }
278
+ }
279
+ removeCard() {
280
+ if (this.removeCardDispatched && fg('platform_editor_cards_maxcallstackfix')) {
281
+ return;
282
+ }
283
+ this.removeCardDispatched = true;
284
+ const {
285
+ tr
286
+ } = this.props.view.state;
287
+ removeCard({
288
+ id: this.props.id
289
+ })(tr);
290
+ this.props.view.dispatch(tr);
291
+ }
273
292
  render() {
274
293
  const {
275
294
  node,
@@ -397,7 +416,11 @@ export class EmbedCard extends ReactNodeView {
397
416
  destroy() {
398
417
  var _this$unsubscribe;
399
418
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
400
- this.removeCard();
419
+ if (fg('platform_editor_fix_advanced_code_crash')) {
420
+ super.destroy();
421
+ } else {
422
+ this.removeCard();
423
+ }
401
424
  }
402
425
  removeCard() {
403
426
  if (this.removeCardDispatched && fg('platform_editor_cards_maxcallstackfix')) {
@@ -54,6 +54,7 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
54
54
  })(view.state.tr));
55
55
  })();
56
56
  });
57
+ _defineProperty(_this, "removeCardDispatched", false);
57
58
  _defineProperty(_this, "gapCursorSpan", function () {
58
59
  // Don't render in EdgeHTMl version <= 18 (Edge version 44)
59
60
  // as it forces the edit popup to render 24px lower than it should
@@ -78,6 +79,26 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
78
79
  }
79
80
  _inherits(BlockCardComponent, _React$PureComponent);
80
81
  return _createClass(BlockCardComponent, [{
82
+ key: "componentWillUnmount",
83
+ value: function componentWillUnmount() {
84
+ if (fg('platform_editor_fix_advanced_code_crash')) {
85
+ this.removeCard();
86
+ }
87
+ }
88
+ }, {
89
+ key: "removeCard",
90
+ value: function removeCard() {
91
+ if (this.removeCardDispatched && fg('platform_editor_cards_maxcallstackfix')) {
92
+ return;
93
+ }
94
+ this.removeCardDispatched = true;
95
+ var tr = this.props.view.state.tr;
96
+ _removeCard({
97
+ id: this.props.id
98
+ })(tr);
99
+ this.props.view.dispatch(tr);
100
+ }
101
+ }, {
81
102
  key: "render",
82
103
  value: function render() {
83
104
  var _this$props2 = this.props,
@@ -181,7 +202,11 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
181
202
  value: function destroy() {
182
203
  var _this$unsubscribe;
183
204
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
184
- this.removeCard();
205
+ if (fg('platform_editor_fix_advanced_code_crash')) {
206
+ _superPropGet(BlockCard, "destroy", this, 3)([]);
207
+ } else {
208
+ this.removeCard();
209
+ }
185
210
  }
186
211
  }, {
187
212
  key: "removeCard",
@@ -266,11 +266,32 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
266
266
  throw err;
267
267
  }
268
268
  });
269
+ _defineProperty(_this, "removeCardDispatched", false);
269
270
  _this.scrollContainer = findOverflowScrollParent(props.view.dom) || undefined;
270
271
  return _this;
271
272
  }
272
273
  _inherits(EmbedCardComponent, _React$PureComponent);
273
274
  return _createClass(EmbedCardComponent, [{
275
+ key: "componentWillUnmount",
276
+ value: function componentWillUnmount() {
277
+ if (fg('platform_editor_fix_advanced_code_crash')) {
278
+ this.removeCard();
279
+ }
280
+ }
281
+ }, {
282
+ key: "removeCard",
283
+ value: function removeCard() {
284
+ if (this.removeCardDispatched && fg('platform_editor_cards_maxcallstackfix')) {
285
+ return;
286
+ }
287
+ this.removeCardDispatched = true;
288
+ var tr = this.props.view.state.tr;
289
+ _removeCard({
290
+ id: this.props.id
291
+ })(tr);
292
+ this.props.view.dispatch(tr);
293
+ }
294
+ }, {
274
295
  key: "render",
275
296
  value: function render() {
276
297
  var _this$props = this.props,
@@ -414,7 +435,11 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
414
435
  value: function destroy() {
415
436
  var _this$unsubscribe;
416
437
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
417
- this.removeCard();
438
+ if (fg('platform_editor_fix_advanced_code_crash')) {
439
+ _superPropGet(EmbedCard, "destroy", this, 3)([]);
440
+ } else {
441
+ this.removeCard();
442
+ }
418
443
  }
419
444
  }, {
420
445
  key: "removeCard",
@@ -16,6 +16,9 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
16
16
  url?: string | undefined;
17
17
  title?: string | undefined;
18
18
  }) => void;
19
+ componentWillUnmount(): void;
20
+ private removeCardDispatched;
21
+ private removeCard;
19
22
  gapCursorSpan: () => React.JSX.Element | undefined;
20
23
  onError: ({ err }: {
21
24
  err?: Error | undefined;
@@ -38,6 +38,9 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
38
38
  onError: ({ err }: {
39
39
  err?: Error | undefined;
40
40
  }) => void;
41
+ componentWillUnmount(): void;
42
+ private removeCardDispatched;
43
+ private removeCard;
41
44
  render(): React.JSX.Element;
42
45
  }
43
46
  export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback'>;
@@ -16,6 +16,9 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
16
16
  url?: string | undefined;
17
17
  title?: string | undefined;
18
18
  }) => void;
19
+ componentWillUnmount(): void;
20
+ private removeCardDispatched;
21
+ private removeCard;
19
22
  gapCursorSpan: () => React.JSX.Element | undefined;
20
23
  onError: ({ err }: {
21
24
  err?: Error | undefined;
@@ -38,6 +38,9 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
38
38
  onError: ({ err }: {
39
39
  err?: Error | undefined;
40
40
  }) => void;
41
+ componentWillUnmount(): void;
42
+ private removeCardDispatched;
43
+ private removeCard;
41
44
  render(): React.JSX.Element;
42
45
  }
43
46
  export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "6.3.1",
3
+ "version": "6.3.2",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -153,6 +153,9 @@
153
153
  "smart_link_editor_update_toolbar_open_link": {
154
154
  "type": "boolean"
155
155
  },
156
+ "platform_editor_fix_advanced_code_crash": {
157
+ "type": "boolean"
158
+ },
156
159
  "platform_editor_controls_patch_8": {
157
160
  "type": "boolean"
158
161
  },