@atlaskit/editor-common 111.27.0 → 111.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 111.28.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`10f36a235eedd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/10f36a235eedd) -
8
+ Extract selection helpers to editor-common
9
+
10
+ ## 111.28.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`17119fb95e0a4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/17119fb95e0a4) -
15
+ [EDITOR-3747](https://hello.jira.atlassian.cloud/browse/EDITOR-3747) - clean up
16
+ platform_editor_ssr_renderer experiment
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 111.27.0
4
23
 
5
24
  ### Minor 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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); 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 = "111.26.0";
22
+ var packageVersion = "111.28.0";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.selectionCoversAllListItems = exports.getSliceFromSelection = exports.getLocalIdsFromSelection = exports.getFragmentsFromSelection = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
10
+ var _model = require("@atlaskit/editor-prosemirror/model");
11
+ var _state = require("@atlaskit/editor-prosemirror/state");
12
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
13
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ var listDepth = 3;
16
+ var selectionCoversAllListItems = exports.selectionCoversAllListItems = function selectionCoversAllListItems($from, $to) {
17
+ // Block level lists
18
+ var listParents = ['bulletList', 'orderedList'];
19
+ if ($from.depth >= listDepth && $to.depth >= listDepth && $from.depth === $to.depth) {
20
+ var _greatGrandparentFrom, _greatGrandparentFrom2;
21
+ // Get grandparents (from)
22
+ var grandparentFrom = $from.node($from.depth - 1);
23
+ var greatGrandparentFrom = $from.node($from.depth - 2);
24
+ // Get grandparents (to)
25
+ var grandparentTo = $to.node($from.depth - 1);
26
+ var greatGrandparentTo = $to.node($from.depth - 2);
27
+ if (greatGrandparentTo.eq(greatGrandparentFrom) && listParents.includes(greatGrandparentFrom.type.name) && // Selection covers entire list
28
+ (_greatGrandparentFrom = greatGrandparentFrom.firstChild) !== null && _greatGrandparentFrom !== void 0 && _greatGrandparentFrom.eq(grandparentFrom) && (_greatGrandparentFrom2 = greatGrandparentFrom.lastChild) !== null && _greatGrandparentFrom2 !== void 0 && _greatGrandparentFrom2.eq(grandparentTo)) {
29
+ return true;
30
+ }
31
+ }
32
+ return false;
33
+ };
34
+
35
+ /**
36
+ * Get the slice of the document corresponding to the selection.
37
+ * This is similar to the prosemirror `selection.content()` - but
38
+ * does not include the parents (unless the result is inline)
39
+ *
40
+ * @param selection The selection to get the slice for.
41
+ * @returns The slice of the document corresponding to the selection.
42
+ */
43
+ var getSliceFromSelection = exports.getSliceFromSelection = function getSliceFromSelection(selection) {
44
+ var from = selection.from,
45
+ to = selection.to;
46
+ if (from === to) {
47
+ return _model.Fragment.empty;
48
+ }
49
+ var frag = _model.Fragment.empty;
50
+ var sortedRanges = (0, _toConsumableArray2.default)(selection.ranges.slice()).sort(function (a, b) {
51
+ return a.$from.pos - b.$from.pos;
52
+ });
53
+ var _iterator = _createForOfIteratorHelper(sortedRanges),
54
+ _step;
55
+ try {
56
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
57
+ var range = _step.value;
58
+ var $from = range.$from,
59
+ $to = range.$to;
60
+ var _to = $to.pos;
61
+ var depth =
62
+ // If we're in a text selection, and share the parent node across the anchor->head
63
+ // make the depth the parent node
64
+ selection instanceof _state.TextSelection && $from.parent.eq($to.parent) ? Math.max(0, $from.sharedDepth(_to) - 1) : $from.sharedDepth(_to);
65
+ var finalDepth = depth;
66
+ // For block-level lists (non-nested) specifically use the selection
67
+ if (selectionCoversAllListItems($from, $to)) {
68
+ finalDepth = $from.depth - listDepth;
69
+ }
70
+ var start = $from.start(finalDepth);
71
+ var node = $from.node(finalDepth);
72
+ var content = node.content.cut($from.pos - start, $to.pos - start);
73
+ frag = frag.append(content);
74
+ }
75
+ } catch (err) {
76
+ _iterator.e(err);
77
+ } finally {
78
+ _iterator.f();
79
+ }
80
+ return frag;
81
+ };
82
+
83
+ /**
84
+ * Get the fragments from the selection.
85
+ * @param selection The selection to get the fragments from.
86
+ * @param schema The schema to use to convert the nodes to JSON.
87
+ * @returns The fragments as an array of JSON nodes.
88
+ */
89
+ var getFragmentsFromSelection = exports.getFragmentsFromSelection = function getFragmentsFromSelection(selection) {
90
+ if (!selection || selection.empty) {
91
+ return null;
92
+ }
93
+ var slice = getSliceFromSelection(selection);
94
+ var content = slice.content;
95
+ var fragment = [];
96
+ content.forEach(function (node) {
97
+ fragment.push((0, _editorJsonTransformer.nodeToJSON)(node));
98
+ });
99
+ return fragment;
100
+ };
101
+
102
+ /**
103
+ * Get the local IDs from the selection.
104
+ * @param selection The selection to get the local IDs from.
105
+ * @returns The local IDs as an array of strings.
106
+ */
107
+ var getLocalIdsFromSelection = exports.getLocalIdsFromSelection = function getLocalIdsFromSelection(selection) {
108
+ if (!selection) {
109
+ return null;
110
+ }
111
+ if (selection instanceof _state.NodeSelection) {
112
+ return [selection.node.attrs.localId];
113
+ } else if (selection.empty) {
114
+ return [selection.$from.parent.attrs.localId];
115
+ }
116
+ var slice = getSliceFromSelection(selection);
117
+ var content = slice.content;
118
+ var ids = [];
119
+ content.forEach(function (node) {
120
+ var _node$attrs;
121
+ var localId = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId;
122
+ if (localId) {
123
+ ids.push(localId);
124
+ }
125
+ });
126
+ return ids;
127
+ };
@@ -96,8 +96,26 @@ Object.defineProperty(exports, "gapCursorStyles", {
96
96
  });
