@atlaskit/editor-core 158.0.0 → 158.0.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/plugins/card/nodeviews/blockCard.js +5 -3
  3. package/dist/cjs/plugins/card/nodeviews/embedCard.js +0 -10
  4. package/dist/cjs/plugins/card/nodeviews/genericCard.js +2 -31
  5. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -3
  6. package/dist/cjs/plugins/card/pm-plugins/doc.js +6 -55
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/plugins/card/nodeviews/blockCard.js +3 -2
  10. package/dist/es2019/plugins/card/nodeviews/embedCard.js +0 -8
  11. package/dist/es2019/plugins/card/nodeviews/genericCard.js +2 -13
  12. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +3 -2
  13. package/dist/es2019/plugins/card/pm-plugins/doc.js +4 -46
  14. package/dist/es2019/version-wrapper.js +1 -1
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/plugins/card/nodeviews/blockCard.js +5 -4
  17. package/dist/esm/plugins/card/nodeviews/embedCard.js +0 -10
  18. package/dist/esm/plugins/card/nodeviews/genericCard.js +3 -30
  19. package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -4
  20. package/dist/esm/plugins/card/pm-plugins/doc.js +4 -49
  21. package/dist/esm/version-wrapper.js +1 -1
  22. package/dist/esm/version.json +1 -1
  23. package/dist/types/plugins/analytics/types/events.d.ts +1 -5
  24. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -3
  25. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +0 -1
  26. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +0 -4
  27. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +3 -2
  28. package/dist/types/plugins/card/pm-plugins/doc.d.ts +0 -1
  29. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 158.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c7a3ccf95cd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c7a3ccf95cd) - Patching versions to no longer reference localid from adf or smart-cards
8
+
3
9
  ## 158.0.0
4
10
 
5
11
  ### Patch Changes
@@ -35,6 +35,8 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
35
35
 
36
36
  var _genericCard = require("./genericCard");
37
37
 
38
+ var _nodeviews = require("../../../nodeviews/");
39
+
38
40
  var _actions = require("../pm-plugins/actions");
39
41
 
40
42
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -140,8 +142,8 @@ exports.BlockCardComponent = BlockCardComponent;
140
142
  });
141
143
  var WrappedBlockCard = (0, _genericCard.Card)(BlockCardComponent, _ui.UnsupportedBlock);
142
144
 
143
- var BlockCard = /*#__PURE__*/function (_GenericCard) {
144
- (0, _inherits2.default)(BlockCard, _GenericCard);
145
+ var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
146
+ (0, _inherits2.default)(BlockCard, _ReactNodeView);
145
147
 
146
148
  var _super2 = _createSuper(BlockCard);
147
149
 
@@ -176,6 +178,6 @@ var BlockCard = /*#__PURE__*/function (_GenericCard) {
176
178
  }
177
179
  }]);
178
180
  return BlockCard;
179
- }(_genericCard.GenericCard);
181
+ }(_nodeviews.ReactNodeView);
180
182
 
181
183
  exports.BlockCard = BlockCard;
@@ -41,8 +41,6 @@ var _utils = require("@atlaskit/editor-common/utils");
41
41
 
42
42
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
43
43
 
44
- var _adfSchema = require("@atlaskit/adf-schema");
45
-
46
44
  var _nodeviews = require("../../../nodeviews/");
47
45
 
48
46
  var _actions = require("../pm-plugins/actions");
@@ -368,14 +366,6 @@ var EmbedCard = /*#__PURE__*/function (_SelectionBasedNodeVi) {
368
366
  }
369
367
 
