@atlaskit/editor-plugin-card 2.6.0 → 2.6.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,23 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 2.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#120605](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120605)
8
+ [`b2b0cfe2fb0c4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b2b0cfe2fb0c4) -
9
+ Removed unused code in leftIconOverlay
10
+ - [#121395](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121395)
11
+ [`caceefb824256`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/caceefb824256) -
12
+ Removing contenteditable and CCFE workaround for smart links in live pages
13
+ - Updated dependencies
14
+
15
+ ## 2.6.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 2.6.0
4
22
 
5
23
  ### Minor Changes
@@ -132,30 +132,48 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
132
132
  (0, _inherits2.default)(BlockCard, _ReactNodeView);
133
133
  var _super2 = _createSuper(BlockCard);
134
134
  function BlockCard() {
135
+ var _this2;
135
136
  (0, _classCallCheck2.default)(this, BlockCard);
136
- return _super2.apply(this, arguments);
137
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
138
+ args[_key2] = arguments[_key2];
139
+ }
140
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
141
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "updateContentEditable", function (editorViewModeState, divElement) {
142
+ divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
143
+ });
144
+ return _this2;
137
145
  }
138
146
  (0, _createClass2.default)(BlockCard, [{
139
147
  key: "createDomRef",
140
148
  value: function createDomRef() {
149
+ var _this3 = this;
141
150
  var domRef = document.createElement('div');
142
151
  if (this.reactComponentProps.platform !== 'mobile') {
143
152
  // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
144
153
  // see also: https://github.com/ProseMirror/prosemirror/issues/884
145
- domRef.contentEditable = 'true';
154
+ if ((0, _platformFeatureFlags.fg)('linking-platform-contenteditable-false-live-view')) {
155
+ var _this$reactComponentP, _this$reactComponentP2;
156
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref2) {
157
+ var nextSharedState = _ref2.nextSharedState;
158
+ return _this3.updateContentEditable(nextSharedState, domRef);
159
+ });
160
+ this.updateContentEditable((_this$reactComponentP2 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP2 === void 0 || (_this$reactComponentP2 = _this$reactComponentP2.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.currentState(), domRef);
161
+ } else {
162
+ domRef.contentEditable = 'true';
163
+ }
146
164
  domRef.setAttribute('spellcheck', 'false');
147
165
  }
148
166
  return domRef;
149
167
  }
150
-
168
+ }, {
169
+ key: "validUpdate",
170
+ value:
151
171
  // Need this function to check if the datasource attribute was added or not to a blockCard.
152
172
  // If so, we return false so we can get the node to re-render properly as a datasource node instead.
153
173
  // Otherwise, the node view will still consider the node as a blockCard and render a regular blockCard.
154
- }, {
155
- key: "validUpdate",
156
- value: function validUpdate(currentNode, newNode) {
174
+ function validUpdate(currentNode, newNode) {
157
175
  var _currentNode$attrs, _newNode$attrs;
158
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.editor-datasource-typeguards')) {
176
+ if ((0, _platformFeatureFlags.fg)('platform.linking-platform.editor-datasource-typeguards')) {
159
177
  var _isCurrentNodeBlockCard = !(0, _utils2.isDatasourceNode)(currentNode);
160
178
  var _isNewNodeDatasource = (0, _utils2.isDatasourceNode)(newNode);
161
179
 
@@ -176,12 +194,12 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
176
194
  }, {
177
195
  key: "render",
178
196
  value: function render() {
179
- var _this$reactComponentP = this.reactComponentProps,
180
- platform = _this$reactComponentP.platform,
181
- actionOptions = _this$reactComponentP.actionOptions,
182
- showServerActions = _this$reactComponentP.showServerActions,
183
- pluginInjectionApi = _this$reactComponentP.pluginInjectionApi,
184
- onClickCallback = _this$reactComponentP.onClickCallback;
197
+ var _this$reactComponentP3 = this.reactComponentProps,
198
+ platform = _this$reactComponentP3.platform,
199
+ actionOptions = _this$reactComponentP3.actionOptions,
200
+ showServerActions = _this$reactComponentP3.showServerActions,
201
+ pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
202
+ onClickCallback = _this$reactComponentP3.onClickCallback;
185
203
  return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
186
204
  node: this.node,
187
205
  view: this.view,
@@ -193,6 +211,12 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
193
211
  onClickCallback: onClickCallback
194
212
  });
195
213
  }
214
+ }, {
215
+ key: "destroy",
216
+ value: function destroy() {
217
+ var _this$unsubscribe;
218
+ (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
219
+ }
196
220
  }]);
197
221
  return BlockCard;
198
222
  }(_reactNodeView.default);
@@ -23,6 +23,7 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
23
23
  var _ui = require("@atlaskit/editor-common/ui");
24
24
  var _utils = require("@atlaskit/editor-common/utils");
25
25
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
26
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
27
  var _smartCard = require("@atlaskit/smart-card");
27
28
  var _actions = require("../pm-plugins/actions");
28
29
  var _ResizableEmbedCard = _interopRequireDefault(require("../ui/ResizableEmbedCard"));
@@ -350,8 +351,16 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
350
351
  (0, _inherits2.default)(EmbedCard, _ReactNodeView);
351
352
  var _super2 = _createSuper(EmbedCard);
352
353
  function EmbedCard() {
354
+ var _this2;
353
355
  (0, _classCallCheck2.default)(this, EmbedCard);
354
- return _super2.apply(this, arguments);
356
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
357
+ args[_key2] = arguments[_key2];
358
+ }
359
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
360
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "updateContentEditable", function (editorViewModeState, divElement) {
361
+ divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
362
+ });
363
+ return _this2;
355
364
  }
356
365
  (0, _createClass2.default)(EmbedCard, [{
357
366
  key: "viewShouldUpdate",
@@ -364,10 +373,20 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
364
373
  }, {
365
374
  key: "createDomRef",
366
375
  value: function createDomRef() {
376
+ var _this3 = this;
367
377
  var domRef = document.createElement('div');
368
378
  if (this.reactComponentProps.platform !== 'mobile') {
369
379
  // It is a tradeoff for the bug mentioned that occurs in Chrome: https://product-fabric.atlassian.net/browse/ED-5379, https://github.com/ProseMirror/prosemirror/issues/884
370
- domRef.contentEditable = 'true';
380
+ if ((0, _platformFeatureFlags.fg)('linking-platform-contenteditable-false-live-view')) {
381
+ var _this$reactComponentP, _this$reactComponentP2;
382
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref3) {
383
+ var nextSharedState = _ref3.nextSharedState;
384
+ return _this3.updateContentEditable(nextSharedState, domRef);
385
+ });
386
+ this.updateContentEditable((_this$reactComponentP2 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP2 === void 0 || (_this$reactComponentP2 = _this$reactComponentP2.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.currentState(), domRef);
387
+ } else {
388
+ domRef.contentEditable = 'true';
389
+ }
371
390
  domRef.setAttribute('spellcheck', 'false');
372
391
  }
373
392
  return domRef;
@@ -375,14 +394,14 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
375
394
  }, {
376
395
  key: "render",
377
396
  value: function render() {
378
- var _this$reactComponentP = this.reactComponentProps,
379
- eventDispatcher = _this$reactComponentP.eventDispatcher,
380
- allowResizing = _this$reactComponentP.allowResizing,
381
- platform = _this$reactComponentP.platform,
382
- fullWidthMode = _this$reactComponentP.fullWidthMode,
383
- dispatchAnalyticsEvent = _this$reactComponentP.dispatchAnalyticsEvent,
384
- pluginInjectionApi = _this$reactComponentP.pluginInjectionApi,
385
- onClickCallback = _this$reactComponentP.onClickCallback;
397
+ var _this$reactComponentP3 = this.reactComponentProps,
398
+ eventDispatcher = _this$reactComponentP3.eventDispatcher,
399
+ allowResizing = _this$reactComponentP3.allowResizing,
400
+ platform = _this$reactComponentP3.platform,
401
+ fullWidthMode = _this$reactComponentP3.fullWidthMode,
402
+ dispatchAnalyticsEvent = _this$reactComponentP3.dispatchAnalyticsEvent,
403
+ pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
404
+ onClickCallback = _this$reactComponentP3.onClickCallback;
386
405
  return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
387
406
  node: this.node,
388
407
  view: this.view,
@@ -396,6 +415,12 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
396
415
  onClickCallback: onClickCallback
397
416
  });
398
417
  }
418
+ }, {
419
+ key: "destroy",
420
+ value: function destroy() {
421
+ var _this$unsubscribe;
422
+ (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
423
+ }
399
424
  }]);
400
425
  return EmbedCard;
401
426
  }(_reactNodeView.default);
@@ -5,7 +5,7 @@ import rafSchedule from 'raf-schd';
5
5
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
6
6
  import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
7
7
  import { browser } from '@atlaskit/editor-common/utils';
8
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { Card as SmartCard } from '@atlaskit/smart-card';
10
10
  import { registerCard } from '../pm-plugins/actions';
11
11
  import { isDatasourceNode } from '../utils';
@@ -108,23 +108,36 @@ _defineProperty(BlockCardComponent, "contextTypes", {
108
108
  });
109
109
  const WrappedBlockCard = Card(BlockCardComponent, UnsupportedBlock);
110
110
  export class BlockCard extends ReactNodeView {
111
+ constructor(...args) {
112
+ super(...args);
113
+ _defineProperty(this, "updateContentEditable", (editorViewModeState, divElement) => {
114
+ divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
115
+ });
116
+ }
111
117
  createDomRef() {
112
118
  const domRef = document.createElement('div');
113
119
  if (this.reactComponentProps.platform !== 'mobile') {
114
120
  // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
115
121
  // see also: https://github.com/ProseMirror/prosemirror/issues/884
116
- domRef.contentEditable = 'true';
122
+ if (fg('linking-platform-contenteditable-false-live-view')) {
123
+ var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3, _this$reactComponentP4;
124
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.onChange(({
125
+ nextSharedState
126
+ }) => this.updateContentEditable(nextSharedState, domRef));
127
+ this.updateContentEditable((_this$reactComponentP3 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP3 === void 0 ? void 0 : (_this$reactComponentP4 = _this$reactComponentP3.editorViewMode) === null || _this$reactComponentP4 === void 0 ? void 0 : _this$reactComponentP4.sharedState.currentState(), domRef);
128
+ } else {
129
+ domRef.contentEditable = 'true';
130
+ }
117
131
  domRef.setAttribute('spellcheck', 'false');
118
132
  }
119
133
  return domRef;
120
134
  }
121
-
122
135
  // Need this function to check if the datasource attribute was added or not to a blockCard.
123
136
  // If so, we return false so we can get the node to re-render properly as a datasource node instead.
124
137
  // Otherwise, the node view will still consider the node as a blockCard and render a regular blockCard.
125
138
  validUpdate(currentNode, newNode) {
126
139
  var _currentNode$attrs, _newNode$attrs;
127
- if (getBooleanFF('platform.linking-platform.editor-datasource-typeguards')) {
140
+ if (fg('platform.linking-platform.editor-datasource-typeguards')) {
128
141
  const isCurrentNodeBlockCard = !isDatasourceNode(currentNode);
129
142
  const isNewNodeDatasource = isDatasourceNode(newNode);
130
143
 
@@ -159,4 +172,8 @@ export class BlockCard extends ReactNodeView {
159
172
  onClickCallback: onClickCallback
160
173
  });
161
174
  }
175
+ destroy() {
176
+ var _this$unsubscribe;
177
+ (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
178
+ }
162
179
  }
@@ -9,6 +9,7 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
9
9
  import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
10
10
  import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
11
11
  import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
13
14
  import { registerCard } from '../pm-plugins/actions';
14
15
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
@@ -334,6 +335,12 @@ _defineProperty(EmbedCardComponent, "contextTypes", {
334
335
  });
335
336
  const WrappedBlockCard = Card(EmbedCardComponent, UnsupportedBlock);
336
337
  export class EmbedCard extends ReactNodeView {
338
+ constructor(...args) {
339
+ super(...args);
340
+ _defineProperty(this, "updateContentEditable", (editorViewModeState, divElement) => {
341
+ divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
342
+ });
343
+ }
337
344
  viewShouldUpdate(nextNode) {
338
345
  if (this.node.attrs !== nextNode.attrs) {
339
346
  return true;
@@ -344,7 +351,15 @@ export class EmbedCard extends ReactNodeView {
344
351
  const domRef = document.createElement('div');
345
352
  if (this.reactComponentProps.platform !== 'mobile') {
346
353
  // It is a tradeoff for the bug mentioned that occurs in Chrome: https://product-fabric.atlassian.net/browse/ED-5379, https://github.com/ProseMirror/prosemirror/issues/884
347
- domRef.contentEditable = 'true';
354
+ if (fg('linking-platform-contenteditable-false-live-view')) {
355
+ var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3, _this$reactComponentP4;
356
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.onChange(({
357
+ nextSharedState
358
+ }) => this.updateContentEditable(nextSharedState, domRef));
359
+ this.updateContentEditable((_this$reactComponentP3 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP3 === void 0 ? void 0 : (_this$reactComponentP4 = _this$reactComponentP3.editorViewMode) === null || _this$reactComponentP4 === void 0 ? void 0 : _this$reactComponentP4.sharedState.currentState(), domRef);
360
+ } else {
361
+ domRef.contentEditable = 'true';
362
+ }
348
363
  domRef.setAttribute('spellcheck', 'false');
349
364
  }
350
365
  return domRef;
@@ -372,4 +387,8 @@ export class EmbedCard extends ReactNodeView {
372
387
  onClickCallback: onClickCallback
373
388
  });
374
389
  }
390
+ destroy() {
391
+ var _this$unsubscribe;
392
+ (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
393
+ }
375
394
  }
@@ -14,7 +14,7 @@ import rafSchedule from 'raf-schd';
14
14
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
15
15
  import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
16
16
  import { browser } from '@atlaskit/editor-common/utils';
17
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
18
18
  import { Card as SmartCard } from '@atlaskit/smart-card';
19
19
  import { registerCard } from '../pm-plugins/actions';
20
20
  import { isDatasourceNode } from '../utils';
@@ -126,30 +126,48 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
126
126
  _inherits(BlockCard, _ReactNodeView);
127
127
  var _super2 = _createSuper(BlockCard);
128
128
  function BlockCard() {
129
+ var _this2;
129
130
  _classCallCheck(this, BlockCard);
130
- return _super2.apply(this, arguments);
131
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
132
+ args[_key2] = arguments[_key2];
133
+ }
134
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
135
+ _defineProperty(_assertThisInitialized(_this2), "updateContentEditable", function (editorViewModeState, divElement) {
136
+ divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
137
+ });
138
+ return _this2;
131
139
  }
132
140
  _createClass(BlockCard, [{
133
141
  key: "createDomRef",
134
142
  value: function createDomRef() {
143
+ var _this3 = this;
135
144
  var domRef = document.createElement('div');
136
145
  if (this.reactComponentProps.platform !== 'mobile') {
137
146
  // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
138
147
  // see also: https://github.com/ProseMirror/prosemirror/issues/884
139
- domRef.contentEditable = 'true';
148
+ if (fg('linking-platform-contenteditable-false-live-view')) {
149
+ var _this$reactComponentP, _this$reactComponentP2;
150
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref2) {
151
+ var nextSharedState = _ref2.nextSharedState;
152
+ return _this3.updateContentEditable(nextSharedState, domRef);
153
+ });
154
+ this.updateContentEditable((_this$reactComponentP2 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP2 === void 0 || (_this$reactComponentP2 = _this$reactComponentP2.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.currentState(), domRef);
155
+ } else {
156
+ domRef.contentEditable = 'true';
157
+ }
140
158
  domRef.setAttribute('spellcheck', 'false');
141
159
  }
142
160
  return domRef;
143
161
  }
144
-
162
+ }, {
163
+ key: "validUpdate",
164
+ value:
145
165
  // Need this function to check if the datasource attribute was added or not to a blockCard.
146
166
  // If so, we return false so we can get the node to re-render properly as a datasource node instead.
147
167
  // Otherwise, the node view will still consider the node as a blockCard and render a regular blockCard.
148
- }, {
149
- key: "validUpdate",
150
- value: function validUpdate(currentNode, newNode) {
168
+ function validUpdate(currentNode, newNode) {
151
169
  var _currentNode$attrs, _newNode$attrs;
152
- if (getBooleanFF('platform.linking-platform.editor-datasource-typeguards')) {
170
+ if (fg('platform.linking-platform.editor-datasource-typeguards')) {
153
171
  var _isCurrentNodeBlockCard = !isDatasourceNode(currentNode);
154
172
  var _isNewNodeDatasource = isDatasourceNode(newNode);
155
173
 
@@ -170,12 +188,12 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
170
188
  }, {
171
189
  key: "render",
172
190
  value: function render() {
173
- var _this$reactComponentP = this.reactComponentProps,
174
- platform = _this$reactComponentP.platform,
175
- actionOptions = _this$reactComponentP.actionOptions,
176
- showServerActions = _this$reactComponentP.showServerActions,
177
- pluginInjectionApi = _this$reactComponentP.pluginInjectionApi,
178
- onClickCallback = _this$reactComponentP.onClickCallback;
191
+ var _this$reactComponentP3 = this.reactComponentProps,
192
+ platform = _this$reactComponentP3.platform,
193
+ actionOptions = _this$reactComponentP3.actionOptions,
194
+ showServerActions = _this$reactComponentP3.showServerActions,
195
+ pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
196
+ onClickCallback = _this$reactComponentP3.onClickCallback;
179
197
  return /*#__PURE__*/React.createElement(WrappedBlockCard, {
180
198
  node: this.node,
181
199
  view: this.view,
@@ -187,6 +205,12 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
187
205
  onClickCallback: onClickCallback
188
206
  });
189
207
  }
208
+ }, {
209
+ key: "destroy",
210
+ value: function destroy() {
211
+ var _this$unsubscribe;
212
+ (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
213
+ }
190
214
  }]);
191
215
  return BlockCard;
192
216
  }(ReactNodeView);
@@ -20,6 +20,7 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
20
20
  import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
21
21
  import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
22
22
  import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
23
+ import { fg } from '@atlaskit/platform-feature-flags';
23
24
  import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
24
25
  import { registerCard } from '../pm-plugins/actions';
25
26
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
@@ -343,8 +344,16 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
343
344
  _inherits(EmbedCard, _ReactNodeView);
344
345
  var _super2 = _createSuper(EmbedCard);
345
346
  function EmbedCard() {
347
+ var _this2;
346
348
  _classCallCheck(this, EmbedCard);
347
- return _super2.apply(this, arguments);
349
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
350
+ args[_key2] = arguments[_key2];
351
+ }
352
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
353
+ _defineProperty(_assertThisInitialized(_this2), "updateContentEditable", function (editorViewModeState, divElement) {
354
+ divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
355
+ });
356
+ return _this2;
348
357
  }
349
358
  _createClass(EmbedCard, [{
350
359
  key: "viewShouldUpdate",
@@ -357,10 +366,20 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
357
366
  }, {
358
367
  key: "createDomRef",
359
368
  value: function createDomRef() {
369
+ var _this3 = this;
360
370
  var domRef = document.createElement('div');
361
371
  if (this.reactComponentProps.platform !== 'mobile') {
362
372
  // It is a tradeoff for the bug mentioned that occurs in Chrome: https://product-fabric.atlassian.net/browse/ED-5379, https://github.com/ProseMirror/prosemirror/issues/884
363
- domRef.contentEditable = 'true';
373
+ if (fg('linking-platform-contenteditable-false-live-view')) {
374
+ var _this$reactComponentP, _this$reactComponentP2;
375
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref3) {
376
+ var nextSharedState = _ref3.nextSharedState;
377
+ return _this3.updateContentEditable(nextSharedState, domRef);
378
+ });
379
+ this.updateContentEditable((_this$reactComponentP2 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP2 === void 0 || (_this$reactComponentP2 = _this$reactComponentP2.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.currentState(), domRef);
380
+ } else {
381
+ domRef.contentEditable = 'true';
382
+ }
364
383
  domRef.setAttribute('spellcheck', 'false');
365
384
  }
366
385
  return domRef;
@@ -368,14 +387,14 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
368
387
  }, {
369
388
  key: "render",
370
389
  value: function render() {
371
- var _this$reactComponentP = this.reactComponentProps,
372
- eventDispatcher = _this$reactComponentP.eventDispatcher,
373
- allowResizing = _this$reactComponentP.allowResizing,
374
- platform = _this$reactComponentP.platform,
375
- fullWidthMode = _this$reactComponentP.fullWidthMode,
376
- dispatchAnalyticsEvent = _this$reactComponentP.dispatchAnalyticsEvent,
377
- pluginInjectionApi = _this$reactComponentP.pluginInjectionApi,
378
- onClickCallback = _this$reactComponentP.onClickCallback;
390
+ var _this$reactComponentP3 = this.reactComponentProps,
391
+ eventDispatcher = _this$reactComponentP3.eventDispatcher,
392
+ allowResizing = _this$reactComponentP3.allowResizing,
393
+ platform = _this$reactComponentP3.platform,
394
+ fullWidthMode = _this$reactComponentP3.fullWidthMode,
395
+ dispatchAnalyticsEvent = _this$reactComponentP3.dispatchAnalyticsEvent,
396
+ pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
397
+ onClickCallback = _this$reactComponentP3.onClickCallback;
379
398
  return /*#__PURE__*/React.createElement(WrappedBlockCard, {
380
399
  node: this.node,
381
400
  view: this.view,
@@ -389,6 +408,12 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
389
408
  onClickCallback: onClickCallback
390
409
  });
391
410
  }
411
+ }, {
412
+ key: "destroy",
413
+ value: function destroy() {
414
+ var _this$unsubscribe;
415
+ (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
416
+ }
392
417
  }]);
393
418
  return EmbedCard;
394
419
  }(ReactNodeView);
@@ -22,8 +22,11 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
22
22
  }
23
23
  export type BlockCardNodeViewProps = Pick<SmartCardProps, 'platform' | 'actionOptions' | 'showServerActions' | 'pluginInjectionApi' | 'onClickCallback'>;
24
24
  export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
25
+ unsubscribe: (() => void) | undefined;
25
26
  createDomRef(): HTMLElement;
27
+ private updateContentEditable;
26
28
  validUpdate(currentNode: Node, newNode: Node): boolean;
27
29
  update(node: Node, decorations: ReadonlyArray<Decoration>, _innerDecorations?: DecorationSource): boolean;
28
30
  render(): JSX.Element;
31
+ destroy(): void;
29
32
  }
@@ -40,7 +40,10 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
40
40
  }
41
41
  export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'platform' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'showServerActions' | 'onClickCallback'>;
42
42
  export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
43
+ unsubscribe: (() => void) | undefined;
43
44
  viewShouldUpdate(nextNode: PMNode): boolean;
44
45
  createDomRef(): HTMLElement;
46
+ private updateContentEditable;
45
47
  render(): JSX.Element;
48
+ destroy(): void;
46
49
  }
@@ -22,8 +22,11 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
22
22
  }
23
23
  export type BlockCardNodeViewProps = Pick<SmartCardProps, 'platform' | 'actionOptions' | 'showServerActions' | 'pluginInjectionApi' | 'onClickCallback'>;
24
24
  export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
25
+ unsubscribe: (() => void) | undefined;
25
26
  createDomRef(): HTMLElement;
27
+ private updateContentEditable;
26
28
  validUpdate(currentNode: Node, newNode: Node): boolean;
27
29
  update(node: Node, decorations: ReadonlyArray<Decoration>, _innerDecorations?: DecorationSource): boolean;
28
30
  render(): JSX.Element;
31
+ destroy(): void;
29
32
  }
@@ -40,7 +40,10 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
40
40
  }
41
41
  export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'platform' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'showServerActions' | 'onClickCallback'>;
42
42
  export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
43
+ unsubscribe: (() => void) | undefined;
43
44
  viewShouldUpdate(nextNode: PMNode): boolean;
44
45
  createDomRef(): HTMLElement;
46
+ private updateContentEditable;
45
47
  render(): JSX.Element;
48
+ destroy(): void;
46
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,10 +34,8 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^39.0.3",
36
36
  "@atlaskit/analytics-next": "^9.3.0",
37
- "@atlaskit/button": "^18.4.0",
38
37
  "@atlaskit/custom-steps": "^0.4.0",
39
- "@atlaskit/dropdown-menu": "^12.14.0",
40
- "@atlaskit/editor-common": "^85.0.0",
38
+ "@atlaskit/editor-common": "^86.2.0",
41
39
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
42
40
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
43
41
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
@@ -55,13 +53,12 @@
55
53
  "@atlaskit/link-datasource": "^2.5.0",
56
54
  "@atlaskit/linking-common": "^5.7.0",
57
55
  "@atlaskit/linking-types": "^8.11.0",
58
- "@atlaskit/menu": "2.8.0",
56
+ "@atlaskit/menu": "2.8.1",
59
57
  "@atlaskit/platform-feature-flags": "^0.3.0",
60
58
  "@atlaskit/primitives": "^11.0.0",
61
59
  "@atlaskit/smart-card": "^27.9.0",
62
60
  "@atlaskit/theme": "^12.11.0",
63
- "@atlaskit/tokens": "^1.54.0",
64
- "@atlaskit/tooltip": "^18.5.0",
61
+ "@atlaskit/tokens": "^1.56.0",
65
62
  "@babel/runtime": "^7.0.0",
66
63
  "@emotion/react": "^11.7.1",
67
64
  "lodash": "^4.17.21",
@@ -136,6 +133,9 @@
136
133
  },
137
134
  "platform_editor_get_card_provider_from_config": {
138
135
  "type": "boolean"
136
+ },
137
+ "linking-platform-contenteditable-false-live-view": {
138
+ "type": "boolean"
139
139
  }
140
140
  },
141
141
  "stricter": {
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _react = _interopRequireDefault(require("react"));
12
- var _reactIntlNext = require("react-intl-next");
13
- var _new = _interopRequireDefault(require("@atlaskit/button/new"));
14
- var _dropdownMenu = _interopRequireWildcard(require("@atlaskit/dropdown-menu"));
15
- var _messages = require("@atlaskit/editor-common/messages");
16
- var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
17
- var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
18
- var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
19
- var _excluded = ["triggerRef"];
20
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
- var ConfigureLinkDropdown = function ConfigureLinkDropdown(props) {
23
- var testId = props.testId;
24
- var intl = (0, _reactIntlNext.useIntl)();
25
- var configureLinkLabel = intl.formatMessage(_messages.cardMessages.inlineConfigureLink);
26
- var goToLinkLabel = intl.formatMessage(_messages.cardMessages.inlineConfigureLink);
27
- return /*#__PURE__*/_react.default.createElement(_dropdownMenu.default, {
28
- trigger: function trigger(_ref) {
29
- var triggerRef = _ref.triggerRef,
30
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
- return /*#__PURE__*/_react.default.createElement(_new.default, (0, _extends2.default)({}, props, {
32
- spacing: 'none',
33
- ref: triggerRef
34
- }), /*#__PURE__*/_react.default.createElement("span", {
35
- style: {
36
- padding: "0 ".concat("var(--ds-space-025, 2px)")
37
- }
38
- }, /*#__PURE__*/_react.default.createElement(_chevronDown.default, {
39
- label: configureLinkLabel,
40
- size: 'small',
41
- testId: "".concat(testId, "-icon")
42
- })));
43
- },
44
- spacing: 'compact',
45
- placement: 'bottom-start'
46
- }, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, null, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
47
- elemBefore: /*#__PURE__*/_react.default.createElement(_shortcut.default, {
48
- label: goToLinkLabel,
49
- size: 'small'
50
- })
51
- }, goToLinkLabel), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
52
- elemBefore: /*#__PURE__*/_react.default.createElement(_preferences.default, {
53
- label: configureLinkLabel,
54
- size: 'small'
55
- })
56
- }, configureLinkLabel)));
57
- };
58
- var _default = exports.default = ConfigureLinkDropdown;