97
97
  exports.getAllSelectionAnalyticsPayload = getAllSelectionAnalyticsPayload;
98
98
  exports.getCellSelectionAnalyticsPayload = getCellSelectionAnalyticsPayload;
99
+ Object.defineProperty(exports, "getFragmentsFromSelection", {
100
+ enumerable: true,
101
+ get: function get() {
102
+ return _contextHelpers.getFragmentsFromSelection;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, "getLocalIdsFromSelection", {
106
+ enumerable: true,
107
+ get: function get() {
108
+ return _contextHelpers.getLocalIdsFromSelection;
109
+ }
110
+ });
99
111
  exports.getNodeSelectionAnalyticsPayload = getNodeSelectionAnalyticsPayload;
100
112
  exports.getRangeSelectionAnalyticsPayload = getRangeSelectionAnalyticsPayload;
113
+ Object.defineProperty(exports, "getSliceFromSelection", {
114
+ enumerable: true,
115
+ get: function get() {
116
+ return _contextHelpers.getSliceFromSelection;
117
+ }
118
+ });
101
119
  Object.defineProperty(exports, "getSourceNodesFromSelectionRange", {
102
120
  enumerable: true,
103
121
  get: function get() {
@@ -189,6 +207,7 @@ var _isValidTargetNode = require("./gap-cursor/utils/is-valid-target-node");
189
207
  var _setGapCursorSelection = require("./gap-cursor/utils/setGapCursorSelection");
190
208
  var _styles = require("./gap-cursor/styles");
191
209
  var _utils2 = require("./utils");
210
+ var _contextHelpers = require("./context-helpers");
192
211
  // Disable no-re-export rule for entry point files
193
212
  /* eslint-disable @atlaskit/editor/no-re-export */
194
213
 
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -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 = "111.26.0";
27
+ var packageVersion = "111.28.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -9,7 +9,6 @@ exports.processRawValueWithoutValidation = processRawValueWithoutValidation;
9
9
  var _transforms = require("@atlaskit/adf-utils/transforms");
10
10
  var _model = require("@atlaskit/editor-prosemirror/model");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
12
  var _analytics = require("../analytics");
14
13
  var _utilities = require("../nesting/utilities");
15
14
  var _privacyFilter = require("./filter/privacy-filter");
@@ -58,7 +57,7 @@ function processRawValueWithoutValidation(schema, value, dispatchAnalyticsEvent)
58
57
  if (typeof value === 'string') {
59
58
  try {
60
59
  node = JSON.parse(value);
61
- } catch (e) {
60
+ } catch (_unused) {
62
61
  // eslint-disable-next-line no-console
63
62
  console.error("Error processing value: ".concat(value, " isn't a valid JSON"));
64
63
  return;
@@ -91,7 +90,7 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
91
90
  } else {
92
91
  node = JSON.parse(value);
93
92
  }
94
- } catch (e) {
93
+ } catch (_unused2) {
95
94
  // eslint-disable-next-line no-console
96
95
  console.error("Error processing value: ".concat(value, " isn't a valid JSON"));
97
96
  return;
@@ -231,25 +230,18 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
231
230
  });
232
231
  }
233
232
  }
234
- var entity;
235
- if ((0, _expValEquals.expValEquals)('platform_editor_ssr_renderer', 'isEnabled', true)) {
236
- // Validate ADF first before converting nested-table extensions into nested tables
237
- // This matches the renderer's behavior in render-document.ts
238
- var allowNestedTables = (0, _utilities.isNestedTablesSupported)(schema);
239
- entity = (0, _validateUsingSpec.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
240
- allowNestedTables: allowNestedTables
241
- } : undefined);
242
233
 
243
- // Convert nested-table extensions into nested tables
244
- var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
245
- transformedAdf = _transformNestedTable3.transformedAdf;
246
- entity = transformedAdf;
247
- } else {
248
- // Convert nested-table extensions into nested tables
249
- var _transformNestedTable4 = transformNestedTablesWithAnalytics(transformedAdf, dispatchAnalyticsEvent);
250
- transformedAdf = _transformNestedTable4.transformedAdf;
251
- entity = (0, _validateUsingSpec.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent);
252
- }
234
+ // Validate ADF first before converting nested-table extensions into nested tables
235
+ // This matches the renderer's behavior in render-document.ts
236
+ var allowNestedTables = (0, _utilities.isNestedTablesSupported)(schema);
237
+ var entity = (0, _validateUsingSpec.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
238
+ allowNestedTables: allowNestedTables
239
+ } : undefined);
240
+
241
+ // Convert nested-table extensions into nested tables
242
+ var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
243
+ transformedAdf = _transformNestedTable3.transformedAdf;
244
+ entity = transformedAdf;
253
245
  var newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
