@atlaskit/editor-common 115.7.1 → 115.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 115.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f7faa21a01fc7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f7faa21a01fc7) -
8
+ Cleanup stale feature gates and experiments now that they have shipped. The following
9
+ gates/experiments have been removed and their enabled paths kept as the permanent behaviour:
10
+ platform_editor_fix_scrolling_popup_position, platform_editor_table_resize_chromeless,
11
+ platform_editor_chromeless_akeditor_class, create_work_item_modernization_exp.
12
+ - Updated dependencies
13
+
14
+ ## 115.7.2
15
+
16
+ ### Patch Changes
17
+
18
+ - [`4c2645b77929d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4c2645b77929d) -
19
+ [ux] EDITOR-7346 add ai and diff plugin support for panel_c1
20
+ - Updated dependencies
21
+
3
22
  ## 115.7.1
4
23
 
5
24
  ### Patch Changes
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "115.7.0";
22
+ var packageVersion = "115.7.2";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "115.7.0";
27
+ var packageVersion = "115.7.2";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -18,7 +18,6 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
18
18
  var _reactDom = require("react-dom");
19
19
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
20
20
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
22
21
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
23
22
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
24
23
  var _utils = require("./utils");
@@ -127,7 +126,7 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
127
126
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- Existing Popup positioning fallback; keep unchanged for safety.
128
127
  boundariesElement: boundariesElement || document.body,
129
128
  minPopupMargin: minPopupMargin,
130
- scrollableElement: stick && ((0, _expValEquals.expValEquals)('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true)) ? this.scrollElement : undefined
129
+ scrollableElement: stick ? this.scrollElement : undefined
131
130
  });
132
131
  position = onPositionCalculated ? onPositionCalculated(position) : position;
133
132
  if (typeof position.top !== 'undefined' && absoluteOffset !== null && absoluteOffset !== void 0 && absoluteOffset.top) {
@@ -295,7 +294,7 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
295
294
  key: "componentDidUpdate",
296
295
  value: function componentDidUpdate(prevProps) {
297
296
  this.handleChangedFocusTrapProp(prevProps);
298
- if (((0, _expValEquals.expValEquals)('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true)) && prevProps.scrollableElement !== this.props.scrollableElement) {
297
+ if (prevProps.scrollableElement !== this.props.scrollableElement) {
299
298
  this.initScrollElement();
300
299
  }
301
300
  if (this.props !== prevProps) {
@@ -308,29 +307,7 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
308
307
  // Ignored via go/ees005
309
308
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
310
309
  window.addEventListener('resize', this.onResize);
311
- if ((0, _expValEquals.expValEquals)('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true)) {
312
- this.initScrollElement();
313
- return;
314
- }
315
- var stick = this.props.stick;
316
-
317
- // Ignored via go/ees005
318
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
319
- var target = this.props.target;
320
- var scrollParentElement = (0, _utils.findOverflowScrollParent)(target);
321
- if (scrollParentElement && this.resizeObserver) {
322
- this.resizeObserver.observe(scrollParentElement);
323
- }
324
- if (stick) {
325
- this.scrollElement = scrollParentElement;
326
- } else {
327
- this.scrollElement = this.props.scrollableElement;
328
- }
329
- if (this.scrollElement) {
330
- // Ignored via go/ees005
331
- // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
332
- this.scrollElement.addEventListener('scroll', this.onResize);
333
- }
310
+ this.initScrollElement();
334
311
  }
335
312
  }, {
336
313
  key: "componentWillUnmount",
@@ -426,12 +426,6 @@ Object.defineProperty(exports, "getAnnotationMarksForPos", {
426
426
  return _annotation.getAnnotationMarksForPos;
427
427
  }
428
428
  });
429
- Object.defineProperty(exports, "getBaseNodeTypeName", {
430
- enumerable: true,
431
- get: function get() {
432
- return _nodeTypeUtils.getBaseNodeTypeName;
433
- }
434
- });
435
429
  Object.defineProperty(exports, "getBreakoutResizableNodeTypes", {
436
430
  enumerable: true,
437
431
  get: function get() {
@@ -773,24 +767,12 @@ Object.defineProperty(exports, "isNodeBeforeMediaNode", {
773
767
  }
774
768
  });
775
769
  exports.isNodeEmpty = isNodeEmpty;
776
- Object.defineProperty(exports, "isNodeOfSameBaseType", {
777
- enumerable: true,
778
- get: function get() {
779
- return _nodeTypeUtils.isNodeOfSameBaseType;
780
- }
781
- });
782
770
  Object.defineProperty(exports, "isNodeSelectedOrInRange", {
783
771
  enumerable: true,
784
772
  get: function get() {
785
773
  return _nodes.isNodeSelectedOrInRange;
786
774
  }
787
775
  });
788
- Object.defineProperty(exports, "isNodeTypeValidChildOf", {
789
- enumerable: true,
790
- get: function get() {
791
- return _isNodeTypeValidChildOf.isNodeTypeValidChildOf;
792
- }
793
- });
794
776
  Object.defineProperty(exports, "isParagraph", {
795
777
  enumerable: true,
796
778
  get: function get() {
@@ -1326,8 +1308,6 @@ var _calculateToolbarPosition = require("./calculate-toolbar-position");
1326
1308
  var _nodesByLocalIds = require("./nodes-by-localIds");
1327
1309
  var _pageElementCounts = require("./page-element-counts");
1328
1310
  var _withFeatureFlaggedComponent = require("./withFeatureFlaggedComponent");
1329
- var _isNodeTypeValidChildOf = require("./isNodeTypeValidChildOf");
1330
- var _nodeTypeUtils = require("./node-type-utils");
1331
1311
  // Disable no-re-export rule for entry point files
1332
1312
  /* eslint-disable @atlaskit/editor/no-re-export */
1333
1313
 
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getBaseNodeTypeName = getBaseNodeTypeName;
7
7
  exports.isNodeOfSameBaseType = isNodeOfSameBaseType;
8
+ exports.isNodeTypeValidChildOf = isNodeTypeValidChildOf;
9
+ exports.pickPanelTypeForInsertion = pickPanelTypeForInsertion;
10
+ var _model = require("@atlaskit/editor-prosemirror/model");
8
11
  /**
9
12
  * Returns the base name of a node type, stripping known variant suffixes.
10
13
  */
@@ -25,4 +28,51 @@ function getBaseNodeTypeName(nodeType) {
25
28
  function isNodeOfSameBaseType(a, b) {
26
29
  return getBaseNodeTypeName(a) === getBaseNodeTypeName(b);
27
30
  }
28
- // eslint-disable-next-line @atlaskit/editor/no-re-export
31
+
32
+ /**
33
+ * Checks if a node type is a valid child of a parent node by creating a minimal valid
34
+ * instance and validating it against the parent's content expression. Unlike ProseMirror's
35
+ * canReplaceWith, this checks general type compatibility without requiring a specific insertion index.
36
+ */
37
+ function isNodeTypeValidChildOf(childTypeName, parentNode, schema) {
38
+ var childType = schema.nodes[childTypeName];
39
+ if (!childType) {
40
+ return false;
41
+ }
42
+ var candidate = childType.createAndFill();
43
+ if (!candidate) {
44
+ return false;
45
+ }
46
+ return parentNode.type.validContent(_model.Fragment.from(candidate));
47
+ }
48
+
49
+ /**
50
+ * Picks the appropriate panel NodeType for insertion at the current selection
51
+ * or resolved position.
52
+ *
53
+ * Prefers `panel_c1` when the parent can accept it (e.g. when table-in-panel
54
+ * is supported), falls back to `panel` otherwise or at isolating boundaries.
55
+ */
56
+ function pickPanelTypeForInsertion($from) {
57
+ var schema = $from.doc.type.schema;
58
+ var _schema$nodes = schema.nodes,
59
+ panel = _schema$nodes.panel,
60
+ panel_c1 = _schema$nodes.panel_c1;
61
+ if (!panel_c1) {
62
+ return panel;
63
+ }
64
+ for (var depth = $from.depth; depth >= 0; depth--) {
65
+ var parent = $from.node(depth);
66
+ var index = $from.index(depth);
67
+ if (parent.canReplaceWith(index, index, panel_c1)) {
68
+ return panel_c1;
69
+ }
70
+ var spec = parent.type.spec;
71
+ // Stop at isolating containers (e.g. expand, tableCell) — hard walls where
72
+ // the panel stays inside and should use the regular panel type.
73
+ if (spec.isolating) {
74
+ return panel;
75
+ }
76
+ }
77
+ return panel;
78
+ }
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "115.7.0";
7
+ const packageVersion = "115.7.2";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "115.7.0";
17
+ const packageVersion = "115.7.2";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -6,7 +6,6 @@ import rafSchedule from 'raf-schd';
6
6
  import { createPortal, flushSync } from 'react-dom';
7
7
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
9
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
11
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
11
  import { calculatePlacement, calculatePosition, findOverflowScrollParent } from './utils';
@@ -104,7 +103,7 @@ export default class Popup extends React.Component {
104
103
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- Existing Popup positioning fallback; keep unchanged for safety.
105
104
  boundariesElement: boundariesElement || document.body,
106
105
  minPopupMargin,
107
- scrollableElement: stick && (expValEquals('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) ? this.scrollElement : undefined
106
+ scrollableElement: stick ? this.scrollElement : undefined
108
107
  });
109
108
  position = onPositionCalculated ? onPositionCalculated(position) : position;
110
109
  if (typeof position.top !== 'undefined' && absoluteOffset !== null && absoluteOffset !== void 0 && absoluteOffset.top) {
@@ -260,7 +259,7 @@ export default class Popup extends React.Component {
260
259
  }
261
260
  componentDidUpdate(prevProps) {
262
261
  this.handleChangedFocusTrapProp(prevProps);
263
- if ((expValEquals('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && prevProps.scrollableElement !== this.props.scrollableElement) {
262
+ if (prevProps.scrollableElement !== this.props.scrollableElement) {
264
263
  this.initScrollElement();
265
264
  }
266
265
  if (this.props !== prevProps) {
@@ -271,31 +270,7 @@ export default class Popup extends React.Component {
271
270
  // Ignored via go/ees005
272
271
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
273
272
  window.addEventListener('resize', this.onResize);
274
- if (expValEquals('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) {
275
- this.initScrollElement();
276
- return;
277
- }
278
- const {
279
- stick
280
- } = this.props;
281
-
282
- // Ignored via go/ees005
283
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
284
- const target = this.props.target;
285
- const scrollParentElement = findOverflowScrollParent(target);
286
- if (scrollParentElement && this.resizeObserver) {
287
- this.resizeObserver.observe(scrollParentElement);
288
- }
289
- if (stick) {
290
- this.scrollElement = scrollParentElement;
291
- } else {
292
- this.scrollElement = this.props.scrollableElement;
293
- }
294
- if (this.scrollElement) {
295
- // Ignored via go/ees005
296
- // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
297
- this.scrollElement.addEventListener('scroll', this.onResize);
298
- }
273
+ this.initScrollElement();
299
274
  }
300
275
  componentWillUnmount() {
301
276
  var _this$unbindScroll2, _this$resizeObserver3;
@@ -379,6 +379,4 @@ export { toJSON, nodeToJSON } from './nodes';
379
379
  export { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from './calculate-toolbar-position';
380
380
  export { findNodePosByLocalIds } from './nodes-by-localIds';
381
381
  export { getPageElementCounts } from './page-element-counts';
382
- export { withFeatureFlaggedComponent } from './withFeatureFlaggedComponent';
383
- export { isNodeTypeValidChildOf } from './isNodeTypeValidChildOf';
384
- export { isNodeOfSameBaseType, getBaseNodeTypeName } from './node-type-utils';
382
+ export { withFeatureFlaggedComponent } from './withFeatureFlaggedComponent';
@@ -1,3 +1,4 @@
1
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
1
2
  /**
2
3
  * Returns the base name of a node type, stripping known variant suffixes.
3
4
  */
@@ -18,4 +19,52 @@ export function getBaseNodeTypeName(nodeType) {
18
19
  export function isNodeOfSameBaseType(a, b) {
19
20
  return getBaseNodeTypeName(a) === getBaseNodeTypeName(b);
20
21
  }
21
- // eslint-disable-next-line @atlaskit/editor/no-re-export
22
+
23
+ /**
24
+ * Checks if a node type is a valid child of a parent node by creating a minimal valid
25
+ * instance and validating it against the parent's content expression. Unlike ProseMirror's
26
+ * canReplaceWith, this checks general type compatibility without requiring a specific insertion index.
27
+ */
28
+ export function isNodeTypeValidChildOf(childTypeName, parentNode, schema) {
29
+ const childType = schema.nodes[childTypeName];
30
+ if (!childType) {
31
+ return false;
32
+ }
33
+ const candidate = childType.createAndFill();
34
+ if (!candidate) {
35
+ return false;
36
+ }
37
+ return parentNode.type.validContent(Fragment.from(candidate));
38
+ }
39
+
40
+ /**
41
+ * Picks the appropriate panel NodeType for insertion at the current selection
42
+ * or resolved position.
43
+ *
44
+ * Prefers `panel_c1` when the parent can accept it (e.g. when table-in-panel
45
+ * is supported), falls back to `panel` otherwise or at isolating boundaries.
46
+ */
47
+ export function pickPanelTypeForInsertion($from) {
48
+ const schema = $from.doc.type.schema;
49
+ const {
50
+ panel,
51
+ panel_c1
52
+ } = schema.nodes;
53
+ if (!panel_c1) {
54
+ return panel;
55
+ }
56
+ for (let depth = $from.depth; depth >= 0; depth--) {
57
+ const parent = $from.node(depth);
58
+ const index = $from.index(depth);
59
+ if (parent.canReplaceWith(index, index, panel_c1)) {
60
+ return panel_c1;
61
+ }
62
+ const spec = parent.type.spec;
63
+ // Stop at isolating containers (e.g. expand, tableCell) — hard walls where
64
+ // the panel stays inside and should use the regular panel type.
65
+ if (spec.isolating) {
66
+ return panel;
67
+ }
68
+ }
69
+ return panel;
70
+ }
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "115.7.0";
13
+ var packageVersion = "115.7.2";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "115.7.0";
24
+ var packageVersion = "115.7.2";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -15,7 +15,6 @@ import rafSchedule from 'raf-schd';
15
15
  import { createPortal, flushSync } from 'react-dom';
16
16
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
18
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
20
19
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
21
20
  import { calculatePlacement, calculatePosition as _calculatePosition, findOverflowScrollParent } from './utils';
@@ -120,7 +119,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
120
119
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- Existing Popup positioning fallback; keep unchanged for safety.
121
120
  boundariesElement: boundariesElement || document.body,
122
121
  minPopupMargin: minPopupMargin,
123
- scrollableElement: stick && (expValEquals('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) ? this.scrollElement : undefined
122
+ scrollableElement: stick ? this.scrollElement : undefined
124
123
  });
125
124
  position = onPositionCalculated ? onPositionCalculated(position) : position;
126
125
  if (typeof position.top !== 'undefined' && absoluteOffset !== null && absoluteOffset !== void 0 && absoluteOffset.top) {
@@ -288,7 +287,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
288
287
  key: "componentDidUpdate",
289
288
  value: function componentDidUpdate(prevProps) {
290
289
  this.handleChangedFocusTrapProp(prevProps);
291
- if ((expValEquals('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && prevProps.scrollableElement !== this.props.scrollableElement) {
290
+ if (prevProps.scrollableElement !== this.props.scrollableElement) {
292
291
  this.initScrollElement();
293
292
  }
294
293
  if (this.props !== prevProps) {
@@ -301,29 +300,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
301
300
  // Ignored via go/ees005
302
301
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
303
302
  window.addEventListener('resize', this.onResize);
304
- if (expValEquals('platform_editor_fix_scrolling_popup_position', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) {
305
- this.initScrollElement();
306
- return;
307
- }
308
- var stick = this.props.stick;
309
-
310
- // Ignored via go/ees005
311
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
312
- var target = this.props.target;
313
- var scrollParentElement = findOverflowScrollParent(target);
314
- if (scrollParentElement && this.resizeObserver) {
315
- this.resizeObserver.observe(scrollParentElement);
316
- }
317
- if (stick) {
318
- this.scrollElement = scrollParentElement;
319
- } else {
320
- this.scrollElement = this.props.scrollableElement;
321
- }
322
- if (this.scrollElement) {
323
- // Ignored via go/ees005
324
- // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
325
- this.scrollElement.addEventListener('scroll', this.onResize);
326
- }
303
+ this.initScrollElement();
327
304
  }
328
305
  }, {
329
306
  key: "componentWillUnmount",
@@ -382,6 +382,4 @@ export { toJSON, nodeToJSON } from './nodes';
382
382
  export { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from './calculate-toolbar-position';
383
383
  export { findNodePosByLocalIds } from './nodes-by-localIds';
384
384
  export { getPageElementCounts } from './page-element-counts';
385
- export { withFeatureFlaggedComponent } from './withFeatureFlaggedComponent';
386
- export { isNodeTypeValidChildOf } from './isNodeTypeValidChildOf';
387
- export { isNodeOfSameBaseType, getBaseNodeTypeName } from './node-type-utils';
385
+ export { withFeatureFlaggedComponent } from './withFeatureFlaggedComponent';
@@ -1,3 +1,4 @@
1
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
1
2
  /**
2
3
  * Returns the base name of a node type, stripping known variant suffixes.
3
4
  */
@@ -18,4 +19,51 @@ export function getBaseNodeTypeName(nodeType) {
18
19
  export function isNodeOfSameBaseType(a, b) {
19
20
  return getBaseNodeTypeName(a) === getBaseNodeTypeName(b);
20
21
  }
21
- // eslint-disable-next-line @atlaskit/editor/no-re-export
22
+
23
+ /**
24
+ * Checks if a node type is a valid child of a parent node by creating a minimal valid
25
+ * instance and validating it against the parent's content expression. Unlike ProseMirror's
26
+ * canReplaceWith, this checks general type compatibility without requiring a specific insertion index.
27
+ */
28
+ export function isNodeTypeValidChildOf(childTypeName, parentNode, schema) {
29
+ var childType = schema.nodes[childTypeName];
30
+ if (!childType) {
31
+ return false;
32
+ }
33
+ var candidate = childType.createAndFill();
34
+ if (!candidate) {
35
+ return false;
36
+ }
37
+ return parentNode.type.validContent(Fragment.from(candidate));
38
+ }
39
+
40
+ /**
41
+ * Picks the appropriate panel NodeType for insertion at the current selection
42
+ * or resolved position.
43
+ *
44
+ * Prefers `panel_c1` when the parent can accept it (e.g. when table-in-panel
45
+ * is supported), falls back to `panel` otherwise or at isolating boundaries.
46
+ */
47
+ export function pickPanelTypeForInsertion($from) {
48
+ var schema = $from.doc.type.schema;
49
+ var _schema$nodes = schema.nodes,
50
+ panel = _schema$nodes.panel,
51
+ panel_c1 = _schema$nodes.panel_c1;
52
+ if (!panel_c1) {
53
+ return panel;
54
+ }
55
+ for (var depth = $from.depth; depth >= 0; depth--) {
56
+ var parent = $from.node(depth);
57
+ var index = $from.index(depth);
58
+ if (parent.canReplaceWith(index, index, panel_c1)) {
59
+ return panel_c1;
60
+ }
61
+ var spec = parent.type.spec;
62
+ // Stop at isolating containers (e.g. expand, tableCell) — hard walls where
63
+ // the panel stays inside and should use the regular panel type.
64
+ if (spec.isolating) {
65
+ return panel;
66
+ }
67
+ }
68
+ return panel;
69
+ }
@@ -33,7 +33,7 @@ export { setTextSelection } from './setTextSelection';
33
33
  export { stepHasSlice } from './stepHasSlice';
34
34
  export { withImageLoader } from './imageLoader';
35
35
  export type { ImageLoaderProps, ImageLoaderState, ImageStatus } from './imageLoader';
36
- export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, calcBreakoutWithCustomWidth } from './breakout';
36
+ export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, calcBreakoutWithCustomWidth, } from './breakout';
37
37
  export { breakoutResizableNodes } from './breakoutResizableNodes';
38
38
  export { getBreakoutResizableNodeTypes } from './getBreakoutResizableNodeTypes';
39
39
  export { getNextBreakoutMode } from './getNextBreakoutMode';
@@ -44,7 +44,7 @@ export { findChangedNodesFromTransaction } from './findChangedNodesFromTransacti
44
44
  export { isMediaNode } from './isMediaNode';
45
45
  export { isNodeBeforeMediaNode } from './isNodeBeforeMediaNode';
46
46
  export { isSupportedInParent } from './isSupportedInParent';
47
- export { validateNodes, isType, isParagraph, isText, isLinkMark, isNodeSelectedOrInRange } from './nodes';
47
+ export { validateNodes, isType, isParagraph, isText, isLinkMark, isNodeSelectedOrInRange, } from './nodes';
48
48
  export { validNode } from './validNode';
49
49
  export type { Reducer } from './plugin-state-factory';
50
50
  export { pluginFactory } from './plugin-state-factory';
@@ -66,11 +66,11 @@ export { default as ADFTraversor } from './traversor';
66
66
  * Use entry-point `@atlaskit/editor-common/utils/analytics` instead
67
67
  */
68
68
  export { SEVERITY } from './SEVERITY';
69
- export { analyticsEventKey, getAnalyticsEditorAppearance, getAnalyticsEventSeverity } from './analytics';
69
+ export { analyticsEventKey, getAnalyticsEditorAppearance, getAnalyticsEventSeverity, } from './analytics';
70
70
  export { getAnalyticsAppearance } from './getAnalyticsAppearance';
71
71
  export { UNSUPPORTED_CONTENT_LEVEL_SEVERITY } from './unsupportedContent/UNSUPPORTED_CONTENT_LEVEL_SEVERITY';
72
72
  export { UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS } from './unsupportedContent/UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS';
73
- export { getUnsupportedContentLevelData, type UnsupportedContentLevelsTracking } from './unsupportedContent/get-unsupported-content-level-data';
73
+ export { getUnsupportedContentLevelData, type UnsupportedContentLevelsTracking, } from './unsupportedContent/get-unsupported-content-level-data';
74
74
  export type { UnsupportedContentTooltipPayload, UnsupportedContentPayload, } from './unsupportedContent/types';
75
75
  export { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
76
76
  export {
@@ -160,7 +160,7 @@ export { FILEPATH_REGEXP } from './FILEPATH_REGEXP';
160
160
  export { LinkMatcher } from './LinkMatcher';
161
161
  export { canLinkBeCreatedInRange } from './canLinkBeCreatedInRange';
162
162
  export { getLinkDomain } from './getLinkDomain';
163
- export { isFromCurrentDomain, linkifyContent, findFilepaths, isLinkInMatches, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent } from './hyperlink';
163
+ export { isFromCurrentDomain, linkifyContent, findFilepaths, isLinkInMatches, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent, } from './hyperlink';
164
164
  export { normalizeUrl } from './normalizeUrl';
165
165
  export declare const pmHistoryPluginKey = "history$";
166
166
  export { gridTypeForLayout } from './grid';
@@ -191,7 +191,7 @@ export { alignAttributes } from './rich-media-utils';
191
191
  export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
192
192
  export { canRenderDatasource } from './datasource';
193
193
  export { getDatasourceType } from './getDatasourceType';
194
- export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode } from './commands';
194
+ export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode, } from './commands';
195
195
  export { insertContentDeleteRange } from './insertContentDeleteRange';
196
196
  export type { WalkNode } from './commands';
197
197
  export { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, GUTTER_SIZE_MOBILE_IN_PX } from './scroll-gutter';
@@ -231,5 +231,3 @@ export { findNodePosByLocalIds } from './nodes-by-localIds';
231
231
  export { getPageElementCounts } from './page-element-counts';
232
232
  export type { PageElementCounts } from './page-element-counts';
233
233
  export { withFeatureFlaggedComponent } from './withFeatureFlaggedComponent';
234
- export { isNodeTypeValidChildOf } from './isNodeTypeValidChildOf';
235
- export { isNodeOfSameBaseType, getBaseNodeTypeName } from './node-type-utils';
@@ -1,4 +1,4 @@
1
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
1
+ import type { NodeType, Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  export declare function getBaseNodeTypeName(nodeType: NodeType): string;
3
3
  /**
4
4
  * Returns true if two node types share the same base type name.
@@ -7,3 +7,17 @@ export declare function getBaseNodeTypeName(nodeType: NodeType): string;
7
7
  * (e.g. `panel` and `panel_c1` are considered the same base type).
8
8
  */
9
9
  export declare function isNodeOfSameBaseType(a: NodeType, b: NodeType): boolean;
10
+ /**
11
+ * Checks if a node type is a valid child of a parent node by creating a minimal valid
12
+ * instance and validating it against the parent's content expression. Unlike ProseMirror's
13
+ * canReplaceWith, this checks general type compatibility without requiring a specific insertion index.
14
+ */
15
+ export declare function isNodeTypeValidChildOf(childTypeName: string, parentNode: PMNode, schema: Schema): boolean;
16
+ /**
17
+ * Picks the appropriate panel NodeType for insertion at the current selection
18
+ * or resolved position.
19
+ *
20
+ * Prefers `panel_c1` when the parent can accept it (e.g. when table-in-panel
21
+ * is supported), falls back to `panel` otherwise or at isolating boundaries.
22
+ */
23
+ export declare function pickPanelTypeForInsertion($from: ResolvedPos): NodeType;
@@ -33,7 +33,7 @@ export { setTextSelection } from './setTextSelection';
33
33
  export { stepHasSlice } from './stepHasSlice';
34
34
  export { withImageLoader } from './imageLoader';
35
35
  export type { ImageLoaderProps, ImageLoaderState, ImageStatus } from './imageLoader';
36
- export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, calcBreakoutWithCustomWidth } from './breakout';
36
+ export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, calcBreakoutWithCustomWidth, } from './breakout';
37
37
  export { breakoutResizableNodes } from './breakoutResizableNodes';
38
38
  export { getBreakoutResizableNodeTypes } from './getBreakoutResizableNodeTypes';
39
39
  export { getNextBreakoutMode } from './getNextBreakoutMode';
@@ -44,7 +44,7 @@ export { findChangedNodesFromTransaction } from './findChangedNodesFromTransacti
44
44
  export { isMediaNode } from './isMediaNode';
45
45
  export { isNodeBeforeMediaNode } from './isNodeBeforeMediaNode';
46
46
  export { isSupportedInParent } from './isSupportedInParent';
47
- export { validateNodes, isType, isParagraph, isText, isLinkMark, isNodeSelectedOrInRange } from './nodes';
47
+ export { validateNodes, isType, isParagraph, isText, isLinkMark, isNodeSelectedOrInRange, } from './nodes';
48
48
  export { validNode } from './validNode';
49
49
  export type { Reducer } from './plugin-state-factory';
50
50
  export { pluginFactory } from './plugin-state-factory';
@@ -66,11 +66,11 @@ export { default as ADFTraversor } from './traversor';
66
66
  * Use entry-point `@atlaskit/editor-common/utils/analytics` instead
67
67
  */
68
68
  export { SEVERITY } from './SEVERITY';
69
- export { analyticsEventKey, getAnalyticsEditorAppearance, getAnalyticsEventSeverity } from './analytics';
69
+ export { analyticsEventKey, getAnalyticsEditorAppearance, getAnalyticsEventSeverity, } from './analytics';
70
70
  export { getAnalyticsAppearance } from './getAnalyticsAppearance';
71
71
  export { UNSUPPORTED_CONTENT_LEVEL_SEVERITY } from './unsupportedContent/UNSUPPORTED_CONTENT_LEVEL_SEVERITY';
72
72
  export { UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS } from './unsupportedContent/UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS';
73
- export { getUnsupportedContentLevelData, type UnsupportedContentLevelsTracking } from './unsupportedContent/get-unsupported-content-level-data';
73
+ export { getUnsupportedContentLevelData, type UnsupportedContentLevelsTracking, } from './unsupportedContent/get-unsupported-content-level-data';
74
74
  export type { UnsupportedContentTooltipPayload, UnsupportedContentPayload, } from './unsupportedContent/types';
75
75
  export { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
76
76
  export {
@@ -160,7 +160,7 @@ export { FILEPATH_REGEXP } from './FILEPATH_REGEXP';
160
160
  export { LinkMatcher } from './LinkMatcher';
161
161
  export { canLinkBeCreatedInRange } from './canLinkBeCreatedInRange';
162
162
  export { getLinkDomain } from './getLinkDomain';
163
- export { isFromCurrentDomain, linkifyContent, findFilepaths, isLinkInMatches, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent } from './hyperlink';
163
+ export { isFromCurrentDomain, linkifyContent, findFilepaths, isLinkInMatches, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent, } from './hyperlink';
164
164
  export { normalizeUrl } from './normalizeUrl';
165
165
  export declare const pmHistoryPluginKey = "history$";
166
166
  export { gridTypeForLayout } from './grid';
@@ -191,7 +191,7 @@ export { alignAttributes } from './rich-media-utils';
191
191
  export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
192
192
  export { canRenderDatasource } from './datasource';
193
193
  export { getDatasourceType } from './getDatasourceType';
194
- export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode } from './commands';
194
+ export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode, } from './commands';
195
195
  export { insertContentDeleteRange } from './insertContentDeleteRange';
196
196
  export type { WalkNode } from './commands';
197
197
  export { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, GUTTER_SIZE_MOBILE_IN_PX } from './scroll-gutter';
@@ -231,5 +231,3 @@ export { findNodePosByLocalIds } from './nodes-by-localIds';
231
231
  export { getPageElementCounts } from './page-element-counts';
232
232
  export type { PageElementCounts } from './page-element-counts';
233
233
  export { withFeatureFlaggedComponent } from './withFeatureFlaggedComponent';
234
- export { isNodeTypeValidChildOf } from './isNodeTypeValidChildOf';
235
- export { isNodeOfSameBaseType, getBaseNodeTypeName } from './node-type-utils';
@@ -1,4 +1,4 @@
1
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
1
+ import type { NodeType, Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  export declare function getBaseNodeTypeName(nodeType: NodeType): string;
3
3
  /**
4
4
  * Returns true if two node types share the same base type name.
@@ -7,3 +7,17 @@ export declare function getBaseNodeTypeName(nodeType: NodeType): string;
7
7
  * (e.g. `panel` and `panel_c1` are considered the same base type).
8
8
  */
9
9
  export declare function isNodeOfSameBaseType(a: NodeType, b: NodeType): boolean;
10
+ /**
11
+ * Checks if a node type is a valid child of a parent node by creating a minimal valid
12
+ * instance and validating it against the parent's content expression. Unlike ProseMirror's
13
+ * canReplaceWith, this checks general type compatibility without requiring a specific insertion index.
14
+ */
15
+ export declare function isNodeTypeValidChildOf(childTypeName: string, parentNode: PMNode, schema: Schema): boolean;
16
+ /**
17
+ * Picks the appropriate panel NodeType for insertion at the current selection
18
+ * or resolved position.
19
+ *
20
+ * Prefers `panel_c1` when the parent can accept it (e.g. when table-in-panel
21
+ * is supported), falls back to `panel` otherwise or at isolating boundaries.
22
+ */
23
+ export declare function pickPanelTypeForInsertion($from: ResolvedPos): NodeType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "115.7.1",
3
+ "version": "115.7.3",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -81,13 +81,13 @@
81
81
  "@atlaskit/prosemirror-history": "^0.2.0",
82
82
  "@atlaskit/react-ufo": "^6.7.0",
83
83
  "@atlaskit/section-message": "^8.13.0",
84
- "@atlaskit/smart-card": "^44.23.0",
84
+ "@atlaskit/smart-card": "^44.24.0",
85
85
  "@atlaskit/smart-user-picker": "^10.2.0",
86
86
  "@atlaskit/spinner": "^19.1.0",
87
87
  "@atlaskit/task-decision": "^20.1.0",
88
88
  "@atlaskit/teams-app-config": "^1.12.0",
89
89
  "@atlaskit/textfield": "^8.3.0",
90
- "@atlaskit/tmp-editor-statsig": "^90.0.0",
90
+ "@atlaskit/tmp-editor-statsig": "^91.0.0",
91
91
  "@atlaskit/tokens": "^13.3.0",
92
92
  "@atlaskit/tooltip": "^22.6.0",
93
93
  "@atlaskit/width-detector": "^5.1.0",
@@ -128,7 +128,7 @@
128
128
  },
129
129
  "devDependencies": {
130
130
  "@atlaskit/media-core": "^37.1.0",
131
- "@atlassian/a11y-jest-testing": "^0.11.0",
131
+ "@atlassian/a11y-jest-testing": "^0.12.0",
132
132
  "@atlassian/react-compiler-gating": "workspace:^",
133
133
  "@testing-library/dom": "^10.1.0",
134
134
  "@testing-library/jest-dom": "^6.4.5",
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/utils/node-type-utils",
3
+ "main": "../../dist/cjs/utils/node-type-utils.js",
4
+ "module": "../../dist/esm/utils/node-type-utils.js",
5
+ "module:es2019": "../../dist/es2019/utils/node-type-utils.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/utils/node-type-utils.d.ts",
10
+ "typesVersions": {
11
+ ">=4.5 <5.9": {
12
+ "*": [
13
+ "../../dist/types-ts4.5/utils/node-type-utils.d.ts"
14
+ ]
15
+ }
16
+ }
17
+ }