370
368
  (0, _createClass2.default)(EmbedCard, [{
371
- key: "init",
372
- value: function init() {
373
- (0, _get2.default)((0, _getPrototypeOf2.default)(EmbedCard.prototype), "init", this).call(this); // localId exists to distinguish between different smart cards for the purpose of analytics
374
-
375
- this.node.attrs.localId = this.node.attrs.localId || _adfSchema.uuid.generate();
376
- return this;
377
- }
378
- }, {
379
369
  key: "viewShouldUpdate",
380
370
  value: function viewShouldUpdate(nextNode) {
381
371
  if (this.node.attrs !== nextNode.attrs) {
@@ -6,9 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.Card = Card;
9
- exports.GenericCard = void 0;
10
-
11
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
12
9
 
13
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
11
 
@@ -32,8 +29,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
32
29
 
33
30
  var _adfSchema = require("@atlaskit/adf-schema");
34
31
 
35
- var _ReactNodeView2 = _interopRequireDefault(require("../../../nodeviews/ReactNodeView"));
36
-
37
32
  var _utils = require("../utils");
38
33
 
39
34
  var _doc = require("../pm-plugins/doc");
@@ -119,7 +114,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
119
114
  return;
120
115
  }
121
116
 
122
- (0, _doc.changeSelectedCardToLinkFallback)(undefined, url, true, node, getPos())(view.state, view.dispatch);
117
+ (0, _doc.changeSelectedCardToLink)(undefined, url, true, node, getPos())(view.state, view.dispatch);
123
118
  return null;
124
119
  } else {
125
120
  // Otherwise, render a blue link as fallback (above in render()).
@@ -133,28 +128,4 @@ function Card(SmartCardComponent, UnsupportedComponent) {
133
128
  }(_react.default.Component), (0, _defineProperty2.default)(_class, "contextTypes", {
134
129
  contextAdapter: _propTypes.default.object
135
130
  }), _temp;
136
- }
137
-
138
- var GenericCard = /*#__PURE__*/function (_ReactNodeView) {
139
- (0, _inherits2.default)(GenericCard, _ReactNodeView);
140
-
141
- var _super2 = _createSuper(GenericCard);
142
-
143
- function GenericCard() {
144
- (0, _classCallCheck2.default)(this, GenericCard);
145
- return _super2.apply(this, arguments);
146
- }
147
-
148
- (0, _createClass2.default)(GenericCard, [{
149
- key: "init",
150
- value: function init() {
151
- (0, _get2.default)((0, _getPrototypeOf2.default)(GenericCard.prototype), "init", this).call(this); // localId exists to distinguish between different smart cards for the purpose of analytics
152
-
153
- this.node.attrs.localId = this.node.attrs.localId || _adfSchema.uuid.generate();
154
- return this;
155
- }
156
- }]);
157
- return GenericCard;
158
- }(_ReactNodeView2.default);
159
-
160
- exports.GenericCard = GenericCard;
131
+ }
@@ -37,6 +37,8 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
37
37
 
38
38
  var _genericCard = require("./genericCard");
39
39
 
40
+ var _ReactNodeView2 = _interopRequireDefault(require("../../../nodeviews/ReactNodeView"));
41
+
40
42
  var _actions = require("../pm-plugins/actions");
41
43
 
42
44
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -130,8 +132,8 @@ exports.InlineCardComponent = InlineCardComponent;
130
132
  });
131
133
  var WrappedInlineCard = (0, _genericCard.Card)(InlineCardComponent, _ui.UnsupportedInline);
132
134
 
133
- var InlineCard = /*#__PURE__*/function (_GenericCard) {
134
- (0, _inherits2.default)(InlineCard, _GenericCard);
135
+ var InlineCard = /*#__PURE__*/function (_ReactNodeView) {
136
+ (0, _inherits2.default)(InlineCard, _ReactNodeView);
135
137
 
136
138
  var _super2 = _createSuper(InlineCard);
137
139
 
@@ -160,6 +162,6 @@ var InlineCard = /*#__PURE__*/function (_GenericCard) {
160
162
  }
161
163
  }]);
162
164
  return InlineCard;
163
- }(_genericCard.GenericCard);
165
+ }(_ReactNodeView2.default);
164
166
 
165
167
  exports.InlineCard = InlineCard;
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.handleFallbackWithAnalytics = exports.convertHyperlinkToSmartCard = exports.changeSelectedCardToText = exports.changeSelectedCardToLinkFallback = exports.changeSelectedCardToLink = void 0;
8
+ exports.handleFallbackWithAnalytics = exports.convertHyperlinkToSmartCard = exports.changeSelectedCardToText = exports.changeSelectedCardToLink = void 0;
9
9
  exports.insertCard = insertCard;
10
10
  exports.updateCard = exports.setSelectedCardAppearance = exports.replaceQueuedUrlWithCard = exports.queueCardsFromChangedTr = void 0;
11
11
 
@@ -41,8 +41,6 @@ var _analytics2 = require("../../../plugins/hyperlink/analytics");
41
41
 
42
42
  var _linkingUtils = require("../../../utils/linking-utils");
43
43
 
44
- var _featureFlagsContext = require("../../feature-flags-context");
45
-
46
44
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
47
45
 