254
246
  var parsedDoc = _model.Node.fromJSON(schema, newEntity);
255
247
 
@@ -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 = "111.26.0";
7
+ const packageVersion = "111.28.0";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -0,0 +1,109 @@
1
+ import { nodeToJSON } from '@atlaskit/editor-json-transformer';
2
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
+ import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
4
+ const listDepth = 3;
5
+ export const selectionCoversAllListItems = ($from, $to) => {
6
+ // Block level lists
7
+ const listParents = ['bulletList', 'orderedList'];
8
+ if ($from.depth >= listDepth && $to.depth >= listDepth && $from.depth === $to.depth) {
9
+ var _greatGrandparentFrom, _greatGrandparentFrom2;
10
+ // Get grandparents (from)
11
+ const grandparentFrom = $from.node($from.depth - 1);
12
+ const greatGrandparentFrom = $from.node($from.depth - 2);
13
+ // Get grandparents (to)
14
+ const grandparentTo = $to.node($from.depth - 1);
15
+ const greatGrandparentTo = $to.node($from.depth - 2);
16
+ if (greatGrandparentTo.eq(greatGrandparentFrom) && listParents.includes(greatGrandparentFrom.type.name) && // Selection covers entire list
17
+ (_greatGrandparentFrom = greatGrandparentFrom.firstChild) !== null && _greatGrandparentFrom !== void 0 && _greatGrandparentFrom.eq(grandparentFrom) && (_greatGrandparentFrom2 = greatGrandparentFrom.lastChild) !== null && _greatGrandparentFrom2 !== void 0 && _greatGrandparentFrom2.eq(grandparentTo)) {
18
+ return true;
19
+ }
20
+ }
21
+ return false;
22
+ };
23
+
24
+ /**
25
+ * Get the slice of the document corresponding to the selection.
26
+ * This is similar to the prosemirror `selection.content()` - but
27
+ * does not include the parents (unless the result is inline)
28
+ *
29
+ * @param selection The selection to get the slice for.
30
+ * @returns The slice of the document corresponding to the selection.
31
+ */
32
+ export const getSliceFromSelection = selection => {
33
+ const {
34
+ from,
35
+ to
36
+ } = selection;
37
+ if (from === to) {
38
+ return Fragment.empty;
39
+ }
40
+ let frag = Fragment.empty;
41
+ const sortedRanges = [...selection.ranges.slice()].sort((a, b) => a.$from.pos - b.$from.pos);
42
+ for (const range of sortedRanges) {
43
+ const {
44
+ $from,
45
+ $to
46
+ } = range;
47
+ const to = $to.pos;
48
+ const depth =
49
+ // If we're in a text selection, and share the parent node across the anchor->head
50
+ // make the depth the parent node
51
+ selection instanceof TextSelection && $from.parent.eq($to.parent) ? Math.max(0, $from.sharedDepth(to) - 1) : $from.sharedDepth(to);
52
+ let finalDepth = depth;
53
+ // For block-level lists (non-nested) specifically use the selection
54
+ if (selectionCoversAllListItems($from, $to)) {
55
+ finalDepth = $from.depth - listDepth;
56
+ }
57
+ const start = $from.start(finalDepth);
58
+ const node = $from.node(finalDepth);
59
+ const content = node.content.cut($from.pos - start, $to.pos - start);
60
+ frag = frag.append(content);
61
+ }
62
+ return frag;
63
+ };
64
+
65
+ /**
66
+ * Get the fragments from the selection.
67
+ * @param selection The selection to get the fragments from.
68
+ * @param schema The schema to use to convert the nodes to JSON.
69
+ * @returns The fragments as an array of JSON nodes.
70
+ */
71
+ export const getFragmentsFromSelection = selection => {
72
+ if (!selection || selection.empty) {
73
+ return null;
74
+ }
75
+ const slice = getSliceFromSelection(selection);
76
+ const content = slice.content;
77
+ const fragment = [];
78
+ content.forEach(node => {
79
+ fragment.push(nodeToJSON(node));
80
+ });
81
+ return fragment;
82
+ };
83
+
84
+ /**
85
+ * Get the local IDs from the selection.
86
+ * @param selection The selection to get the local IDs from.
87
+ * @returns The local IDs as an array of strings.
88
+ */
89
+ export const getLocalIdsFromSelection = selection => {
90
+ if (!selection) {
91
+ return null;
92
+ }
93
+ if (selection instanceof NodeSelection) {
94
+ return [selection.node.attrs.localId];
95
+ } else if (selection.empty) {
96
+ return [selection.$from.parent.attrs.localId];
97
+ }
98
+ const slice = getSliceFromSelection(selection);
99
+ const content = slice.content;
100
+ const ids = [];
101
+ content.forEach(node => {
102
+ var _node$attrs;
103
+ const localId = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId;
104
+ if (localId) {
105
+ ids.push(localId);
106
+ }
107
+ });
108
+ return ids;
109
+ };
@@ -13,6 +13,7 @@ export { isValidTargetNode } from './gap-cursor/utils/is-valid-target-node';
13
13
  export { setGapCursorSelection } from './gap-cursor/utils/setGapCursorSelection';
