@atlaskit/editor-plugin-card 2.6.3 → 2.6.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/nodeviews/datasource.js +4 -1
  3. package/dist/cjs/nodeviews/genericCard.js +5 -3
  4. package/dist/cjs/nodeviews/inlineCard.js +15 -10
  5. package/dist/cjs/pm-plugins/doc.js +15 -5
  6. package/dist/cjs/pm-plugins/main.js +9 -6
  7. package/dist/cjs/ui/AwarenessWrapper/index.js +4 -1
  8. package/dist/cjs/ui/ConfigureOverlay/index.js +4 -1
  9. package/dist/cjs/ui/DatasourceAppearanceButton.js +4 -1
  10. package/dist/cjs/ui/EditDatasourceButton.js +4 -1
  11. package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +4 -1
  12. package/dist/cjs/ui/EditToolbarButton/index.js +4 -1
  13. package/dist/cjs/ui/InlineCardOverlay/index.js +4 -1
  14. package/dist/cjs/ui/LayoutButton/index.js +4 -1
  15. package/dist/cjs/ui/ResizableEmbedCard.js +4 -1
  16. package/dist/cjs/ui/useFetchDatasourceDataInfo.js +4 -1
  17. package/dist/cjs/ui/useFetchDatasourceInfo.js +4 -1
  18. package/dist/es2019/nodeviews/datasource.js +4 -1
  19. package/dist/es2019/nodeviews/genericCard.js +5 -3
  20. package/dist/es2019/nodeviews/inlineCard.js +16 -10
  21. package/dist/es2019/pm-plugins/doc.js +17 -7
  22. package/dist/es2019/pm-plugins/main.js +10 -5
  23. package/dist/es2019/ui/AwarenessWrapper/index.js +4 -1
  24. package/dist/es2019/ui/ConfigureOverlay/index.js +4 -1
  25. package/dist/es2019/ui/DatasourceAppearanceButton.js +4 -1
  26. package/dist/es2019/ui/EditDatasourceButton.js +4 -1
  27. package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +4 -1
  28. package/dist/es2019/ui/EditToolbarButton/index.js +4 -1
  29. package/dist/es2019/ui/InlineCardOverlay/index.js +4 -1
  30. package/dist/es2019/ui/LayoutButton/index.js +4 -1
  31. package/dist/es2019/ui/ResizableEmbedCard.js +4 -1
  32. package/dist/es2019/ui/useFetchDatasourceDataInfo.js +4 -1
  33. package/dist/es2019/ui/useFetchDatasourceInfo.js +4 -1
  34. package/dist/esm/nodeviews/datasource.js +4 -1
  35. package/dist/esm/nodeviews/genericCard.js +5 -3
  36. package/dist/esm/nodeviews/inlineCard.js +15 -10
  37. package/dist/esm/pm-plugins/doc.js +17 -7
  38. package/dist/esm/pm-plugins/main.js +9 -6
  39. package/dist/esm/ui/AwarenessWrapper/index.js +4 -1
  40. package/dist/esm/ui/ConfigureOverlay/index.js +4 -1
  41. package/dist/esm/ui/DatasourceAppearanceButton.js +4 -1
  42. package/dist/esm/ui/EditDatasourceButton.js +4 -1
  43. package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +4 -1
  44. package/dist/esm/ui/EditToolbarButton/index.js +4 -1
  45. package/dist/esm/ui/InlineCardOverlay/index.js +4 -1
  46. package/dist/esm/ui/LayoutButton/index.js +4 -1
  47. package/dist/esm/ui/ResizableEmbedCard.js +4 -1
  48. package/dist/esm/ui/useFetchDatasourceDataInfo.js +4 -1
  49. package/dist/esm/ui/useFetchDatasourceInfo.js +4 -1
  50. package/dist/types/nodeviews/datasource.d.ts +4 -1
  51. package/dist/types/nodeviews/genericCard.d.ts +1 -0
  52. package/dist/types/nodeviews/inlineCard.d.ts +1 -1
  53. package/dist/types/ui/InlineCardOverlay/index.d.ts +4 -1
  54. package/dist/types/ui/ResizableEmbedCard.d.ts +4 -1
  55. package/dist/types-ts4.5/nodeviews/datasource.d.ts +4 -1
  56. package/dist/types-ts4.5/nodeviews/genericCard.d.ts +1 -0
  57. package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
  58. package/dist/types-ts4.5/ui/InlineCardOverlay/index.d.ts +4 -1
  59. package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +4 -1
  60. package/package.json +8 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 2.6.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#122612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122612)
