@atlaskit/editor-common 87.0.1 → 87.0.3

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 (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/lazy-node-view/index.js +19 -128
  3. package/dist/cjs/lazy-node-view/node-view.js +35 -0
  4. package/dist/cjs/lazy-node-view/replace-node-views.js +95 -0
  5. package/dist/cjs/lazy-node-view/types.js +5 -0
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/styles/shared/code-block.js +4 -3
  8. package/dist/cjs/styles/shared/smartCard.js +4 -2
  9. package/dist/cjs/ui/DropList/index.js +1 -1
  10. package/dist/es2019/lazy-node-view/index.js +16 -124
  11. package/dist/es2019/lazy-node-view/node-view.js +27 -0
  12. package/dist/es2019/lazy-node-view/replace-node-views.js +91 -0
  13. package/dist/es2019/lazy-node-view/types.js +1 -0
  14. package/dist/es2019/monitoring/error.js +1 -1
  15. package/dist/es2019/styles/shared/code-block.js +9 -1
  16. package/dist/es2019/styles/shared/smartCard.js +5 -0
  17. package/dist/es2019/ui/DropList/index.js +1 -1
  18. package/dist/esm/lazy-node-view/index.js +16 -124
  19. package/dist/esm/lazy-node-view/node-view.js +28 -0
  20. package/dist/esm/lazy-node-view/replace-node-views.js +88 -0
  21. package/dist/esm/lazy-node-view/types.js +1 -0
  22. package/dist/esm/monitoring/error.js +1 -1
  23. package/dist/esm/styles/shared/code-block.js +4 -3
  24. package/dist/esm/styles/shared/smartCard.js +4 -2
  25. package/dist/esm/ui/DropList/index.js +1 -1
  26. package/dist/types/lazy-node-view/index.d.ts +3 -49
  27. package/dist/types/lazy-node-view/node-view.d.ts +12 -0
  28. package/dist/types/lazy-node-view/replace-node-views.d.ts +44 -0
  29. package/dist/types/lazy-node-view/types.d.ts +14 -0
  30. package/dist/types/styles/shared/code-block.d.ts +1 -0
  31. package/dist/types-ts4.5/lazy-node-view/index.d.ts +3 -49
  32. package/dist/types-ts4.5/lazy-node-view/node-view.d.ts +12 -0
  33. package/dist/types-ts4.5/lazy-node-view/replace-node-views.d.ts +44 -0
  34. package/dist/types-ts4.5/lazy-node-view/types.d.ts +14 -0
  35. package/dist/types-ts4.5/styles/shared/code-block.d.ts +1 -0
  36. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 87.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#124585](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124585)
8
+ [`38ebc7f4f4ce9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/38ebc7f4f4ce9) -
9
+ Fix LazyNodeView race condition
10
+ - [#124302](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124302)
11
+ [`45dc9b6543007`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/45dc9b6543007) -
12
+ [ux] ED-24228 adding wrap content functionality with feature gate
13
+
14
+ ## 87.0.2
15
+
16
+ ### Patch Changes
17
+
18
+ - [`23c64778d8082`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/23c64778d8082) -
19
+ [ux] Updating the cursor style for embed cards when the smart links in live pages FF is on
20
+
3
21
  ## 87.0.1
4
22
 
5
23
  ### Patch Changes
@@ -1,17 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.withLazyLoading = exports.debouncedReplaceNodeviews = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
12
- var _model = require("@atlaskit/editor-prosemirror/model");
13
- 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; }
14
- 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; }
6
+ exports.withLazyLoading = void 0;
7
+ var _nodeView = require("./node-view");
8
+ var _replaceNodeViews = require("./replace-node-views");
15
9
  /**
16
10
  * 📢 Public Type
17
11
  *
@@ -26,116 +20,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
26
20
 
27
21
  /**
28
22
  * 🧱 Internal: Editor FE Platform
29
- */
30
-
31
- /**
32
- * 🧱 Internal: Editor FE Platform
33
- */
34
-
35
- /**
36
- * 🧱 Internal: Editor FE Platform
37
- */
38
-
39
- /**
40
- * 🧱 Internal: Editor FE Platform
41
- *
42
- * A cache to store loaded React NodeViews for each EditorView.
43
- *
44
- * This cache will help us to avoid any race condition
45
- * when multiple Editors exist in the same page.
46
- *
47
- * @type {CacheType}
48
- */
49
- var cachePerEditorView = new WeakMap();
50
-
51
- /**
52
- * 🧱 Internal: Editor FE Platform
53
- */
54
- var isFirefox = /gecko\/\d/i.test(navigator.userAgent);
55
-
56
- /**
57
- * 🧱 Internal: Editor FE Platform
58
- *
59
- * A NodeView that serves as a placeholder until the actual NodeView is loaded.
60
- */
61
- var LazyNodeView = /*#__PURE__*/(0, _createClass2.default)(function LazyNodeView(node, view, getPos) {
62
- var _node$type;
63
- (0, _classCallCheck2.default)(this, LazyNodeView);
64
- if (typeof ((_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.toDOM) !== 'function') {
65
- this.dom = document.createElement('div');
66
- return;
67
- }
68
- var fallback = _model.DOMSerializer.renderSpec(document, node.type.spec.toDOM(node));
69
- this.dom = fallback.dom;
70
- this.contentDOM = fallback.contentDOM;
71
- if (this.dom instanceof HTMLElement) {
72
- // This attribute is mostly used for debugging purposed
73
- // It will help us to found out when the node was replaced
74
- this.dom.setAttribute('data-lazy-node-view', node.type.name);
75
- // This is used on Libra tests
76
- // We are using this to make sure all lazy noded were replaced
77
- // before the test started
78
- this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
79
- }
80
- });
81
- /**
82
- * 🧱 Internal: Editor FE Platform
83
- *
84
- * Debounces and replaces the node views in a ProseMirror editor with lazy-loaded node views.
85
- *
86
- * This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
87
- * node views have been loaded. It uses a debounced approach to ensure that the replacement does
88
- * not happen too frequently, which can be performance-intensive.
89
23
  *
90
- * The function checks if there are any loaded node views in the cache associated with the given
91
- * `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
92
- * loaded node views. The replacement is scheduled using `requestIdleCallback` or
93
- * `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
94
- * `requestIdleCallback` may not be supported.
95
- *
96
- * @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
97
- * the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
98
- * is a record of node type names to their corresponding `NodeViewConstructor`.
99
- * @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
100
- * needs to be updated.
101
- *
102
- * @example
103
- * const cache = new WeakMap();
104
- * const view = new EditorView(...);
105
- *
106
- * // Assume some node views have been loaded and stored in the cache
107
- * cache.set(view, {
108
- * 'table': TableViewConstructor,
109
- * 'tableCell': TableCellViewConstructor,
110
- * });
111
- *
112
- * debouncedReplaceNodeviews(cache, view);
24
+ * Controls which node was scheduled to load the original node view code
113
25
  */
114
- var debouncedReplaceNodeviews = exports.debouncedReplaceNodeviews = (0, _debounce.default)(function (cache, view) {
115
- var loadedNodeviews = cache.get(view);
116
- if (!loadedNodeviews) {
117
- return;
118
- }
119
- cache.delete(view);
120
-
121
- // eslint-disable-next-line compat/compat
122
- var idle = window.requestIdleCallback;
123
-
124
- /*
125
- * For reasons that goes beyond my knowledge
126
- * some Firefox versions aren't calling the requestIdleCallback.
127
- *
128
- * So, we need this check to make sure we use the requestAnimationFrame instead
129
- */
130
- var later = isFirefox || typeof idle !== 'function' ? window.requestAnimationFrame : idle;
131
- later(function () {
132
- var currentNodeViews = view.props.nodeViews;
133
- var nextNodeViews = _objectSpread(_objectSpread({}, currentNodeViews), loadedNodeviews);
134
- view.setProps({
135
- nodeViews: nextNodeViews
136
- });
137
- });
138
- });
26
+ var requestedNodesPerEditorView = new WeakMap();
139
27
 
140
28
  /**
141
29
  * 📢 Public: Any EditorPlugin can use this function
@@ -183,23 +71,26 @@ var withLazyLoading = exports.withLazyLoading = function withLazyLoading(_ref) {
183
71
  getNodeViewOptions = _ref.getNodeViewOptions,
184
72
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
185
73
  var createLazyNodeView = function createLazyNodeView(node, view, getPos, decorations) {
186
- var _node$type2;
187
- var cachedMap = cachePerEditorView.get(view);
188
- if (!cachedMap) {
189
- cachedMap = {};
190
- cachePerEditorView.set(view, cachedMap);
74
+ var _node$type;
75
+ var requestedNodes = requestedNodesPerEditorView.get(view);
76
+ if (!requestedNodes) {
77
+ requestedNodes = new Set(), requestedNodesPerEditorView.set(view, requestedNodes);
191
78
  }
192
- var wasAlreadyRequested = cachedMap.hasOwnProperty(nodeName);
79
+ var wasAlreadyRequested = requestedNodes.has(nodeName);
193
80
  if (wasAlreadyRequested) {
194
- return new LazyNodeView(node, view, getPos);
81
+ return new _nodeView.LazyNodeView(node, view, getPos);
195
82
  }
83
+ requestedNodes.add(nodeName);
196
84
  loader().then(function (nodeViewFuncModule) {
197
- cachedMap[nodeName] = function (node, view, getPos, decorations) {
85
+ var nodeViewFunc = function nodeViewFunc(node, view, getPos, decorations) {
198
86
  return nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
199
87
  };
200
- debouncedReplaceNodeviews(cachePerEditorView, view);
88
+ (0, _replaceNodeViews.queueReplaceNodeViews)(view, {
89
+ nodeName: nodeName,
90
+ nodeViewFunc: nodeViewFunc
91
+ });
201
92
  });
202
- if (typeof ((_node$type2 = node.type) === null || _node$type2 === void 0 || (_node$type2 = _node$type2.spec) === null || _node$type2 === void 0 ? void 0 : _node$type2.toDOM) !== 'function') {
93
+ if (typeof ((_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.toDOM) !== 'function') {
203
94
  // TODO: Analytics ED-23982
204
95
  // dispatchAnalyticsEvent({
205
96
  // action: ACTION.LAZY_NODE_VIEW_ERROR,
@@ -211,7 +102,7 @@ var withLazyLoading = exports.withLazyLoading = function withLazyLoading(_ref) {
211
102
  // },
212
103
  // });
213
104
  }
214
- return new LazyNodeView(node, view, getPos);
105
+ return new _nodeView.LazyNodeView(node, view, getPos);
215
106
  };
216
107
  return createLazyNodeView;
217
108
  };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.LazyNodeView = void 0;
8
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _model = require("@atlaskit/editor-prosemirror/model");
11
+ /**
12
+ * 🧱 Internal: Editor FE Platform
13
+ *
14
+ * A NodeView that serves as a placeholder until the actual NodeView is loaded.
15
+ */
16
+ var LazyNodeView = exports.LazyNodeView = /*#__PURE__*/(0, _createClass2.default)(function LazyNodeView(node, view, getPos) {
17
+ var _node$type;
18
+ (0, _classCallCheck2.default)(this, LazyNodeView);
19
+ if (typeof ((_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.toDOM) !== 'function') {
20
+ this.dom = document.createElement('div');
21
+ return;
22
+ }
23
+ var fallback = _model.DOMSerializer.renderSpec(document, node.type.spec.toDOM(node));
24
+ this.dom = fallback.dom;
25
+ this.contentDOM = fallback.contentDOM;
26
+ if (this.dom instanceof HTMLElement) {
27
+ // This attribute is mostly used for debugging purposed
28
+ // It will help us to found out when the node was replaced
29
+ this.dom.setAttribute('data-lazy-node-view', node.type.name);
30
+ // This is used on Libra tests
31
+ // We are using this to make sure all lazy noded were replaced
32
+ // before the test started
33
+ this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
34
+ }
35
+ });
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.queueReplaceNodeViews = exports.debouncedReplaceNodeviews = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
10
+ 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; }
11
+ 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; }
12
+ /**
13
+ * 🧱 Internal: Editor FE Platform
14
+ */
15
+ var isFirefox = /gecko\/\d/i.test(navigator.userAgent);
16
+
17
+ /**
18
+ * 🧱 Internal: Editor FE Platform
19
+ *
20
+ * Debounces and replaces the node views in a ProseMirror editor with lazy-loaded node views.
21
+ *
22
+ * This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
23
+ * node views have been loaded. It uses a debounced approach to ensure that the replacement does
24
+ * not happen too frequently, which can be performance-intensive.
25
+ *
26
+ * The function checks if there are any loaded node views in the cache associated with the given
27
+ * `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
28
+ * loaded node views. The replacement is scheduled using `requestIdleCallback` or
29
+ * `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
30
+ * `requestIdleCallback` may not be supported.
31
+ *
32
+ * @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
33
+ * the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
34
+ * is a record of node type names to their corresponding `NodeViewConstructor`.
35
+ * @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
36
+ * needs to be updated.
37
+ *
38
+ * @example
39
+ * const cache = new WeakMap();
40
+ * const view = new EditorView(...);
41
+ *
42
+ * // Assume some node views have been loaded and stored in the cache
43
+ * cache.set(view, {
44
+ * 'table': TableViewConstructor,
45
+ * 'tableCell': TableCellViewConstructor,
46
+ * });
47
+ *
48
+ * debouncedReplaceNodeviews(cache, view);
49
+ */
50
+ var debouncedReplaceNodeviews = exports.debouncedReplaceNodeviews = (0, _debounce.default)(function (cache, view) {
51
+ var loadedNodeviews = cache.get(view);
52
+ if (!loadedNodeviews || Object.keys(loadedNodeviews).length === 0) {
53
+ return;
54
+ }
55
+ var nodeViewsToReplace = _objectSpread({}, loadedNodeviews);
56
+
57
+ // Make sure the cache is cleaned
58
+ // From here, we will access the loaded node views by lexical scope
59
+ cache.set(view, {});
60
+
61
+ // eslint-disable-next-line compat/compat
62
+ var idle = window.requestIdleCallback;
63
+
64
+ /*
65
+ * For reasons that goes beyond my knowledge
66
+ * some Firefox versions aren't calling the requestIdleCallback.
67
+ *
68
+ * So, we need this check to make sure we use the requestAnimationFrame instead
69
+ */
70
+ var later = isFirefox || typeof idle !== 'function' ? window.requestAnimationFrame : idle;
71
+ later(function () {
72
+ var currentNodeViews = view.props.nodeViews;
73
+ var nextNodeViews = _objectSpread(_objectSpread({}, currentNodeViews), nodeViewsToReplace);
74
+ view.setProps({
75
+ nodeViews: nextNodeViews
76
+ });
77
+ });
78
+ });
79
+
80
+ /**
81
+ * 🧱 Internal: Editor FE Platform
82
+ */
83
+ var loadedPerEditorView = new WeakMap();
84
+
85
+ /**
86
+ * 🧱 Internal: Editor FE Platform
87
+ */
88
+ var queueReplaceNodeViews = exports.queueReplaceNodeViews = function queueReplaceNodeViews(view, _ref) {
89
+ var nodeName = _ref.nodeName,
90
+ nodeViewFunc = _ref.nodeViewFunc;
91
+ var nodeViews = loadedPerEditorView.get(view) || {};
92
+ nodeViews[nodeName] = nodeViewFunc;
93
+ loadedPerEditorView.set(view, nodeViews);
94
+ debouncedReplaceNodeviews(loadedPerEditorView, view);
95
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  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; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "87.0.1";
20
+ var packageVersion = "87.0.3";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -20,12 +20,13 @@ var CodeBlockSharedCssClassName = exports.CodeBlockSharedCssClassName = {
20
20
  CODEBLOCK_CONTENT_WRAPPER: 'code-block-content-wrapper',
21
21
  CODEBLOCK_LINE_NUMBER_GUTTER: 'line-number-gutter',
22
22
  CODEBLOCK_CONTENT: 'code-content',
23
- DS_CODEBLOCK: '[data-ds--code--code-block]'
23
+ DS_CODEBLOCK: '[data-ds--code--code-block]',
24
+ CODEBLOCK_CONTENT_WRAPPED: 'code-content--wrapped'
24
25
  };
25
26
  var codeBlockSharedStyles = exports.codeBlockSharedStyles = function codeBlockSharedStyles() {
26
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tposition: relative;\n\t\tbackground-color: ", ";\n\t\tborder-radius: ", ";\n\t\tmargin: ", " 0 0 0;\n\t\tfont-family: ", ";\n\t\tmin-width: ", "px;\n\t\tcursor: pointer;\n\n\t\t--ds--code--bg-color: transparent;\n\n\t\t/* This is necessary to allow for arrow key navigation in/out of code blocks in Firefox. */\n\t\twhite-space: normal;\n\n\t\t.", " {\n\t\t\tposition: absolute;\n\t\t\tvisibility: hidden;\n\t\t\theight: 1.5rem;\n\t\t\ttop: 0px;\n\t\t\tleft: 0px;\n\t\t}\n\n\t\t.", " {\n\t\t\tposition: absolute;\n\t\t\tvisibility: hidden;\n\t\t\theight: 1.5rem;\n\t\t\tbottom: 0px;\n\t\t\tright: 0px;\n\t\t}\n\n\t\t.", " {\n\t\t\tbackground-color: ", ";\n\t\t\tdisplay: flex;\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 100%;\n\t\t\tcounter-reset: line;\n\t\t\toverflow-x: auto;\n\n\t\t\tbackground-image: ", ";\n\n\t\t\tbackground-repeat: no-repeat;\n\t\t\tbackground-attachment: local, local, local, local, scroll, scroll, scroll, scroll;\n\t\t\tbackground-size:\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t1px 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t1px 100%;\n\t\t\tbackground-position:\n\t\t\t\t0 0,\n\t\t\t\t0 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t0 0,\n\t\t\t\t0 0;\n\n\t\t\t/* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */\n\t\t\toverflow-y: hidden;\n\t\t}\n\n\t\t.", " {\n\t\t\tflex-shrink: 0;\n\t\t\ttext-align: right;\n\t\t\tbackground-color: ", ";\n\t\t\tpadding: ", ";\n\t\t\tposition: relative;\n\n\t\t\tspan {\n\t\t\t\tdisplay: block;\n\t\t\t\tline-height: 0;\n\t\t\t\tfont-size: 0;\n\n\t\t\t\t::before {\n\t\t\t\t\tdisplay: inline-block;\n\t\t\t\t\tcontent: counter(line);\n\t\t\t\t\tcounter-increment: line;\n\t\t\t\t\tcolor: ", ";\n\t\t\t\t\tfont-size: ", ";\n\t\t\t\t\tline-height: 1.5rem;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t.", " {\n\t\t\tdisplay: flex;\n\t\t\tflex: 1;\n\n\t\t\tcode {\n\t\t\t\tflex-grow: 1;\n\t\t\t\ttab-size: 4;\n\t\t\t\tcursor: text;\n\t\t\t\tcolor: ", ";\n\t\t\t\tborder-radius: ", ";\n\t\t\t\tmargin: ", ";\n\t\t\t\twhite-space: pre;\n\t\t\t\tfont-size: ", ";\n\t\t\t\tline-height: 1.5rem;\n\t\t\t}\n\t\t}\n\t}\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, "var(--ds-surface-raised, transparent)", "var(--ds-border-radius, 3px)", _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorCodeFontFamily, _editorSharedStyles.akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_START, CodeBlockSharedCssClassName.CODEBLOCK_END, CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, "var(--ds-background-neutral, ".concat(_colors.N20, ")"), "var(--ds-border-radius, 3px)", (0, _editorSharedStyles.overflowShadow)({
27
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tposition: relative;\n\t\tbackground-color: ", ";\n\t\tborder-radius: ", ";\n\t\tmargin: ", " 0 0 0;\n\t\tfont-family: ", ";\n\t\tmin-width: ", "px;\n\t\tcursor: pointer;\n\n\t\t--ds--code--bg-color: transparent;\n\n\t\t/* This is necessary to allow for arrow key navigation in/out of code blocks in Firefox. */\n\t\twhite-space: normal;\n\n\t\t.", " {\n\t\t\tposition: absolute;\n\t\t\tvisibility: hidden;\n\t\t\theight: 1.5rem;\n\t\t\ttop: 0px;\n\t\t\tleft: 0px;\n\t\t}\n\n\t\t.", " {\n\t\t\tposition: absolute;\n\t\t\tvisibility: hidden;\n\t\t\theight: 1.5rem;\n\t\t\tbottom: 0px;\n\t\t\tright: 0px;\n\t\t}\n\n\t\t.", " {\n\t\t\tbackground-color: ", ";\n\t\t\tdisplay: flex;\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 100%;\n\t\t\tcounter-reset: line;\n\t\t\toverflow-x: auto;\n\n\t\t\tbackground-image: ", ";\n\n\t\t\tbackground-repeat: no-repeat;\n\t\t\tbackground-attachment: local, local, local, local, scroll, scroll, scroll, scroll;\n\t\t\tbackground-size:\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t1px 100%,\n\t\t\t\t", " 100%,\n\t\t\t\t1px 100%;\n\t\t\tbackground-position:\n\t\t\t\t0 0,\n\t\t\t\t0 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t0 0,\n\t\t\t\t0 0;\n\n\t\t\t/* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */\n\t\t\toverflow-y: hidden;\n\t\t}\n\n\t\t.", " {\n\t\t\tflex-shrink: 0;\n\t\t\ttext-align: right;\n\t\t\tbackground-color: ", ";\n\t\t\tpadding: ", ";\n\t\t\tposition: relative;\n\n\t\t\tspan {\n\t\t\t\tdisplay: block;\n\t\t\t\tline-height: 0;\n\t\t\t\tfont-size: 0;\n\n\t\t\t\t::before {\n\t\t\t\t\tdisplay: inline-block;\n\t\t\t\t\tcontent: counter(line);\n\t\t\t\t\tcounter-increment: line;\n\t\t\t\t\tcolor: ", ";\n\t\t\t\t\tfont-size: ", ";\n\t\t\t\t\tline-height: 1.5rem;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t.", " {\n\t\t\tdisplay: flex;\n\t\t\tflex: 1;\n\n\t\t\tcode {\n\t\t\t\tflex-grow: 1;\n\t\t\t\ttab-size: 4;\n\t\t\t\tcursor: text;\n\t\t\t\tcolor: ", ";\n\t\t\t\tborder-radius: ", ";\n\t\t\t\tmargin: ", ";\n\t\t\t\twhite-space: pre;\n\t\t\t\tfont-size: ", ";\n\t\t\t\tline-height: 1.5rem;\n\t\t\t}\n\t\t}\n\n\t\t.", " {\n\t\t\tcode {\n\t\t\t\tword-break: break-word;\n\t\t\t\twhite-space: pre-wrap;\n\t\t\t}\n\t\t}\n\t}\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, "var(--ds-surface-raised, transparent)", "var(--ds-border-radius, 3px)", _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorCodeFontFamily, _editorSharedStyles.akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_START, CodeBlockSharedCssClassName.CODEBLOCK_END, CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, "var(--ds-background-neutral, ".concat(_colors.N20, ")"), "var(--ds-border-radius, 3px)", (0, _editorSharedStyles.overflowShadow)({
27
28
  leftCoverWidth: "var(--ds-space-300, 24px)"
28
- }), "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-neutral, ".concat(_colors.N30, ")"), "var(--ds-space-100, 8px)", "var(--ds-text-subtlest, ".concat(_colors.N400, ")"), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, "var(--ds-text, ".concat(_colors.N800, ")"), "var(--ds-border-radius, 3px)", "var(--ds-space-100, 8px)", (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()));
29
+ }), "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-neutral, ".concat(_colors.N30, ")"), "var(--ds-space-100, 8px)", "var(--ds-text-subtlest, ".concat(_colors.N400, ")"), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, "var(--ds-text, ".concat(_colors.N800, ")"), "var(--ds-border-radius, 3px)", "var(--ds-space-100, 8px)", (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPED);
29
30
  };
30
31
 
31
32
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
@@ -17,9 +17,11 @@ var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = exports.FLOATING_TOOLBAR_LINKPICKER_
17
17
 
18
18
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
19
19
  var smartCardStyles = exports.smartCardStyles = function smartCardStyles() {
20
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), _smartCard.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, ".concat(_colors.Y75, ")"), ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, ".concat(_colors.Y300, ")"), ";\n box-shadow: ", "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(_colors.N60A, ", -1px 2px 3px ").concat(_colors.N60A), ")"), ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER,
20
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), _smartCard.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, ".concat(_colors.Y75, ")"), ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, ".concat(_colors.Y300, ")"), ";\n box-shadow: ", "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(_colors.N60A, ", -1px 2px 3px ").concat(_colors.N60A), ")"), ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER,
21
21
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
22
22
  (0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages') ? 'text' : 'pointer',
23
23
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
24
- (0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages') ? 'pointer' : 'auto', _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), "var(--ds-border-radius-200, 8px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.DATASOURCE_CONTAINER, _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-background-neutral-subtle, ".concat(_colors.N0, ")"), "var(--ds-border-radius-200, 8px)", "var(--ds-border, ".concat(_colors.N40, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, DATASOURCE_INNER_CONTAINER_CLASSNAME, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
24
+ (0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages') ? 'pointer' : 'auto', _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), "var(--ds-border-radius-200, 8px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.DATASOURCE_CONTAINER, _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-background-neutral-subtle, ".concat(_colors.N0, ")"), "var(--ds-border-radius-200, 8px)", "var(--ds-border, ".concat(_colors.N40, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, DATASOURCE_INNER_CONTAINER_CLASSNAME, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER,
25
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
26
+ (0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages') ? 'pointer' : 'auto', _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
25
27
  };
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "87.0.1";
26
+ var packageVersion = "87.0.3";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,5 +1,5 @@
1
- import debounce from 'lodash/debounce';
2
- import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
1
+ import { LazyNodeView } from './node-view';
2
+ import { queueReplaceNodeViews } from './replace-node-views';
3
3
 
4
4
  /**
5
5
  * 📢 Public Type
@@ -13,123 +13,12 @@ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
13
13
  * @see {withLazyLoading}
14
14
  */
15
15
 
16
- /**
17
- * 🧱 Internal: Editor FE Platform
18
- */
19
-
20
- /**
21
- * 🧱 Internal: Editor FE Platform
22
- */
23
-
24
- /**
25
- * 🧱 Internal: Editor FE Platform
26
- */
27
-
28
16
  /**
29
17
  * 🧱 Internal: Editor FE Platform
30
18
  *
31
- * A cache to store loaded React NodeViews for each EditorView.
32
- *
33
- * This cache will help us to avoid any race condition
34
- * when multiple Editors exist in the same page.
35
- *
36
- * @type {CacheType}
37
- */
38
- const cachePerEditorView = new WeakMap();
39
-
40
- /**
41
- * 🧱 Internal: Editor FE Platform
19
+ * Controls which node was scheduled to load the original node view code
42
20
  */
43
- const isFirefox = /gecko\/\d/i.test(navigator.userAgent);
44
-
45
- /**
46
- * 🧱 Internal: Editor FE Platform
47
- *
48
- * A NodeView that serves as a placeholder until the actual NodeView is loaded.
49
- */
50
- class LazyNodeView {
51
- constructor(node, view, getPos) {
52
- var _node$type, _node$type$spec;
53
- if (typeof ((_node$type = node.type) === null || _node$type === void 0 ? void 0 : (_node$type$spec = _node$type.spec) === null || _node$type$spec === void 0 ? void 0 : _node$type$spec.toDOM) !== 'function') {
54
- this.dom = document.createElement('div');
55
- return;
56
- }
57
- const fallback = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node));
58
- this.dom = fallback.dom;
59
- this.contentDOM = fallback.contentDOM;
60
- if (this.dom instanceof HTMLElement) {
61
- // This attribute is mostly used for debugging purposed
62
- // It will help us to found out when the node was replaced
63
- this.dom.setAttribute('data-lazy-node-view', node.type.name);
64
- // This is used on Libra tests
65
- // We are using this to make sure all lazy noded were replaced
66
- // before the test started
67
- this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
68
- }
69
- }
70
- }
71
-
72
- /**
73
- * 🧱 Internal: Editor FE Platform
74
- *
75
- * Debounces and replaces the node views in a ProseMirror editor with lazy-loaded node views.
76
- *
77
- * This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
78
- * node views have been loaded. It uses a debounced approach to ensure that the replacement does
79
- * not happen too frequently, which can be performance-intensive.
80
- *
81
- * The function checks if there are any loaded node views in the cache associated with the given
82
- * `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
83
- * loaded node views. The replacement is scheduled using `requestIdleCallback` or
84
- * `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
85
- * `requestIdleCallback` may not be supported.
86
- *
87
- * @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
88
- * the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
89
- * is a record of node type names to their corresponding `NodeViewConstructor`.
90
- * @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
91
- * needs to be updated.
92
- *
93
- * @example
94
- * const cache = new WeakMap();
95
- * const view = new EditorView(...);
96
- *
97
- * // Assume some node views have been loaded and stored in the cache
98
- * cache.set(view, {
99
- * 'table': TableViewConstructor,
100
- * 'tableCell': TableCellViewConstructor,
101
- * });
102
- *
103
- * debouncedReplaceNodeviews(cache, view);
104
- */
105
- export const debouncedReplaceNodeviews = debounce((cache, view) => {
106
- const loadedNodeviews = cache.get(view);
107
- if (!loadedNodeviews) {
108
- return;
109
- }
110
- cache.delete(view);
111
-
112
- // eslint-disable-next-line compat/compat
113
- const idle = window.requestIdleCallback;
114
-
115
- /*
116
- * For reasons that goes beyond my knowledge
117
- * some Firefox versions aren't calling the requestIdleCallback.
118
- *
119
- * So, we need this check to make sure we use the requestAnimationFrame instead
120
- */
121
- const later = isFirefox || typeof idle !== 'function' ? window.requestAnimationFrame : idle;
122
- later(() => {
123
- const currentNodeViews = view.props.nodeViews;
124
- const nextNodeViews = {
125
- ...currentNodeViews,
126
- ...loadedNodeviews
127
- };
128
- view.setProps({
129
- nodeViews: nextNodeViews
130
- });
131
- });
132
- });
21
+ const requestedNodesPerEditorView = new WeakMap();
133
22
 
134
23
  /**
135
24
  * 📢 Public: Any EditorPlugin can use this function
@@ -178,23 +67,26 @@ export const withLazyLoading = ({
178
67
  dispatchAnalyticsEvent
179
68
  }) => {
180
69
  const createLazyNodeView = (node, view, getPos, decorations) => {
181
- var _node$type2, _node$type2$spec;
182
- let cachedMap = cachePerEditorView.get(view);
183
- if (!cachedMap) {
184
- cachedMap = {};
185
- cachePerEditorView.set(view, cachedMap);
70
+ var _node$type, _node$type$spec;
71
+ let requestedNodes = requestedNodesPerEditorView.get(view);
72
+ if (!requestedNodes) {
73
+ requestedNodes = new Set(), requestedNodesPerEditorView.set(view, requestedNodes);
186
74
  }
187
- const wasAlreadyRequested = cachedMap.hasOwnProperty(nodeName);
75
+ const wasAlreadyRequested = requestedNodes.has(nodeName);
188
76
  if (wasAlreadyRequested) {
189
77
  return new LazyNodeView(node, view, getPos);
190
78
  }
79
+ requestedNodes.add(nodeName);
191
80
  loader().then(nodeViewFuncModule => {
192
- cachedMap[nodeName] = (node, view, getPos, decorations) => {
81
+ const nodeViewFunc = (node, view, getPos, decorations) => {
193
82
  return nodeViewFuncModule(node, view, getPos, decorations, getNodeViewOptions);
194
83
  };
195
- debouncedReplaceNodeviews(cachePerEditorView, view);
84
+ queueReplaceNodeViews(view, {
85
+ nodeName,
86
+ nodeViewFunc
87
+ });
196
88
  });
197
- if (typeof ((_node$type2 = node.type) === null || _node$type2 === void 0 ? void 0 : (_node$type2$spec = _node$type2.spec) === null || _node$type2$spec === void 0 ? void 0 : _node$type2$spec.toDOM) !== 'function') {
89
+ if (typeof ((_node$type = node.type) === null || _node$type === void 0 ? void 0 : (_node$type$spec = _node$type.spec) === null || _node$type$spec === void 0 ? void 0 : _node$type$spec.toDOM) !== 'function') {
198
90
  // TODO: Analytics ED-23982
199
91
  // dispatchAnalyticsEvent({
200
92
  // action: ACTION.LAZY_NODE_VIEW_ERROR,
@@ -0,0 +1,27 @@
1
+ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * 🧱 Internal: Editor FE Platform
4
+ *
5
+ * A NodeView that serves as a placeholder until the actual NodeView is loaded.
6
+ */
7
+ export class LazyNodeView {
8
+ constructor(node, view, getPos) {
9
+ var _node$type, _node$type$spec;
10
+ if (typeof ((_node$type = node.type) === null || _node$type === void 0 ? void 0 : (_node$type$spec = _node$type.spec) === null || _node$type$spec === void 0 ? void 0 : _node$type$spec.toDOM) !== 'function') {
11
+ this.dom = document.createElement('div');
12
+ return;
13
+ }
14
+ const fallback = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node));
15
+ this.dom = fallback.dom;
16
+ this.contentDOM = fallback.contentDOM;
17
+ if (this.dom instanceof HTMLElement) {
18
+ // This attribute is mostly used for debugging purposed
19
+ // It will help us to found out when the node was replaced
20
+ this.dom.setAttribute('data-lazy-node-view', node.type.name);
21
+ // This is used on Libra tests
22
+ // We are using this to make sure all lazy noded were replaced
23
+ // before the test started
24
+ this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
25
+ }
26
+ }
27
+ }