14
14
  export { hideCaretModifier, gapCursorStyles } from './gap-cursor/styles';
15
15
  export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, deleteSelectedRange, endPositionOfParent, expandSelectionBounds, expandSelectionToBlockRange, expandToBlockRange, getSourceNodesFromSelectionRange, isMultiBlockRange, isMultiBlockSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode, selectionIsAtTheBeginningOfBlock, startPositionOfParent } from './utils';
16
+ export { getSliceFromSelection, getFragmentsFromSelection, getLocalIdsFromSelection } from './context-helpers';
16
17
  export function getNodeSelectionAnalyticsPayload(selection) {
17
18
  if (selection instanceof NodeSelection) {
18
19
  return {
@@ -0,0 +1 @@
1
+ export {};
@@ -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 = "111.26.0";
17
+ const packageVersion = "111.28.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -1,7 +1,6 @@
1
1
  import { syncBlockFallbackTransform, transformDedupeMarks, transformIndentationMarks, transformInvalidMediaContent, transformMediaLinkMarks, transformNestedTablesIncomingDocument, transformNodesMissingContent, transformTextLinkCodeMarks, transformMediaSingleWidth } from '@atlaskit/adf-utils/transforms';
2
2
  import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
4
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
6
5
  import { isNestedTablesSupported } from '../nesting/utilities';
7
6
  import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
@@ -51,7 +50,7 @@ export function processRawValueWithoutValidation(schema, value, dispatchAnalytic
51
50
  if (typeof value === 'string') {
52
51
  try {
53
52
  node = JSON.parse(value);
54
- } catch (e) {
53
+ } catch {
55
54
  // eslint-disable-next-line no-console
56
55
  console.error(`Error processing value: ${value} isn't a valid JSON`);
57
56
  return;
@@ -85,7 +84,7 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
85
84
  } else {
86
85
  node = JSON.parse(value);
87
86
  }
88
- } catch (e) {
87
+ } catch {
89
88
  // eslint-disable-next-line no-console
90
89
  console.error(`Error processing value: ${value} isn't a valid JSON`);
91
90
  return;
@@ -230,27 +229,19 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
230
229
  });
231
230
  }
232
231
  }
233
- let entity;
234
- if (expValEquals('platform_editor_ssr_renderer', 'isEnabled', true)) {
235
- // Validate ADF first before converting nested-table extensions into nested tables
236
- // This matches the renderer's behavior in render-document.ts
237
- const allowNestedTables = isNestedTablesSupported(schema);
238
- entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
239
- allowNestedTables
240
- } : undefined);
241
232
 
242
- // Convert nested-table extensions into nested tables
243
- ({
244
- transformedAdf
245
- } = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent));
246
- entity = transformedAdf;
247
- } else {
248
- // Convert nested-table extensions into nested tables
249
- ({
250
- transformedAdf
251
- } = transformNestedTablesWithAnalytics(transformedAdf, dispatchAnalyticsEvent));
252
- entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
253
- }
233
+ // Validate ADF first before converting nested-table extensions into nested tables
234
+ // This matches the renderer's behavior in render-document.ts
235
+ const allowNestedTables = isNestedTablesSupported(schema);
236
+ let entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
237
+ allowNestedTables
238
+ } : undefined);
239
+
240
+ // Convert nested-table extensions into nested tables
241
+ ({
242
+ transformedAdf
243
+ } = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent));
244
+ entity = transformedAdf;
254
245
  const newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