8
+ [`01a85ce0a88ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01a85ce0a88ec) -
9
+ [ux] ED-23705 Add logic to handle annotations on inline nodes when they are inserted or pasted.
10
+ Covers the following inline nodes: emoji, status, mention, date, inlineCard
11
+ - Updated dependencies
12
+
13
+ ## 2.6.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [#122063](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122063)
18
+ [`c136e556d086d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c136e556d086d) -
19
+ [ux] Apply live page and check for live view in card and hyperlink plugin
20
+
3
21
  ## 2.6.3
4
22
 
5
23
  ### Patch Changes
@@ -29,7 +29,10 @@ var _EditorAnalyticsContext = require("../ui/EditorAnalyticsContext");
29
29
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
31
  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); }; }
32
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
32
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
33
+ * @jsxRuntime classic
34
+ * @jsx jsx
35
+ */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
33
36
  var getPosSafely = function getPosSafely(pos) {
34
37
  if (!pos || typeof pos === 'boolean') {
35
38
  return;
@@ -32,7 +32,8 @@ var WithClickHandler = function WithClickHandler(_ref) {
32
32
  var pluginInjectionApi = _ref.pluginInjectionApi,
33
33
  url = _ref.url,
34
34
  onClickCallback = _ref.onClickCallback,
35
- children = _ref.children;
35
+ children = _ref.children,
36
+ __livePage = _ref.__livePage;
36
37
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
37
38
  editorViewModeState = _useSharedPluginState.editorViewModeState;
38
39
  var onClick = (0, _react.useCallback)(function (event) {
@@ -53,7 +54,7 @@ var WithClickHandler = function WithClickHandler(_ref) {
53
54
  *
54
55
  * const allowNavigation = isLivePage && !onClickCallback;
55
56
  */
56
- var _allowNavigation = !onClickCallback;
57
+ var _allowNavigation = __livePage && !onClickCallback;
57
58
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children({
58
59
  onClick: _allowNavigation ? undefined : onClick
59
60
  }));
@@ -122,7 +123,8 @@ function Card(SmartCardComponent, UnsupportedComponent) {
122
123
  }, /*#__PURE__*/_react.default.createElement(WithClickHandler, {
123
124
  pluginInjectionApi: pluginInjectionApi,
124
125
  onClickCallback: onClickCallback,
125
- url: url
126
+ url: url,
127
+ __livePage: this.props.__livePage
126
128
  }, function (_ref2) {
127
129
  var onClick = _ref2.onClick;
128
130
  return /*#__PURE__*/_react.default.createElement(SmartCardComponent, (0, _extends2.default)({
@@ -103,7 +103,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
103
103
  var WrappedInlineCardWithAwareness = (0, _genericCard.Card)(_inlineCardWithAwareness.InlineCardWithAwareness, _ui.UnsupportedInline);
104
104
  var WrappedInlineCard = (0, _genericCard.Card)(InlineCard, _ui.UnsupportedInline);
105
105
  function InlineCardNodeView(props) {
106
- var _useSharedPluginState;
106
+ var _floatingToolbarState;
107
107
  var useAlternativePreloader = props.useAlternativePreloader,
108
108
  node = props.node,
109
109
  view = props.view,
@@ -114,20 +114,20 @@ function InlineCardNodeView(props) {
114
114
  allowBlockCards = props.allowBlockCards,
115
115
  enableInlineUpgradeFeatures = props.enableInlineUpgradeFeatures,
116
116
  pluginInjectionApi = props.pluginInjectionApi,
117
- onClickCallback = props.onClickCallback;
117
+ onClickCallback = props.onClickCallback,
118
+ __livePage = props.__livePage;
118
119
  var _useState = (0, _react.useState)(false),
119
120
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
120
121
  isOverlayHovered = _useState2[0],
121
122
  setIsOverlayHovered = _useState2[1];
122
- var floatingToolbarNode = (_useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar']).floatingToolbarState) === null || _useSharedPluginState === void 0 || (_useSharedPluginState = _useSharedPluginState.configWithNodeInfo) === null || _useSharedPluginState === void 0 ? void 0 : _useSharedPluginState.node;
123
- if ((0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages')) {
123
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorViewMode']),
124
+ editorViewModeState = _useSharedPluginState.editorViewModeState,
125
+ floatingToolbarState = _useSharedPluginState.floatingToolbarState;
126
+ var floatingToolbarNode = floatingToolbarState === null || floatingToolbarState === void 0 || (_floatingToolbarState = floatingToolbarState.configWithNodeInfo) === null || _floatingToolbarState === void 0 ? void 0 : _floatingToolbarState.node;
127
+ if (__livePage && (0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages')) {
124
128
  var showHoverPreview = floatingToolbarNode !== node;
125
129
  var livePagesHoverCardFadeInDelay = 800;
126
- return /*#__PURE__*/_react.default.createElement(_ConfigureOverlay.default, {
127
- targetElementPos: getPos(),
128
- view: view,
129
- isHoveredCallback: setIsOverlayHovered
130
- }, /*#__PURE__*/_react.default.createElement(WrappedInlineCard, {
130
+ var inlineCard = /*#__PURE__*/_react.default.createElement(WrappedInlineCard, {
131
131
  isHovered: isOverlayHovered,
132
132
  node: node,
133
133
  view: view,
@@ -140,7 +140,12 @@ function InlineCardNodeView(props) {
140
140
  hoverPreviewOptions: {
141
141
  fadeInDelay: livePagesHoverCardFadeInDelay
142
142
  }
143
- }));
143
+ });
144
+ return (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? inlineCard : /*#__PURE__*/_react.default.createElement(_ConfigureOverlay.default, {
145
+ targetElementPos: getPos(),
146
+ view: view,
147
+ isHoveredCallback: setIsOverlayHovered
148
+ }, inlineCard);
144
149
  }
145
150
  return /*#__PURE__*/_react.default.createElement(WrappedInlineCardWithAwareness, (0, _extends2.default)({
146
151
  node: node,
@@ -34,6 +34,7 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
34
34
  // replace all the outstanding links with their cards
35
35
  var pos = tr.mapping.map(request.pos);
36
36
  var $pos = tr.doc.resolve(pos);
37
+ var $head = tr.selection.$head;
37
38
  var node = tr.doc.nodeAt(pos);
38
39
  if (!node || !node.type.isText) {
39
40
  return;
@@ -49,6 +50,15 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
49
50
  nodes.push(schema.text(' '));
50
51
  }
51
52
  tr.replaceWith(pos, pos + (node.text || url).length, nodes);
53
+ if ((0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes')) {
54
+ var annotationMarksForPos = (0, _utils.getAnnotationMarksForPos)($head);
55
+ if (annotationMarksForPos && annotationMarksForPos.length > 0) {
56
+ annotationMarksForPos.forEach(function (annotationMark) {
57
+ // Add the annotation mark on to the inlineCard node and the trailing space node.
58
+ tr.addMark(pos, pos + nodes[0].nodeSize + nodes[1].nodeSize, annotationMark);
59
+ });
60
+ }
61
+ }
52
62
  return $pos.node($pos.depth - 1).type.name;
53
63
  }
54
64
  var replaceQueuedUrlWithCard = exports.replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) {
@@ -371,7 +381,7 @@ var setSelectedCardAppearance = exports.setSelectedCardAppearance = function set
371
381
  return false;
372
382
  }
373
383
  var attrs;
374
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-appearance-toolbar')) {
384
+ if ((0, _platformFeatureFlags.fg)('platform.linking-platform.enable-datasource-appearance-toolbar')) {
375
385
  if ((0, _utils2.appearanceForNodeType)(selectedNode.type) === appearance && !selectedNode.attrs.datasource) {
376
386
  return false;
377
387
  }
@@ -461,7 +471,7 @@ var updateCardViaDatasource = exports.updateCardViaDatasource = function updateC
461
471
  if (isColumnChange || isUrlChange) {
462
472
  tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, oldAttrs), newAdf.attrs));
463
473
  }
464
- } else if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-appearance-toolbar') && node.type.isText) {
474
+ } else if (node.type.isText && (0, _platformFeatureFlags.fg)('platform.linking-platform.enable-datasource-appearance-toolbar')) {
465
475
  // url to datasource
466
476
  var link;
467
477
  state.doc.nodesBetween(from, to, function (node, pos) {
@@ -533,7 +543,7 @@ var getAttrsForAppearance = exports.getAttrsForAppearance = function getAttrsFor
533
543
  layout: 'center'
534
544
  });
535
545
  }
536
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.editor-datasource-typeguards')) {
546
+ if ((0, _platformFeatureFlags.fg)('platform.linking-platform.editor-datasource-typeguards')) {
537
547
  if ((0, _utils2.isDatasourceNode)(selectedNode)) {
538
548
  return {
539
549
  url: selectedNode.attrs.url
@@ -549,8 +559,8 @@ var getAttrsForAppearance = exports.getAttrsForAppearance = function getAttrsFor
549
559
  return selectedNode.attrs;
550
560
  };
551
561
  var updateDatasourceStash = function updateDatasourceStash(tr, selectedNode) {
552
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-appearance-toolbar')) {
553
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.editor-datasource-typeguards')) {
562
+ if ((0, _platformFeatureFlags.fg)('platform.linking-platform.enable-datasource-appearance-toolbar')) {
563
+ if ((0, _platformFeatureFlags.fg)('platform.linking-platform.editor-datasource-typeguards')) {
554
564
  if ((0, _utils2.isDatasourceNode)(selectedNode) && !(0, _utils2.isDatasourceConfigEditable)(selectedNode.attrs.datasource.id) && selectedNode.attrs.url) {
555
565
  (0, _actions.setDatasourceStash)(tr, {
556
566
  url: selectedNode.attrs.url,
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "pluginKey", {
12
12
  }
13
13
  });
14
14
  exports.stopEvent = void 0;
15
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
15
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
18
18
  var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
19
19
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
@@ -76,9 +76,10 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
76
76
  showUpgradeDiscoverability = options.showUpgradeDiscoverability,
77
77
  allowEmbeds = options.allowEmbeds,
78
78
  allowBlockCards = options.allowBlockCards,
79
- onClickCallback = options.onClickCallback;
79
+ onClickCallback = options.onClickCallback,
80
+ __livePage = options.__livePage;
80
81
  var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability && platform !== 'mobile';
81
- var inlineCardViewProducer = (0, _reactNodeView.getInlineNodeViewProducer)({
82
+ var inlineCardViewProducer = (0, _reactNodeView.getInlineNodeViewProducer)(_objectSpread({
82
83
  pmPluginFactoryParams: pmPluginFactoryParams,
83
84
  Component: _inlineCard.InlineCardNodeView,
84
85
  extraComponentProps: {
@@ -89,12 +90,14 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
89
90
  allowEmbeds: allowEmbeds,
90
91
  allowBlockCards: allowBlockCards,
91
92
  pluginInjectionApi: pluginInjectionApi,
92
- onClickCallback: onClickCallback
93
- },
93
+ onClickCallback: onClickCallback,
94
+ __livePage: __livePage
95
+ }
96
+ }, __livePage && (0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages') && {
94
97
  extraNodeViewProps: {
95
98
  stopEvent: stopEvent
96
99
  }
97
- });
100
+ }));
98
101
  return new _safePlugin.SafePlugin({
99
102
  state: {
100
103
  init: function init() {
@@ -14,7 +14,10 @@ var _localStorage = require("../../common/local-storage");
14
14
  var _utils = require("../../utils");
15
15
  var _InlineCardOverlay = _interopRequireDefault(require("../InlineCardOverlay"));
16
16
  var _Pulse = require("../Pulse");
17
- /** @jsx jsx */
17
+ /**
18
+ * @jsxRuntime classic
19
+ * @jsx jsx
20
+ */
18
21
 
19
22
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
23
 
@@ -9,7 +9,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
11
  var _link = require("@atlaskit/editor-common/link");
12
- /** @jsx jsx */
12
+ /**
13
+ * @jsxRuntime classic
14
+ * @jsx jsx
15
+ */
13
16
 
14
17
  // not permitted to migrate atlaskit packages to compiled yet, see https://hello.atlassian.net/wiki/spaces/UAF/pages/3006969423/Migrating+AFM+platform+components+to+Compiled+a+guide
15
18
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
@@ -18,7 +18,10 @@ var _pluginKey = require("../pm-plugins/plugin-key");
18
18
  var _CardContextProvider = require("./CardContextProvider");
19
19
  var _DatasourceIcon = require("./DatasourceIcon");
20
20
  var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
21
- /** @jsx jsx */
21
+ /**
22
+ * @jsxRuntime classic
23
+ * @jsx jsx
24
+ */
22
25
 
23
26
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
24
27
 
@@ -15,7 +15,10 @@ var _actions = require("../pm-plugins/actions");
15
15
  var _utils2 = require("../utils");
16
16
  var _CardContextProvider = require("./CardContextProvider");
17
17
  var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
18
- /** @jsx jsx */
18
+ /**
19
+ * @jsxRuntime classic
20
+ * @jsx jsx
21
+ */
19
22
 
20
23
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
21
24
 
@@ -17,7 +17,10 @@ var _menu = require("@atlaskit/menu");
17
17
  var _primitives = require("@atlaskit/primitives");
18
18
  var _utils = require("../../utils");
19
19
  var _EditDatasourceButton = require("../EditDatasourceButton");
20
- /** @jsx jsx */
20
+ /**
21
+ * @jsxRuntime classic
22
+ * @jsx jsx
23
+ */
21
24
 
22
25
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
26
 
@@ -24,7 +24,10 @@ var _useFetchDatasourceDataInfo = require("../useFetchDatasourceDataInfo");
24
24
  var _useFetchDatasourceInfo = require("../useFetchDatasourceInfo");
25
25
  var _EditToolbarButtonPresentation = _interopRequireDefault(require("./EditToolbarButtonPresentation"));
26
26
  var _excluded = ["extensionKey"];
27
- /** @jsx jsx */
27
+ /**
28
+ * @jsxRuntime classic
29
+ * @jsx jsx
30
+ */
28
31
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
29
32
  var dropdownExpandContainer = (0, _react2.css)({
30
33
  margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
@@ -23,7 +23,10 @@ var _excluded = ["children", "isSelected", "isVisible", "testId", "url"];
23
23
  var _active;
24
24
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
25
25
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
26
- /** @jsx jsx */
26
+ /**
27
+ * @jsxRuntime classic
28
+ * @jsx jsx
29
+ */
27
30
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
28
31
  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); }
29
32
  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,7 +22,10 @@ var _actions = require("../../pm-plugins/actions");
22
22
  var _utils2 = require("../../utils");
23
23
  var _utils3 = require("./utils");
24
24
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
26
+ * @jsxRuntime classic
27
+ * @jsx jsx
28
+ */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
29
  var toolbarButtonWrapperStyles = (0, _react2.css)({
27
30
  background: "".concat("var(--ds-background-neutral, ".concat(_colors.N20A, ")")),
28
31
  color: "".concat("var(--ds-icon, ".concat(_colors.N300, ")")),
@@ -22,7 +22,10 @@ var _smartCard = require("@atlaskit/smart-card");
22
22
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
23
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
24
  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); }; }
25
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
26
+ * @jsxRuntime classic
27
+ * @jsx jsx
28
+ */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
29
  // eslint-disable-next-line @repo/internal/react/no-class-components
27
30
  var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Component) {
28
31
  (0, _inherits2.default)(ResizableEmbedCard, _React$Component);
@@ -10,7 +10,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = require("react");
12
12
  var _linkClientExtension = require("@atlaskit/link-client-extension");
13
- /** @jsx jsx */
13
+ /**
14
+ * @jsxRuntime classic
15
+ * @jsx jsx
16
+ */
14
17
 
15
18
  var useFetchDatasourceDataInfo = exports.useFetchDatasourceDataInfo = function useFetchDatasourceDataInfo(_ref) {
16
19
  var datasourceId = _ref.datasourceId,
@@ -9,7 +9,10 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = require("react");
12
- /** @jsx jsx */
12
+ /**
13
+ * @jsxRuntime classic
14
+ * @jsx jsx
15
+ */
13
16
 
14
17
  var useFetchDatasourceInfo = exports.useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
15
18
  var isRegularCardNode = _ref.isRegularCardNode,
@@ -1,5 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import React from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -14,7 +14,8 @@ const WithClickHandler = ({
14
14
  pluginInjectionApi,
15
15
  url,
16
16
  onClickCallback,
17
- children
17
+ children,
18
+ __livePage
18
19
  }) => {
19
20
  const {
20
21
  editorViewModeState
@@ -37,7 +38,7 @@ const WithClickHandler = ({
37
38
  *
38
39
  * const allowNavigation = isLivePage && !onClickCallback;
39
40
  */
40
- const allowNavigation = !onClickCallback;
41
+ const allowNavigation = __livePage && !onClickCallback;
41
42
  return /*#__PURE__*/React.createElement(React.Fragment, null, children({
42
43
  onClick: allowNavigation ? undefined : onClick
43
44
  }));
@@ -97,7 +98,8 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
97
98
  }, /*#__PURE__*/React.createElement(WithClickHandler, {
98
99
  pluginInjectionApi: pluginInjectionApi,
99
100
  onClickCallback: onClickCallback,
100
- url: url
101
+ url: url,
102
+ __livePage: this.props.__livePage
101
103
  }, ({
102
104
  onClick
103
105
  }) => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
@@ -93,7 +93,7 @@ export const InlineCard = /*#__PURE__*/memo(({
93
93
  const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
94
94
  const WrappedInlineCard = Card(InlineCard, UnsupportedInline);
95
95
  export function InlineCardNodeView(props) {
96
- var _useSharedPluginState, _useSharedPluginState2;
96
+ var _floatingToolbarState;
97
97
  const {
98
98
  useAlternativePreloader,
99
99
  node,
@@ -105,18 +105,19 @@ export function InlineCardNodeView(props) {
105
105
  allowBlockCards,
106
106
  enableInlineUpgradeFeatures,
107
107
  pluginInjectionApi,
108
- onClickCallback
108
+ onClickCallback,
109
+ __livePage
109
110
  } = props;
110
111
  const [isOverlayHovered, setIsOverlayHovered] = useState(false);
111
- const floatingToolbarNode = (_useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar']).floatingToolbarState) === null || _useSharedPluginState === void 0 ? void 0 : (_useSharedPluginState2 = _useSharedPluginState.configWithNodeInfo) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.node;
112
- if (fg('platform.linking-platform.smart-links-in-live-pages')) {
112
+ const {
113
+ editorViewModeState,
114
+ floatingToolbarState
115
+ } = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorViewMode']);
116
+ const floatingToolbarNode = floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : (_floatingToolbarState = floatingToolbarState.configWithNodeInfo) === null || _floatingToolbarState === void 0 ? void 0 : _floatingToolbarState.node;
117
+ if (__livePage && fg('platform.linking-platform.smart-links-in-live-pages')) {
113
118
  const showHoverPreview = floatingToolbarNode !== node;
114
119
  const livePagesHoverCardFadeInDelay = 800;
115
- return /*#__PURE__*/React.createElement(OverlayWrapper, {
116
- targetElementPos: getPos(),
117
- view: view,
118
- isHoveredCallback: setIsOverlayHovered
119
- }, /*#__PURE__*/React.createElement(WrappedInlineCard, {
120
+ const inlineCard = /*#__PURE__*/React.createElement(WrappedInlineCard, {
120
121
  isHovered: isOverlayHovered,
121
122
  node: node,
122
123
  view: view,
@@ -129,7 +130,12 @@ export function InlineCardNodeView(props) {
129
130
  hoverPreviewOptions: {
130
131
  fadeInDelay: livePagesHoverCardFadeInDelay
131
132
  }
132
- }));
133
+ });
134
+ return (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? inlineCard : /*#__PURE__*/React.createElement(OverlayWrapper, {
135
+ targetElementPos: getPos(),
136
+ view: view,
137
+ isHoveredCallback: setIsOverlayHovered
138
+ }, inlineCard);
133
139
  }
134
140
  return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, _extends({
135
141
  node: node,
@@ -2,10 +2,10 @@ import isEqual from 'lodash/isEqual';
2
2
  import { isSafeUrl } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
4
4
  import { addLinkMetadata } from '@atlaskit/editor-common/card';
5
- import { getLinkCreationAnalyticsEvent, isFromCurrentDomain, nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
5
+ import { getAnnotationMarksForPos, getLinkCreationAnalyticsEvent, isFromCurrentDomain, nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
6
6
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
7
7
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
8
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { appearanceForNodeType, isDatasourceConfigEditable, isDatasourceNode, selectedCardAppearance } from '../utils';
10
10
  import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
11
11
  import { pluginKey } from './plugin-key';
@@ -28,6 +28,7 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
28
28
  // replace all the outstanding links with their cards
29
29
  const pos = tr.mapping.map(request.pos);
30
30
  const $pos = tr.doc.resolve(pos);
31
+ const $head = tr.selection.$head;
31
32
  const node = tr.doc.nodeAt(pos);
32
33
  if (!node || !node.type.isText) {
33
34
  return;
@@ -43,6 +44,15 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
43
44
  nodes.push(schema.text(' '));
44
45
  }
45
46
  tr.replaceWith(pos, pos + (node.text || url).length, nodes);
47
+ if (fg('editor_inline_comments_paste_insert_nodes')) {
48
+ const annotationMarksForPos = getAnnotationMarksForPos($head);
49
+ if (annotationMarksForPos && annotationMarksForPos.length > 0) {
50
+ annotationMarksForPos.forEach(annotationMark => {
51
+ // Add the annotation mark on to the inlineCard node and the trailing space node.
52
+ tr.addMark(pos, pos + nodes[0].nodeSize + nodes[1].nodeSize, annotationMark);
53
+ });
54
+ }
55
+ }
46
56
  return $pos.node($pos.depth - 1).type.name;
47
57
  }
48
58
  export const replaceQueuedUrlWithCard = (url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) => (editorState, dispatch) => {
@@ -345,7 +355,7 @@ export const setSelectedCardAppearance = (appearance, editorAnalyticsApi) => (st
345
355
  return false;
346
356
  }
347
357
  let attrs;
348
- if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar')) {
358
+ if (fg('platform.linking-platform.enable-datasource-appearance-toolbar')) {
349
359
  if (appearanceForNodeType(selectedNode.type) === appearance && !selectedNode.attrs.datasource) {
350
360
  return false;
351
361
  }
@@ -442,7 +452,7 @@ export const updateCardViaDatasource = args => {
442
452
  ...newAdf.attrs
443
453
  });
444
454
  }
445
- } else if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && node.type.isText) {
455
+ } else if (node.type.isText && fg('platform.linking-platform.enable-datasource-appearance-toolbar')) {
446
456
  // url to datasource
447
457
  let link;
448
458
  state.doc.nodesBetween(from, to, (node, pos) => {
@@ -521,7 +531,7 @@ export const getAttrsForAppearance = (appearance, selectedNode) => {
521
531
  layout: 'center'
522
532
  };
523
533
  }
524
- if (getBooleanFF('platform.linking-platform.editor-datasource-typeguards')) {
534
+ if (fg('platform.linking-platform.editor-datasource-typeguards')) {
525
535
  if (isDatasourceNode(selectedNode)) {
526
536
  return {
527
537
  url: selectedNode.attrs.url
@@ -537,8 +547,8 @@ export const getAttrsForAppearance = (appearance, selectedNode) => {
537
547
  return selectedNode.attrs;
538
548
  };
539
549
  const updateDatasourceStash = (tr, selectedNode) => {
540
- if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar')) {
541
- if (getBooleanFF('platform.linking-platform.editor-datasource-typeguards')) {
550
+ if (fg('platform.linking-platform.enable-datasource-appearance-toolbar')) {
551
+ if (fg('platform.linking-platform.editor-datasource-typeguards')) {
542
552
  if (isDatasourceNode(selectedNode) && !isDatasourceConfigEditable(selectedNode.attrs.datasource.id) && selectedNode.attrs.url) {
543
553
  setDatasourceStash(tr, {
544
554
  url: selectedNode.attrs.url,
@@ -59,7 +59,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
59
59
  showUpgradeDiscoverability,
60
60
  allowEmbeds,
61
61
  allowBlockCards,
62
- onClickCallback
62
+ onClickCallback,
63
+ // @ts-ignore Temporary solution to check for Live Page editor.
64
+ __livePage
63
65
  } = options;
64
66
  const enableInlineUpgradeFeatures = !!showUpgradeDiscoverability && platform !== 'mobile';
65
67
  const inlineCardViewProducer = getInlineNodeViewProducer({
@@ -73,11 +75,14 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
73
75
  allowEmbeds,
74
76
  allowBlockCards,
75
77
  pluginInjectionApi,
76
- onClickCallback
78
+ onClickCallback,
79
+ __livePage
77
80
  },
78
- extraNodeViewProps: {
79
- stopEvent
80
- }
81
+ ...(__livePage && fg('platform.linking-platform.smart-links-in-live-pages') && {
82
+ extraNodeViewProps: {
83
+ stopEvent
84
+ }
85
+ })
81
86
  });
82
87
  return new SafePlugin({
83
88
  state: {
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { useCallback, useEffect, useMemo, useState } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { useCallback, useState } from 'react';
3
6
 
4
7
  // not permitted to migrate atlaskit packages to compiled yet, see https://hello.atlassian.net/wiki/spaces/UAF/pages/3006969423/Migrating+AFM+platform+components+to+Compiled+a+guide
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { useCallback } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { useCallback } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { useCallback, useRef, useState } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import { useCallback, useMemo, useRef, useState } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766