48
46
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -254,47 +252,6 @@ var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(state, so
254
252
  exports.convertHyperlinkToSmartCard = convertHyperlinkToSmartCard;
255
253
 
256
254
  var changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sendAnalytics, node, pos) {
257
- return function (state, dispatch) {
258
- var tr;
259
-
260
- if (node && pos) {
261
- tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
262
- } else {
263
- tr = cardToLinkWithTransaction(state, text, href);
264
- }
265
-
266
- var selectedNode = state.selection instanceof _prosemirrorState.NodeSelection && state.selection.node;
267
-
268
- if (sendAnalytics) {
269
- if (selectedNode) {
270
- var _getFeatureFlags = (0, _featureFlagsContext.getFeatureFlags)(state),
271
- viewChangingExperimentToolbarStyle = _getFeatureFlags.viewChangingExperimentToolbarStyle;
272
-
273
- (0, _analytics.addAnalytics)(state, tr, {
274
- action: _analytics.ACTION.CHANGED_TYPE,
275
- actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
276
- eventType: _analytics.EVENT_TYPE.TRACK,
277
- attributes: {
278
- newType: _nodeEvents.SMART_LINK_TYPE.URL,
279
- previousType: (0, _utils.appearanceForNodeType)(selectedNode.type),
280
- localId: selectedNode.attrs.localId,
281
- featureFlag: viewChangingExperimentToolbarStyle || 'noChange'
282
- }
283
- });
284
- }
285
- }
286
-
287
- if (dispatch) {
288
- dispatch(tr.scrollIntoView());
289
- }
290
-
291
- return true;
292
- };
293
- };
294
-
295
- exports.changeSelectedCardToLink = changeSelectedCardToLink;
296
-
297
- var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback(text, href, sendAnalytics, node, pos) {
298
255
  return function (state, dispatch) {
299
256
  var tr;
300
257
 
@@ -306,11 +263,11 @@ var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback
306
263
 
307
264
  if (sendAnalytics) {
308
265
  (0, _analytics.addAnalytics)(state, tr, {
309
- action: _analytics.ACTION.ERRORED,
266
+ action: _analytics.ACTION.CHANGED_TYPE,
310
267
  actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
311
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
268
+ eventType: _analytics.EVENT_TYPE.TRACK,
312
269
  attributes: {
313
- error: 'Smart card falling back to link.'
270
+ newType: _nodeEvents.SMART_LINK_TYPE.URL
314
271
  }
315
272
  });
316
273
  }
@@ -323,7 +280,7 @@ var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback
323
280
  };
324
281
  };
325
282
 
326
- exports.changeSelectedCardToLinkFallback = changeSelectedCardToLinkFallback;
283
+ exports.changeSelectedCardToLink = changeSelectedCardToLink;
327
284
 