255
246
  const parsedDoc = Node.fromJSON(schema, newEntity);
256
247
 
@@ -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 = "111.26.0";
13
+ var packageVersion = "111.28.0";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -0,0 +1,120 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ import { nodeToJSON } from '@atlaskit/editor-json-transformer';
6
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
7
+ import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
8
+ var listDepth = 3;
9
+ export var selectionCoversAllListItems = function selectionCoversAllListItems($from, $to) {
10
+ // Block level lists
11
+ var listParents = ['bulletList', 'orderedList'];
12
+ if ($from.depth >= listDepth && $to.depth >= listDepth && $from.depth === $to.depth) {
13
+ var _greatGrandparentFrom, _greatGrandparentFrom2;
14
+ // Get grandparents (from)
15
+ var grandparentFrom = $from.node($from.depth - 1);
16
+ var greatGrandparentFrom = $from.node($from.depth - 2);
17
+ // Get grandparents (to)
18
+ var grandparentTo = $to.node($from.depth - 1);
19
+ var greatGrandparentTo = $to.node($from.depth - 2);
20
+ if (greatGrandparentTo.eq(greatGrandparentFrom) && listParents.includes(greatGrandparentFrom.type.name) && // Selection covers entire list
21
+ (_greatGrandparentFrom = greatGrandparentFrom.firstChild) !== null && _greatGrandparentFrom !== void 0 && _greatGrandparentFrom.eq(grandparentFrom) && (_greatGrandparentFrom2 = greatGrandparentFrom.lastChild) !== null && _greatGrandparentFrom2 !== void 0 && _greatGrandparentFrom2.eq(grandparentTo)) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ };
27
+
28
+ /**
29
+ * Get the slice of the document corresponding to the selection.
30
+ * This is similar to the prosemirror `selection.content()` - but
31
+ * does not include the parents (unless the result is inline)
32
+ *
33
+ * @param selection The selection to get the slice for.
34
+ * @returns The slice of the document corresponding to the selection.
35
+ */
36
+ export var getSliceFromSelection = function getSliceFromSelection(selection) {
37
+ var from = selection.from,
38
+ to = selection.to;
39
+ if (from === to) {
40
+ return Fragment.empty;
41
+ }
42
+ var frag = Fragment.empty;
43
+ var sortedRanges = _toConsumableArray(selection.ranges.slice()).sort(function (a, b) {
44
+ return a.$from.pos - b.$from.pos;
45
+ });
46
+ var _iterator = _createForOfIteratorHelper(sortedRanges),
47
+ _step;
48
+ try {
49
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
50
+ var range = _step.value;
51
+ var $from = range.$from,
52
+ $to = range.$to;
53
+ var _to = $to.pos;
54
+ var depth =
55
+ // If we're in a text selection, and share the parent node across the anchor->head
56
+ // make the depth the parent node
57
+ selection instanceof TextSelection && $from.parent.eq($to.parent) ? Math.max(0, $from.sharedDepth(_to) - 1) : $from.sharedDepth(_to);
58
+ var finalDepth = depth;
59
+ // For block-level lists (non-nested) specifically use the selection
60
+ if (selectionCoversAllListItems($from, $to)) {
61
+ finalDepth = $from.depth - listDepth;
62
+ }
63
+ var start = $from.start(finalDepth);
64
+ var node = $from.node(finalDepth);
65
+ var content = node.content.cut($from.pos - start, $to.pos - start);
66
+ frag = frag.append(content);
67
+ }
68
+ } catch (err) {
69
+ _iterator.e(err);
70
+ } finally {
71
+ _iterator.f();
72
+ }
73
+ return frag;
74
+ };
75
+
76
+ /**
77
+ * Get the fragments from the selection.
78
+ * @param selection The selection to get the fragments from.
79
+ * @param schema The schema to use to convert the nodes to JSON.
80
+ * @returns The fragments as an array of JSON nodes.
81
+ */
82
+ export var getFragmentsFromSelection = function getFragmentsFromSelection(selection) {
83
+ if (!selection || selection.empty) {
84
+ return null;
85
+ }
86
+ var slice = getSliceFromSelection(selection);
87
+ var content = slice.content;
88
+ var fragment = [];
89
+ content.forEach(function (node) {
90
+ fragment.push(nodeToJSON(node));
91
+ });
92
+ return fragment;
93
+ };
94
+
95
+ /**
96
+ * Get the local IDs from the selection.
97
+ * @param selection The selection to get the local IDs from.
98
+ * @returns The local IDs as an array of strings.
99
+ */
100
+ export var getLocalIdsFromSelection = function getLocalIdsFromSelection(selection) {
101
+ if (!selection) {
102
+ return null;
103
+ }
104
+ if (selection instanceof NodeSelection) {
105
+ return [selection.node.attrs.localId];
106
+ } else if (selection.empty) {
107
+ return [selection.$from.parent.attrs.localId];
108
+ }
109
+ var slice = getSliceFromSelection(selection);
110
+ var content = slice.content;
111
+ var ids = [];
112
+ content.forEach(function (node) {
113
+ var _node$attrs;
114
+ var localId = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId;
115
+ if (localId) {
116
+ ids.push(localId);
117
+ }
118
+ });
119
+ return ids;
120
+ };
@@ -13,6 +13,7 @@ export { isValidTargetNode } from './gap-cursor/utils/is-valid-target-node';
13
13
  export { setGapCursorSelection } from './gap-cursor/utils/setGapCursorSelection';
14
14
  export { hideCaretModifier, gapCursorStyles } from './gap-cursor/styles';
15
15
  export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, deleteSelectedRange, endPositionOfParent, expandSelectionBounds, expandSelectionToBlockRange, expandToBlockRange, getSourceNodesFromSelectionRange, isMultiBlockRange, isMultiBlockSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode, selectionIsAtTheBeginningOfBlock, startPositionOfParent } from './utils';
16
+ export { getSliceFromSelection, getFragmentsFromSelection, getLocalIdsFromSelection } from './context-helpers';
16
17
  export function getNodeSelectionAnalyticsPayload(selection) {
17
18
  if (selection instanceof NodeSelection) {
18
19
  return {
@@ -0,0 +1 @@
1
+ export {};
@@ -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 = "111.26.0";
24
+ var packageVersion = "111.28.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,7 +1,6 @@
1
1
  import { syncBlockFallbackTransform, transformDedupeMarks, transformIndentationMarks, transformInvalidMediaContent, transformMediaLinkMarks, transformNestedTablesIncomingDocument, transformNodesMissingContent, transformTextLinkCodeMarks, transformMediaSingleWidth } from '@atlaskit/adf-utils/transforms';
2
2
  import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
4
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
6
5
  import { isNestedTablesSupported } from '../nesting/utilities';
7
6
  import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
@@ -50,7 +49,7 @@ export function processRawValueWithoutValidation(schema, value, dispatchAnalytic
50
49
  if (typeof value === 'string') {
51
50
  try {
52
51
  node = JSON.parse(value);
53
- } catch (e) {
52
+ } catch (_unused) {
54
53
  // eslint-disable-next-line no-console
55
54
  console.error("Error processing value: ".concat(value, " isn't a valid JSON"));
56
55
  return;
@@ -83,7 +82,7 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
83
82
  } else {
84
83
  node = JSON.parse(value);
85
84
  }
86
- } catch (e) {
85
+ } catch (_unused2) {
87
86
  // eslint-disable-next-line no-console
88
87
  console.error("Error processing value: ".concat(value, " isn't a valid JSON"));
89
88
  return;
@@ -223,25 +222,18 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
223
222
  });
224
223
  }
225
224
  }
226
- var entity;
227
- if (expValEquals('platform_editor_ssr_renderer', 'isEnabled', true)) {
228
- // Validate ADF first before converting nested-table extensions into nested tables
229
- // This matches the renderer's behavior in render-document.ts
230
- var allowNestedTables = isNestedTablesSupported(schema);
231
- entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
232
- allowNestedTables: allowNestedTables
233
- } : undefined);
234
225
 
235
- // Convert nested-table extensions into nested tables
236
- var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
237
- transformedAdf = _transformNestedTable3.transformedAdf;
238
- entity = transformedAdf;
239
- } else {
240
- // Convert nested-table extensions into nested tables
241
- var _transformNestedTable4 = transformNestedTablesWithAnalytics(transformedAdf, dispatchAnalyticsEvent);
242
- transformedAdf = _transformNestedTable4.transformedAdf;
243
- entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
244
- }
226
+ // Validate ADF first before converting nested-table extensions into nested tables
227
+ // This matches the renderer's behavior in render-document.ts
228
+ var allowNestedTables = isNestedTablesSupported(schema);
229
+ var entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, allowNestedTables ? {
230
+ allowNestedTables: allowNestedTables
231
+ } : undefined);
232
+
233
+ // Convert nested-table extensions into nested tables
234
+ var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
235
+ transformedAdf = _transformNestedTable3.transformedAdf;
236
+ entity = transformedAdf;
245
237
  var newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
246
238
  var parsedDoc = Node.fromJSON(schema, newEntity);
247
239
 