328
285
  var updateCard = function updateCard(href) {
329
286
  return function (state, dispatch) {
@@ -416,19 +373,13 @@ var setSelectedCardAppearance = function setSelectedCardAppearance(appearance) {
416
373
  var from = state.selection.from;
417
374
  var nodeType = getLinkNodeType(appearance, state.schema.nodes);
418
375
  var tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
419
-
420
- var _getFeatureFlags2 = (0, _featureFlagsContext.getFeatureFlags)(state),
421
- viewChangingExperimentToolbarStyle = _getFeatureFlags2.viewChangingExperimentToolbarStyle;
422
-
423
376
  (0, _analytics.addAnalytics)(state, tr, {
424
377
  action: _analytics.ACTION.CHANGED_TYPE,
425
378
  actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
426
379
  eventType: _analytics.EVENT_TYPE.TRACK,
427
380
  attributes: {
428
381
  newType: appearance,
429
- previousType: (0, _utils.appearanceForNodeType)(selectedNode.type),
430
- localId: selectedNode.attrs.localId,
431
- featureFlag: viewChangingExperimentToolbarStyle || 'noChange'
382
+ previousType: (0, _utils.appearanceForNodeType)(selectedNode.type)
432
383
  }
433
384
  });
434
385
 
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "158.0.0";
9
+ var version = "158.0.1";
10
10
  exports.version = version;
11
11
 
12
12
  var nextMajorVersion = function nextMajorVersion() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "158.0.0",
3
+ "version": "158.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -5,7 +5,8 @@ import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
5
5
  import { browser } from '@atlaskit/editor-common/utils';
6
6
  import PropTypes from 'prop-types';
7
7
  import rafSchedule from 'raf-schd';
8
- import { Card, GenericCard } from './genericCard';
8
+ import { Card } from './genericCard';
9
+ import { ReactNodeView } from '../../../nodeviews/';
9
10
  import { registerCard } from '../pm-plugins/actions';
10
11
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
11
12
  export class BlockCardComponent extends React.PureComponent {
@@ -95,7 +96,7 @@ _defineProperty(BlockCardComponent, "contextTypes", {
95
96
  });
96
97
 
97
98
  const WrappedBlockCard = Card(BlockCardComponent, UnsupportedBlock);
98
- export class BlockCard extends GenericCard {
99
+ export class BlockCard extends ReactNodeView {
99
100
  createDomRef() {
100
101
  const domRef = document.createElement('div');
101
102
 
@@ -8,7 +8,6 @@ import { Card } from './genericCard';
8
8
  import { UnsupportedBlock, MediaSingle as RichMediaWrapper, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
9
9
  import { browser } from '@atlaskit/editor-common/utils';
10
10
  import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
11
- import { uuid } from '@atlaskit/adf-schema';
12
11
  import { SelectionBasedNodeView } from '../../../nodeviews/';
13
12
  import { registerCard } from '../pm-plugins/actions';
14
13
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
@@ -303,13 +302,6 @@ _defineProperty(EmbedCardComponent, "contextTypes", {
303
302
 
304
303
  const WrappedBlockCard = Card(EmbedCardComponent, UnsupportedBlock);
305
304
  export class EmbedCard extends SelectionBasedNodeView {
306
- init() {
307
- super.init(); // localId exists to distinguish between different smart cards for the purpose of analytics
308
-
309
- this.node.attrs.localId = this.node.attrs.localId || uuid.generate();
310
- return this;
311
- }
312
-
313
305
  viewShouldUpdate(nextNode) {
314
306
  if (this.node.attrs !== nextNode.attrs) {
315
307
  return true;
@@ -3,10 +3,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { isSafeUrl } from '@atlaskit/adf-schema';
6
- import ReactNodeView from '../../../nodeviews/ReactNodeView';
7
6
  import { titleUrlPairFromNode } from '../utils';
8
- import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
9
- import { uuid } from '@atlaskit/adf-schema';
7
+ import { changeSelectedCardToLink } from '../pm-plugins/doc';
10
8
  export function Card(SmartCardComponent, UnsupportedComponent) {
11
9
  var _class, _temp;
12
10
 
@@ -71,7 +69,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
71
69
  return;
72
70
  }
73
71
 
74
- changeSelectedCardToLinkFallback(undefined, url, true, node, getPos())(view.state, view.dispatch);
72
+ changeSelectedCardToLink(undefined, url, true, node, getPos())(view.state, view.dispatch);
75
73
  return null;
76
74
  } else {
77
75
  // Otherwise, render a blue link as fallback (above in render()).
@@ -84,13 +82,4 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
84
82
  }, _defineProperty(_class, "contextTypes", {
85
83
  contextAdapter: PropTypes.object
86
84
  }), _temp;
87
- }
88
- export class GenericCard extends ReactNodeView {
89
- init() {
90
- super.init(); // localId exists to distinguish between different smart cards for the purpose of analytics
91
-
92
- this.node.attrs.localId = this.node.attrs.localId || uuid.generate();
93
- return this;
94
- }
95
-
96
85
  }
@@ -6,7 +6,8 @@ import { UnsupportedInline } from '@atlaskit/editor-common/ui';
6
6
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
7
7
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
8
8
  import rafSchedule from 'raf-schd';
9
- import { Card, GenericCard } from './genericCard';
9
+ import { Card } from './genericCard';
10
+ import ReactNodeView from '../../../nodeviews/ReactNodeView';
10
11
  import { registerCard } from '../pm-plugins/actions';
11
12
  export class InlineCardComponent extends React.PureComponent {
12
13
  constructor(...args) {
@@ -82,7 +83,7 @@ _defineProperty(InlineCardComponent, "contextTypes", {
82
83
  });
83
84
 
84
85
  const WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
85
- export class InlineCard extends GenericCard {
86
+ export class InlineCard extends ReactNodeView {
86
87
  createDomRef() {
87
88
  return super.createDomRef({
88
89
  displayInlineBlockForInlineNodes: false
@@ -12,7 +12,6 @@ import { shouldReplaceLink } from './shouldReplaceLink';
12
12
  import { SMART_LINK_TYPE } from '../../../plugins/analytics/types/node-events';
13
13
  import { getLinkCreationAnalyticsEvent } from '../../../plugins/hyperlink/analytics';
14
14
  import { unlinkPayload } from '../../../utils/linking-utils';
15
- import { getFeatureFlags } from '../../feature-flags-context';
16
15
  export function insertCard(tr, cardAdf, schema) {
17
16
  const {
18
17
  inlineCard
@@ -208,49 +207,13 @@ export const changeSelectedCardToLink = (text, href, sendAnalytics, node, pos) =
208
207
  tr = cardToLinkWithTransaction(state, text, href);
209
208
  }
210
209
 
211
- const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
212
-
213
- if (sendAnalytics) {
214
- if (selectedNode) {
215
- const {
216
- viewChangingExperimentToolbarStyle
217
- } = getFeatureFlags(state);
218
- addAnalytics(state, tr, {
219
- action: ACTION.CHANGED_TYPE,
220
- actionSubject: ACTION_SUBJECT.SMART_LINK,
221
- eventType: EVENT_TYPE.TRACK,
222
- attributes: {
223
- newType: SMART_LINK_TYPE.URL,
224
- previousType: appearanceForNodeType(selectedNode.type),
225
- localId: selectedNode.attrs.localId,
226
- featureFlag: viewChangingExperimentToolbarStyle || 'noChange'
227
- }
228
- });
229
- }
230
- }
231
-
232
- if (dispatch) {
233
- dispatch(tr.scrollIntoView());
234
- }
235
-
236
- return true;
237
- };
238
- export const changeSelectedCardToLinkFallback = (text, href, sendAnalytics, node, pos) => (state, dispatch) => {
239
- let tr;
240
-
241
- if (node && pos) {
242
- tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
243
- } else {
244
- tr = cardToLinkWithTransaction(state, text, href);
245
- }
246
-
247
210
  if (sendAnalytics) {
248
211
  addAnalytics(state, tr, {
249
- action: ACTION.ERRORED,
212
+ action: ACTION.CHANGED_TYPE,
250
213
  actionSubject: ACTION_SUBJECT.SMART_LINK,
251
- eventType: EVENT_TYPE.OPERATIONAL,
214
+ eventType: EVENT_TYPE.TRACK,
252
215
  attributes: {
253
- error: 'Smart card falling back to link.'
216
+ newType: SMART_LINK_TYPE.URL
254
217
  }
255
218
  });
256
219
  }
@@ -348,18 +311,13 @@ export const setSelectedCardAppearance = appearance => (state, dispatch) => {
348
311
  } = state.selection;
349
312
  const nodeType = getLinkNodeType(appearance, state.schema.nodes);
350
313
  const tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
351
- const {
352
- viewChangingExperimentToolbarStyle
353
- } = getFeatureFlags(state);
354
314
  addAnalytics(state, tr, {
355
315
  action: ACTION.CHANGED_TYPE,
356
316
  actionSubject: ACTION_SUBJECT.SMART_LINK,
357
317
  eventType: EVENT_TYPE.TRACK,
358
318
  attributes: {
359
319
  newType: appearance,
360
- previousType: appearanceForNodeType(selectedNode.type),
361
- localId: selectedNode.attrs.localId,
362
- featureFlag: viewChangingExperimentToolbarStyle || 'noChange'
320
+ previousType: appearanceForNodeType(selectedNode.type)
363
321
  }
364
322
  });
365
323
 
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "158.0.0";
2
+ export const version = "158.0.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "158.0.0",
3
+ "version": "158.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -16,7 +16,8 @@ import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
16
16
  import { browser } from '@atlaskit/editor-common/utils';
17
17
  import PropTypes from 'prop-types';
18
18
  import rafSchedule from 'raf-schd';
19
- import { Card, GenericCard } from './genericCard';
19
+ import { Card } from './genericCard';
20
+ import { ReactNodeView } from '../../../nodeviews/';
20
21
  import { registerCard } from '../pm-plugins/actions';
21
22
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
22
23
  export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
@@ -120,8 +121,8 @@ _defineProperty(BlockCardComponent, "contextTypes", {
120
121
  });
121
122
 
122
123
  var WrappedBlockCard = Card(BlockCardComponent, UnsupportedBlock);
123
- export var BlockCard = /*#__PURE__*/function (_GenericCard) {
124
- _inherits(BlockCard, _GenericCard);
124
+ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
125
+ _inherits(BlockCard, _ReactNodeView);
125
126
 
126
127
  var _super2 = _createSuper(BlockCard);
127
128
 
@@ -158,4 +159,4 @@ export var BlockCard = /*#__PURE__*/function (_GenericCard) {
158
159
  }]);
159
160
 
160
161
  return BlockCard;
161
- }(GenericCard);
162
+ }(ReactNodeView);
@@ -24,7 +24,6 @@ import { Card } from './genericCard';
24
24
  import { UnsupportedBlock, MediaSingle as RichMediaWrapper, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
25
25
  import { browser } from '@atlaskit/editor-common/utils';
26
26
  import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
27
- import { uuid } from '@atlaskit/adf-schema';
28
27
  import { SelectionBasedNodeView } from '../../../nodeviews/';
29
28
  import { registerCard } from '../pm-plugins/actions';
30
29
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
@@ -340,15 +339,6 @@ export var EmbedCard = /*#__PURE__*/function (_SelectionBasedNodeVi) {
340
339
  }
341
340
 
342
341
  _createClass(EmbedCard, [{
343
- key: "init",
344
- value: function init() {
345
- _get(_getPrototypeOf(EmbedCard.prototype), "init", this).call(this); // localId exists to distinguish between different smart cards for the purpose of analytics
346
-
347
-
348
- this.node.attrs.localId = this.node.attrs.localId || uuid.generate();
349
- return this;
350
- }
351
- }, {
352
342
  key: "viewShouldUpdate",
353
343
  value: function viewShouldUpdate(nextNode) {
354
344
  if (this.node.attrs !== nextNode.attrs) {
@@ -1,4 +1,3 @@
1
- import _get from "@babel/runtime/helpers/get";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -15,10 +14,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
15
14
  import React from 'react';
16
15
  import PropTypes from 'prop-types';
17
16
  import { isSafeUrl } from '@atlaskit/adf-schema';
18
- import ReactNodeView from '../../../nodeviews/ReactNodeView';
19
17
  import { titleUrlPairFromNode } from '../utils';
20
- import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
21
- import { uuid } from '@atlaskit/adf-schema';
18
+ import { changeSelectedCardToLink } from '../pm-plugins/doc';
22
19
  export function Card(SmartCardComponent, UnsupportedComponent) {
23
20
  var _class, _temp;
24
21
 
@@ -98,7 +95,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
98
95
  return;
99
96
  }
100
97
 
101
- changeSelectedCardToLinkFallback(undefined, url, true, node, getPos())(view.state, view.dispatch);
98
+ changeSelectedCardToLink(undefined, url, true, node, getPos())(view.state, view.dispatch);
102
99
  return null;
103
100
  } else {
104
101
  // Otherwise, render a blue link as fallback (above in render()).
@@ -113,28 +110,4 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
113
110
  }(React.Component), _defineProperty(_class, "contextTypes", {
114
111
  contextAdapter: PropTypes.object
115
112
  }), _temp;
116
- }
117
- export var GenericCard = /*#__PURE__*/function (_ReactNodeView) {
118
- _inherits(GenericCard, _ReactNodeView);
119
-
120
- var _super2 = _createSuper(GenericCard);
121
-
122
- function GenericCard() {
123
- _classCallCheck(this, GenericCard);
124
-
125
- return _super2.apply(this, arguments);
126
- }
127
-
128
- _createClass(GenericCard, [{
129
- key: "init",
130
- value: function init() {
131
- _get(_getPrototypeOf(GenericCard.prototype), "init", this).call(this); // localId exists to distinguish between different smart cards for the purpose of analytics
132
-
133
-
134
- this.node.attrs.localId = this.node.attrs.localId || uuid.generate();
135
- return this;
136
- }
137
- }]);
138
-
139
- return GenericCard;
140
- }(ReactNodeView);
113
+ }
@@ -18,7 +18,8 @@ import { UnsupportedInline } from '@atlaskit/editor-common/ui';
18
18
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
19
19
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
20
20
  import rafSchedule from 'raf-schd';
21
- import { Card, GenericCard } from './genericCard';
21
+ import { Card } from './genericCard';
22
+ import ReactNodeView from '../../../nodeviews/ReactNodeView';
22
23
  import { registerCard } from '../pm-plugins/actions';
23
24
  export var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
24
25
  _inherits(InlineCardComponent, _React$PureComponent);
@@ -108,8 +109,8 @@ _defineProperty(InlineCardComponent, "contextTypes", {
108
109
  });
109
110
 
110
111
  var WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
111
- export var InlineCard = /*#__PURE__*/function (_GenericCard) {
112
- _inherits(InlineCard, _GenericCard);
112
+ export var InlineCard = /*#__PURE__*/function (_ReactNodeView) {
113
+ _inherits(InlineCard, _ReactNodeView);
113
114
 
114
115
  var _super2 = _createSuper(InlineCard);
115
116
 
@@ -140,4 +141,4 @@ export var InlineCard = /*#__PURE__*/function (_GenericCard) {
140
141
  }]);
141
142
 
142
143
  return InlineCard;
143
- }(GenericCard);
144
+ }(ReactNodeView);
@@ -19,7 +19,6 @@ import { shouldReplaceLink } from './shouldReplaceLink';
19
19
  import { SMART_LINK_TYPE } from '../../../plugins/analytics/types/node-events';
20
20
  import { getLinkCreationAnalyticsEvent } from '../../../plugins/hyperlink/analytics';
21
21
  import { unlinkPayload } from '../../../utils/linking-utils';
22
- import { getFeatureFlags } from '../../feature-flags-context';
23
22
  export function insertCard(tr, cardAdf, schema) {
24
23
  var inlineCard = schema.nodes.inlineCard; // ED-5638: add an extra space after inline cards to avoid re-rendering them
25
24
 
@@ -214,44 +213,6 @@ export var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(st
214
213
  return queueCards(requests)(state.tr);
215
214
  };
216
215
  export var changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sendAnalytics, node, pos) {
217
- return function (state, dispatch) {
218
- var tr;
219
-
220
- if (node && pos) {
221
- tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
222
- } else {
223
- tr = cardToLinkWithTransaction(state, text, href);
224
- }
225
-
226
- var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
227
-
228
- if (sendAnalytics) {
229
- if (selectedNode) {
230
- var _getFeatureFlags = getFeatureFlags(state),
231
- viewChangingExperimentToolbarStyle = _getFeatureFlags.viewChangingExperimentToolbarStyle;
232
-
233
- addAnalytics(state, tr, {
234
- action: ACTION.CHANGED_TYPE,
235
- actionSubject: ACTION_SUBJECT.SMART_LINK,
236
- eventType: EVENT_TYPE.TRACK,
237
- attributes: {
238
- newType: SMART_LINK_TYPE.URL,
239
- previousType: appearanceForNodeType(selectedNode.type),
240
- localId: selectedNode.attrs.localId,
241
- featureFlag: viewChangingExperimentToolbarStyle || 'noChange'
242
- }
243
- });
244
- }
245
- }
246
-
247
- if (dispatch) {
248
- dispatch(tr.scrollIntoView());
249
- }
250
-
251
- return true;
252
- };
253
- };
254
- export var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback(text, href, sendAnalytics, node, pos) {
255
216
  return function (state, dispatch) {
256
217
  var tr;
257
218
 
@@ -263,11 +224,11 @@ export var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkF
263
224
 
264
225
  if (sendAnalytics) {
265
226
  addAnalytics(state, tr, {
266
- action: ACTION.ERRORED,
227
+ action: ACTION.CHANGED_TYPE,
267
228
  actionSubject: ACTION_SUBJECT.SMART_LINK,
268
- eventType: EVENT_TYPE.OPERATIONAL,
229
+ eventType: EVENT_TYPE.TRACK,
269
230
  attributes: {
270
- error: 'Smart card falling back to link.'
231
+ newType: SMART_LINK_TYPE.URL
271
232
  }
272
233
  });
273
234
  }
@@ -365,19 +326,13 @@ export var setSelectedCardAppearance = function setSelectedCardAppearance(appear
365
326
  var from = state.selection.from;
366
327
  var nodeType = getLinkNodeType(appearance, state.schema.nodes);
367
328
  var tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
368
-
369
- var _getFeatureFlags2 = getFeatureFlags(state),
370
- viewChangingExperimentToolbarStyle = _getFeatureFlags2.viewChangingExperimentToolbarStyle;
371
-
372
329
  addAnalytics(state, tr, {
373
330
  action: ACTION.CHANGED_TYPE,
374
331
  actionSubject: ACTION_SUBJECT.SMART_LINK,
375
332
  eventType: EVENT_TYPE.TRACK,
376
333
  attributes: {
377
334
  newType: appearance,
378
- previousType: appearanceForNodeType(selectedNode.type),
379
- localId: selectedNode.attrs.localId,
380
- featureFlag: viewChangingExperimentToolbarStyle || 'noChange'
335
+ previousType: appearanceForNodeType(selectedNode.type)
381
336
  }
382
337
  });
383
338
 
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "158.0.0";
2
+ export var version = "158.0.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "158.0.0",
3
+ "version": "158.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -99,9 +99,5 @@ declare type ComponentCrashAdditionalInfoErrorAEP = OperationalAEP<ACTION.EDITOR
99
99
  errorStack: string;
100
100
  errorId: string;
101
101
  }, undefined>;
102
- declare type SmartLinkErrorAEP = OperationalAEP<ACTION.ERRORED, ACTION_SUBJECT.SMART_LINK, undefined, {
103
- error: string;
104
- errorStack?: string;
105
- }, undefined>;
106
- export declare type ErrorEventPayload = InvalidTransactionErrorAEP | InvalidTransactionStepErrorAEP | FailedToUnmountErrorAEP | SynchronyErrorAEP | InvalidDocumentEncounteredAEP | SynchronyEntityErrorAEP | ContentComponentErrorAEP | ComponentCrashErrorAEP | ComponentCrashAdditionalInfoErrorAEP | SmartLinkErrorAEP;
102
+ export declare type ErrorEventPayload = InvalidTransactionErrorAEP | InvalidTransactionStepErrorAEP | FailedToUnmountErrorAEP | SynchronyErrorAEP | InvalidDocumentEncounteredAEP | SynchronyEntityErrorAEP | ContentComponentErrorAEP | ComponentCrashErrorAEP | ComponentCrashAdditionalInfoErrorAEP;
107
103
  export {};
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
3
  import PropTypes from 'prop-types';
4
4
  import { EditorView } from 'prosemirror-view';
5
- import { SmartCardProps, GenericCard } from './genericCard';
6
- import { getPosHandler } from '../../../nodeviews/';
5
+ import { SmartCardProps } from './genericCard';
6
+ import { ReactNodeView, getPosHandler } from '../../../nodeviews/';
7
7
  export interface Props {
8
8
  children?: React.ReactNode;
9
9
  node: PMNode;
@@ -25,7 +25,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
25
25
  render(): JSX.Element;
26
26
  }
27
27
  export declare type BlockCardNodeViewProps = Pick<SmartCardProps, 'platform'>;
28
- export declare class BlockCard extends GenericCard<BlockCardNodeViewProps> {
28
+ export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
29
29
  createDomRef(): HTMLElement;
30
30
  render(): JSX.Element;
31
31
  }
@@ -37,7 +37,6 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
37
37
  }
38
38
  export declare type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'platform' | 'fullWidthMode' | 'dispatchAnalyticsEvent'>;
39
39
  export declare class EmbedCard extends SelectionBasedNodeView<EmbedCardNodeViewProps> {
40
- init(): this;
41
40
  viewShouldUpdate(nextNode: PMNode): boolean;
42
41
  createDomRef(): HTMLElement;
43
42
  render(): JSX.Element;
@@ -3,7 +3,6 @@ import { Node as PMNode } from 'prosemirror-model';
3
3
  import { EditorView } from 'prosemirror-view';
4
4
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
5
5
  import { Context as SmartCardContext, CardPlatform } from '@atlaskit/smart-card';
6
- import ReactNodeView from '../../../nodeviews/ReactNodeView';
7
6
  import { getPosHandler, ReactComponentProps } from '../../../nodeviews';
8
7
  import { EventDispatcher } from '../../../event-dispatcher';
9
8
  import { DispatchAnalyticsEvent } from '../../../plugins/analytics';
@@ -31,6 +30,3 @@ export interface SmartCardProps extends CardProps {
31
30
  cardContext?: EditorContext<typeof SmartCardContext>;
32
31
  }
33
32
  export declare function Card(SmartCardComponent: React.ComponentType<SmartCardProps>, UnsupportedComponent: React.ComponentType): React.ComponentType<CardProps>;
34
- export declare class GenericCard<A> extends ReactNodeView<A> {
35
- init(): this;
36
- }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { SmartCardProps, GenericCard } from './genericCard';
3
+ import { SmartCardProps } from './genericCard';
4
+ import ReactNodeView from '../../../nodeviews/ReactNodeView';
4
5
  export declare class InlineCardComponent extends React.PureComponent<SmartCardProps> {
5
6
  private scrollContainer?;
6
7
  private onClick;
@@ -15,7 +16,7 @@ export declare class InlineCardComponent extends React.PureComponent<SmartCardPr
15
16
  render(): JSX.Element | null;
16
17
  }
17
18
  export declare type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader'>;
18
- export declare class InlineCard extends GenericCard<InlineCardNodeViewProps> {
19
+ export declare class InlineCard extends ReactNodeView<InlineCardNodeViewProps> {
19
20
  createDomRef(): HTMLElement;
20
21
  render(): JSX.Element;
21
22
  }
@@ -11,7 +11,6 @@ export declare const handleFallbackWithAnalytics: (url: string, source: InputMet
11
11
  export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, normalizeLinkText?: boolean) => Transaction;
12
12
  export declare const convertHyperlinkToSmartCard: (state: EditorState, source: CardReplacementInputMethod, appearance: CardAppearance, normalizeLinkText?: boolean) => Transaction;
13
13
  export declare const changeSelectedCardToLink: (text?: string | undefined, href?: string | undefined, sendAnalytics?: boolean | undefined, node?: Node<any> | undefined, pos?: number | undefined) => Command;
14
- export declare const changeSelectedCardToLinkFallback: (text?: string | undefined, href?: string | undefined, sendAnalytics?: boolean | undefined, node?: Node<any> | undefined, pos?: number | undefined) => Command;
15
14
  export declare const updateCard: (href: string) => Command;
16
15
  export declare const changeSelectedCardToText: (text: string) => Command;
17
16
  export declare const setSelectedCardAppearance: (appearance: CardAppearance) => Command;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "158.0.0",
3
+ "version": "158.0.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"