@@ -0,0 +1,27 @@
1
+ import { type JSONNode } from '@atlaskit/editor-json-transformer';
2
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
4
+ import { type Selection } from '@atlaskit/editor-prosemirror/state';
5
+ export declare const selectionCoversAllListItems: ($from: ResolvedPos, $to: ResolvedPos) => boolean;
6
+ /**
7
+ * Get the slice of the document corresponding to the selection.
8
+ * This is similar to the prosemirror `selection.content()` - but
9
+ * does not include the parents (unless the result is inline)
10
+ *
11
+ * @param selection The selection to get the slice for.
12
+ * @returns The slice of the document corresponding to the selection.
13
+ */
14
+ export declare const getSliceFromSelection: (selection: Selection) => Fragment;
15
+ /**
16
+ * Get the fragments from the selection.
17
+ * @param selection The selection to get the fragments from.
18
+ * @param schema The schema to use to convert the nodes to JSON.
19
+ * @returns The fragments as an array of JSON nodes.
20
+ */
21
+ export declare const getFragmentsFromSelection: (selection?: Selection) => JSONNode[] | null;
22
+ /**
23
+ * Get the local IDs from the selection.
24
+ * @param selection The selection to get the local IDs from.
25
+ * @returns The local IDs as an array of strings.
26
+ */
27
+ export declare const getLocalIdsFromSelection: (selection?: Selection) => string[] | null;
@@ -12,6 +12,7 @@ export { isValidTargetNode } from './gap-cursor/utils/is-valid-target-node';
12
12
  export { setGapCursorSelection } from './gap-cursor/utils/setGapCursorSelection';
13
13
  export { hideCaretModifier, gapCursorStyles } from './gap-cursor/styles';
14
14
  export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, deleteSelectedRange, endPositionOfParent, expandSelectionBounds, expandSelectionToBlockRange, expandToBlockRange, getSourceNodesFromSelectionRange, isMultiBlockRange, isMultiBlockSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode, selectionIsAtTheBeginningOfBlock, startPositionOfParent, } from './utils';
15
+ export { getSliceFromSelection, getFragmentsFromSelection, getLocalIdsFromSelection } from './context-helpers';
15
16
  export declare function getNodeSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
16
17
  export declare function getAllSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
17
18
  export declare function getCellSelectionAnalyticsPayload(state: EditorState): AnalyticsEventPayload | undefined;
@@ -42,7 +42,7 @@ export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper } from './input
42
42
  export type { TOOLBAR_MENU_TYPE } from './insert-block';
43
43
  export type { TextFormattingOptions, TextFormattingState, InputMethodToolbar, InputMethodBasic, } from './text-formatting';
44
44
  export type { LayoutPluginOptions } from './layout';
45
- export type { LongPressSelectionPluginOptions } from './selection';
45
+ export type { LongPressSelectionPluginOptions, SelectionContext } from './selection';
46
46
  export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, QuickInsertHandlerFn, } from './quick-insert';
47
47
  export type { Refs, RefsNode, DocBuilder } from './doc-builder';
48
48
  export type { SelectionToolbarGroup, SelectionToolbarHandler } from './selection-toolbar';
@@ -1,3 +1,29 @@
1
+ import type { JSONNode } from '@atlaskit/editor-json-transformer';
1
2
  export interface LongPressSelectionPluginOptions {
2
3
  useLongPressSelection?: boolean;
3
4
  }
5
+ export type SelectionContext = {
6
+ /**
7
+ * End index of the selection inside the last node of the selection
8
+ */
9
+ endIndex?: number | null;
10
+ /**
11
+ * Local IDs of the selected nodes
12
+ */
13
+ localIds: string[] | null;
14
+ /**
15
+ * Prosemirror fragment of the selection converted to JSONNode array
16
+ *
17
+ * Note that this is a direct Prosemirror Fragment and has some slight tweaks
18
+ * so it performs better with AI models (e.g. reduced depth to reduce token count).
19
+ */
20
+ selectionFragment: JSONNode[] | null;
21
+ /**
22
+ * Selection in markdown format
23
+ */
24
+ selectionMarkdown: string | null;
25
+ /**
26
+ * Start index of the selection inside the first node of the selection
27
+ */
28
+ startIndex?: number | null;
29
+ };
@@ -0,0 +1,27 @@
1
+ import { type JSONNode } from '@atlaskit/editor-json-transformer';
2
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
4
+ import { type Selection } from '@atlaskit/editor-prosemirror/state';
5
+ export declare const selectionCoversAllListItems: ($from: ResolvedPos, $to: ResolvedPos) => boolean;
6
+ /**
7
+ * Get the slice of the document corresponding to the selection.
8
+ * This is similar to the prosemirror `selection.content()` - but
9
+ * does not include the parents (unless the result is inline)
10
+ *
11
+ * @param selection The selection to get the slice for.
12
+ * @returns The slice of the document corresponding to the selection.
13
+ */
14
+ export declare const getSliceFromSelection: (selection: Selection) => Fragment;
15
+ /**
16
+ * Get the fragments from the selection.
17
+ * @param selection The selection to get the fragments from.
18
+ * @param schema The schema to use to convert the nodes to JSON.
19
+ * @returns The fragments as an array of JSON nodes.
20
+ */
21
+ export declare const getFragmentsFromSelection: (selection?: Selection) => JSONNode[] | null;
22
+ /**
23
+ * Get the local IDs from the selection.
24
+ * @param selection The selection to get the local IDs from.
25
+ * @returns The local IDs as an array of strings.
26
+ */
27
+ export declare const getLocalIdsFromSelection: (selection?: Selection) => string[] | null;
@@ -12,6 +12,7 @@ export { isValidTargetNode } from './gap-cursor/utils/is-valid-target-node';
12
12
  export { setGapCursorSelection } from './gap-cursor/utils/setGapCursorSelection';
13
13
  export { hideCaretModifier, gapCursorStyles } from './gap-cursor/styles';
14
14
  export { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, atTheEndOfDoc, deleteSelectedRange, endPositionOfParent, expandSelectionBounds, expandSelectionToBlockRange, expandToBlockRange, getSourceNodesFromSelectionRange, isMultiBlockRange, isMultiBlockSelection, isSelectionAtEndOfNode, isSelectionAtStartOfNode, selectionIsAtTheBeginningOfBlock, startPositionOfParent, } from './utils';
15
+ export { getSliceFromSelection, getFragmentsFromSelection, getLocalIdsFromSelection } from './context-helpers';
15
16
  export declare function getNodeSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
16
17
  export declare function getAllSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
17
18
  export declare function getCellSelectionAnalyticsPayload(state: EditorState): AnalyticsEventPayload | undefined;
@@ -42,7 +42,7 @@ export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper } from './input
42
42
  export type { TOOLBAR_MENU_TYPE } from './insert-block';
43
43
  export type { TextFormattingOptions, TextFormattingState, InputMethodToolbar, InputMethodBasic, } from './text-formatting';
44
44
  export type { LayoutPluginOptions } from './layout';
45
- export type { LongPressSelectionPluginOptions } from './selection';
45
+ export type { LongPressSelectionPluginOptions, SelectionContext } from './selection';
46
46
  export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, QuickInsertHandlerFn, } from './quick-insert';
47
47
  export type { Refs, RefsNode, DocBuilder } from './doc-builder';
48
48
  export type { SelectionToolbarGroup, SelectionToolbarHandler } from './selection-toolbar';
@@ -1,3 +1,29 @@
1
+ import type { JSONNode } from '@atlaskit/editor-json-transformer';
1
2
  export interface LongPressSelectionPluginOptions {
2
3
  useLongPressSelection?: boolean;
3
4
  }
5
+ export type SelectionContext = {
6
+ /**
7
+ * End index of the selection inside the last node of the selection
8
+ */
9
+ endIndex?: number | null;
10
+ /**
11
+ * Local IDs of the selected nodes
12
+ */
13
+ localIds: string[] | null;
14
+ /**
15
+ * Prosemirror fragment of the selection converted to JSONNode array
16
+ *
17
+ * Note that this is a direct Prosemirror Fragment and has some slight tweaks
18
+ * so it performs better with AI models (e.g. reduced depth to reduce token count).
19
+ */
20
+ selectionFragment: JSONNode[] | null;
21
+ /**
22
+ * Selection in markdown format
23
+ */
24
+ selectionMarkdown: string | null;
25
+ /**
26
+ * Start index of the selection inside the first node of the selection
27
+ */
28
+ startIndex?: number | null;
29
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "111.27.0",
3
+ "version": "111.28.1",
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/"
@@ -71,7 +71,7 @@
71
71
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
72
72
  "@atlaskit/popper": "^7.1.0",
73
73
  "@atlaskit/primitives": "^18.0.0",
74
- "@atlaskit/profilecard": "^24.39.0",
74
+ "@atlaskit/profilecard": "^24.40.0",
75
75
  "@atlaskit/prosemirror-history": "^0.2.0",
76
76
  "@atlaskit/react-ufo": "^5.4.0",
77
77
  "@atlaskit/section-message": "^8.12.0",
@@ -82,7 +82,7 @@
82
82
  "@atlaskit/task-decision": "^19.3.0",
83
83
  "@atlaskit/textfield": "^8.2.0",
84
84
  "@atlaskit/theme": "^22.0.0",
85
- "@atlaskit/tmp-editor-statsig": "^33.1.0",
85
+ "@atlaskit/tmp-editor-statsig": "^33.2.0",
86
86
  "@atlaskit/tokens": "^11.0.0",
87
87
  "@atlaskit/tooltip": "^20.14.0",
88
88
  "@atlaskit/width-detector": "^5.0.0",