@atlaskit/editor-common 100.4.0 → 100.4.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,25 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 100.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#120533](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120533)
8
+ [`f1bec731e278f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f1bec731e278f) -
9
+ Adds a `sideEffects` field to ensure this package does not have Compiled styles tree-shaken in the
10
+ future to avoid an accidental regression.
11
+
12
+ This is related to
13
+ https://community.developer.atlassian.com/t/rfc-73-migrating-our-components-to-compiled-css-in-js/85953
14
+
15
+ - [#120574](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120574)
16
+ [`a5bfdddffd096`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a5bfdddffd096) -
17
+ EDF-2527 Added traceIds in editor ai analytics events fired after getting ai response.
18
+ - [#120675](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120675)
19
+ [`0fae2935821fd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0fae2935821fd) -
20
+ Update expandSelectionBounds to hoist selection to top level when anchor/head depth differs
21
+ - Updated dependencies
22
+
3
23
  ## 100.4.0
4
24
 
5
25
  ### Minor Changes
@@ -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 && {}.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 = "100.4.0";
20
+ var packageVersion = "100.4.1";
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
@@ -11,6 +11,7 @@ exports.endPositionOfParent = endPositionOfParent;
11
11
  exports.isSelectionAtStartOfNode = exports.isSelectionAtEndOfNode = exports.expandSelectionBounds = void 0;
12
12
  exports.startPositionOfParent = startPositionOfParent;
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _selection = require("./gap-cursor/selection");
15
16
  var isSelectionAtStartOfNode = exports.isSelectionAtStartOfNode = function isSelectionAtStartOfNode($pos, parentNode) {
16
17
  if (!parentNode) {
@@ -79,32 +80,58 @@ function startPositionOfParent(resolvedPos) {
79
80
  function endPositionOfParent(resolvedPos) {
80
81
  return resolvedPos.end(resolvedPos.depth) + 1;
81
82
  }
83
+
84
+ /**
85
+ *
86
+ * @param $anchor Resolved selection anchor position
87
+ * @param $head Resolved selection head position
88
+ * @returns An expanded selection encompassing surrounding nodes. Hoists up to the shared depth anchor/head depths differ.
89
+ */
82
90
  var expandSelectionBounds = exports.expandSelectionBounds = function expandSelectionBounds($anchor, $head) {
91
+ var sharedDepth = $anchor.sharedDepth($head.pos) + 1;
83
92
  var $from = $anchor.min($head);
84
93
  var $to = $anchor.max($head);
85
94
  var fromDepth = $from.depth;
86
95
  var toDepth = $to.depth;
87
- var selectionStart = fromDepth ? $from.before() : $from.pos;
88
- var selectionEnd = toDepth ? $to.after() : $to.pos;
96
+ var selectionStart;
97
+ var selectionEnd;
89
98
  var selectionHasGrandparent = toDepth > 1 && fromDepth > 1;
90
99
  var selectionIsAcrossDiffParents = selectionHasGrandparent && !$to.parent.isTextblock && !$to.sameParent($from);
91
100
  var selectionIsAcrossTextBlocksWithDiffParents = selectionHasGrandparent && $to.parent.isTextblock && $to.before(toDepth - 1) !== $from.before(fromDepth - 1);
92
101
  if (toDepth > fromDepth) {
93
- // expand end of selection to after the last node
94
- selectionEnd = fromDepth ? $to.after(fromDepth) : $to.after(1);
102
+ if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
103
+ selectionStart = $from.before(sharedDepth);
104
+ selectionEnd = $to.after(sharedDepth);
105
+ } else {
106
+ selectionStart = fromDepth ? $from.before() : $from.pos;
107
+ selectionEnd = fromDepth ? $to.after(fromDepth) : $to.after(1);
108
+ }
95
109
  } else if (toDepth < fromDepth) {
96
- // expand start of selection to before the current node
97
- selectionStart = toDepth ? $from.before(toDepth) : $from.before(1);
110
+ if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
111
+ selectionStart = $from.before(sharedDepth);
112
+ selectionEnd = $to.after(sharedDepth);
113
+ } else {
114
+ selectionStart = toDepth ? $from.before(toDepth) : $from.before(1);
115
+ selectionEnd = toDepth ? $to.after() : $to.pos;
116
+ }
98
117
  } else if (selectionIsAcrossDiffParents || selectionIsAcrossTextBlocksWithDiffParents) {
99
118
  // when selection from/to share same depth with different parents, hoist up the selection to the parent of the highest depth in the selection
100
- selectionStart = $from.before(fromDepth - 1);
101
- selectionEnd = $to.after(toDepth - 1);
119
+ if ((0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_1')) {
120
+ selectionStart = $from.before(sharedDepth);
121
+ selectionEnd = $to.after(sharedDepth);
122
+ } else {
123
+ selectionStart = $from.before(fromDepth - 1);
124
+ selectionEnd = $to.after(toDepth - 1);
125
+ }
102
126
  } else if (!$from.node().inlineContent) {
103
127
  // when selection might be a Node selection, return what was passed in
104
128
  return {
105
129
  $anchor: $anchor,
106
130
  $head: $head
107
131
  };
132
+ } else {
133
+ selectionStart = fromDepth ? $from.before() : $from.pos;
134
+ selectionEnd = toDepth ? $to.after() : $to.pos;
108
135
  }
109
136
  var $expandedFrom = $anchor.doc.resolve(selectionStart);
110
137
  var $expandedTo = $anchor.doc.resolve(selectionEnd);
@@ -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 = "100.4.0";
26
+ var packageVersion = "100.4.1";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "100.4.0";
4
+ const packageVersion = "100.4.1";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -1,4 +1,5 @@
1
1
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { GapCursorSelection } from './gap-cursor/selection';
3
4
  export const isSelectionAtStartOfNode = ($pos, parentNode) => {
4
5
  if (!parentNode) {
@@ -79,32 +80,58 @@ export function startPositionOfParent(resolvedPos) {
79
80
  export function endPositionOfParent(resolvedPos) {
80
81
  return resolvedPos.end(resolvedPos.depth) + 1;
81
82
  }
83
+
84
+ /**
85
+ *
86
+ * @param $anchor Resolved selection anchor position
87
+ * @param $head Resolved selection head position
88
+ * @returns An expanded selection encompassing surrounding nodes. Hoists up to the shared depth anchor/head depths differ.
89
+ */
82
90
  export const expandSelectionBounds = ($anchor, $head) => {
91
+ const sharedDepth = $anchor.sharedDepth($head.pos) + 1;
83
92
  const $from = $anchor.min($head);
84
93
  const $to = $anchor.max($head);
85
94
  const fromDepth = $from.depth;
86
95
  const toDepth = $to.depth;
87
- let selectionStart = fromDepth ? $from.before() : $from.pos;
88
- let selectionEnd = toDepth ? $to.after() : $to.pos;
96
+ let selectionStart;
97
+ let selectionEnd;
89
98
  const selectionHasGrandparent = toDepth > 1 && fromDepth > 1;
90
99
  const selectionIsAcrossDiffParents = selectionHasGrandparent && !$to.parent.isTextblock && !$to.sameParent($from);
91
100
  const selectionIsAcrossTextBlocksWithDiffParents = selectionHasGrandparent && $to.parent.isTextblock && $to.before(toDepth - 1) !== $from.before(fromDepth - 1);
92
101
  if (toDepth > fromDepth) {
93
- // expand end of selection to after the last node
94
- selectionEnd = fromDepth ? $to.after(fromDepth) : $to.after(1);
102
+ if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
103
+ selectionStart = $from.before(sharedDepth);
104
+ selectionEnd = $to.after(sharedDepth);
105
+ } else {
106
+ selectionStart = fromDepth ? $from.before() : $from.pos;
107
+ selectionEnd = fromDepth ? $to.after(fromDepth) : $to.after(1);
108
+ }
95
109
  } else if (toDepth < fromDepth) {
96
- // expand start of selection to before the current node
97
- selectionStart = toDepth ? $from.before(toDepth) : $from.before(1);
110
+ if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
111
+ selectionStart = $from.before(sharedDepth);
112
+ selectionEnd = $to.after(sharedDepth);
113
+ } else {
114
+ selectionStart = toDepth ? $from.before(toDepth) : $from.before(1);
115
+ selectionEnd = toDepth ? $to.after() : $to.pos;
116
+ }
98
117
  } else if (selectionIsAcrossDiffParents || selectionIsAcrossTextBlocksWithDiffParents) {
99
118
  // when selection from/to share same depth with different parents, hoist up the selection to the parent of the highest depth in the selection
100
- selectionStart = $from.before(fromDepth - 1);
101
- selectionEnd = $to.after(toDepth - 1);
119
+ if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
120
+ selectionStart = $from.before(sharedDepth);
121
+ selectionEnd = $to.after(sharedDepth);
122
+ } else {
123
+ selectionStart = $from.before(fromDepth - 1);
124
+ selectionEnd = $to.after(toDepth - 1);
125
+ }
102
126
  } else if (!$from.node().inlineContent) {
103
127
  // when selection might be a Node selection, return what was passed in
104
128
  return {
105
129
  $anchor,
106
130
  $head
107
131
  };
132
+ } else {
133
+ selectionStart = fromDepth ? $from.before() : $from.pos;
134
+ selectionEnd = toDepth ? $to.after() : $to.pos;
108
135
  }
109
136
  const $expandedFrom = $anchor.doc.resolve(selectionStart);
110
137
  const $expandedTo = $anchor.doc.resolve(selectionEnd);
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "100.4.0";
16
+ const packageVersion = "100.4.1";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "100.4.0";
10
+ var packageVersion = "100.4.1";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -1,4 +1,5 @@
1
1
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { GapCursorSelection } from './gap-cursor/selection';
3
4
  export var isSelectionAtStartOfNode = function isSelectionAtStartOfNode($pos, parentNode) {
4
5
  if (!parentNode) {
@@ -67,32 +68,58 @@ export function startPositionOfParent(resolvedPos) {
67
68
  export function endPositionOfParent(resolvedPos) {
68
69
  return resolvedPos.end(resolvedPos.depth) + 1;
69
70
  }
71
+
72
+ /**
73
+ *
74
+ * @param $anchor Resolved selection anchor position
75
+ * @param $head Resolved selection head position
76
+ * @returns An expanded selection encompassing surrounding nodes. Hoists up to the shared depth anchor/head depths differ.
77
+ */
70
78
  export var expandSelectionBounds = function expandSelectionBounds($anchor, $head) {
79
+ var sharedDepth = $anchor.sharedDepth($head.pos) + 1;
71
80
  var $from = $anchor.min($head);
72
81
  var $to = $anchor.max($head);
73
82
  var fromDepth = $from.depth;
74
83
  var toDepth = $to.depth;
75
- var selectionStart = fromDepth ? $from.before() : $from.pos;
76
- var selectionEnd = toDepth ? $to.after() : $to.pos;
84
+ var selectionStart;
85
+ var selectionEnd;
77
86
  var selectionHasGrandparent = toDepth > 1 && fromDepth > 1;
78
87
  var selectionIsAcrossDiffParents = selectionHasGrandparent && !$to.parent.isTextblock && !$to.sameParent($from);
79
88
  var selectionIsAcrossTextBlocksWithDiffParents = selectionHasGrandparent && $to.parent.isTextblock && $to.before(toDepth - 1) !== $from.before(fromDepth - 1);
80
89
  if (toDepth > fromDepth) {
81
- // expand end of selection to after the last node
82
- selectionEnd = fromDepth ? $to.after(fromDepth) : $to.after(1);
90
+ if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
91
+ selectionStart = $from.before(sharedDepth);
92
+ selectionEnd = $to.after(sharedDepth);
93
+ } else {
94
+ selectionStart = fromDepth ? $from.before() : $from.pos;
95
+ selectionEnd = fromDepth ? $to.after(fromDepth) : $to.after(1);
96
+ }
83
97
  } else if (toDepth < fromDepth) {
84
- // expand start of selection to before the current node
85
- selectionStart = toDepth ? $from.before(toDepth) : $from.before(1);
98
+ if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
99
+ selectionStart = $from.before(sharedDepth);
100
+ selectionEnd = $to.after(sharedDepth);
101
+ } else {
102
+ selectionStart = toDepth ? $from.before(toDepth) : $from.before(1);
103
+ selectionEnd = toDepth ? $to.after() : $to.pos;
104
+ }
86
105
  } else if (selectionIsAcrossDiffParents || selectionIsAcrossTextBlocksWithDiffParents) {
87
106
  // when selection from/to share same depth with different parents, hoist up the selection to the parent of the highest depth in the selection
88
- selectionStart = $from.before(fromDepth - 1);
89
- selectionEnd = $to.after(toDepth - 1);
107
+ if (fg('platform_editor_elements_dnd_multi_select_patch_1')) {
108
+ selectionStart = $from.before(sharedDepth);
109
+ selectionEnd = $to.after(sharedDepth);
110
+ } else {
111
+ selectionStart = $from.before(fromDepth - 1);
112
+ selectionEnd = $to.after(toDepth - 1);
113
+ }
90
114
  } else if (!$from.node().inlineContent) {
91
115
  // when selection might be a Node selection, return what was passed in
92
116
  return {
93
117
  $anchor: $anchor,
94
118
  $head: $head
95
119
  };
120
+ } else {
121
+ selectionStart = fromDepth ? $from.before() : $from.pos;
122
+ selectionEnd = toDepth ? $to.after() : $to.pos;
96
123
  }
97
124
  var $expandedFrom = $anchor.doc.resolve(selectionStart);
98
125
  var $expandedTo = $anchor.doc.resolve(selectionEnd);
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "100.4.0";
23
+ var packageVersion = "100.4.1";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -12,6 +12,7 @@ export type AIUnifiedCommonAttributes = {
12
12
  userGeneratedAI: 0 | 1;
13
13
  isAIFeature: 1;
14
14
  aiExperienceName?: string;
15
+ traceIds?: string[];
15
16
  };
16
17
  type AIInteractionInitiatedAEP = TrackAEP<ACTION.INITIATED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
17
18
  type AIInteractionDismissedAEP = TrackAEP<ACTION.DISMISSED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
@@ -9,6 +9,12 @@ export declare function atTheEndOfBlock(state: EditorState): boolean;
9
9
  export declare function atTheBeginningOfBlock(state: EditorState): boolean;
10
10
  export declare function startPositionOfParent(resolvedPos: ResolvedPos): number;
11
11
  export declare function endPositionOfParent(resolvedPos: ResolvedPos): number;
12
+ /**
13
+ *
14
+ * @param $anchor Resolved selection anchor position
15
+ * @param $head Resolved selection head position
16
+ * @returns An expanded selection encompassing surrounding nodes. Hoists up to the shared depth anchor/head depths differ.
17
+ */
12
18
  export declare const expandSelectionBounds: ($anchor: ResolvedPos, $head: ResolvedPos) => {
13
19
  $anchor: ResolvedPos;
14
20
  $head: ResolvedPos;
@@ -12,6 +12,7 @@ export type AIUnifiedCommonAttributes = {
12
12
  userGeneratedAI: 0 | 1;
13
13
  isAIFeature: 1;
14
14
  aiExperienceName?: string;
15
+ traceIds?: string[];
15
16
  };
16
17
  type AIInteractionInitiatedAEP = TrackAEP<ACTION.INITIATED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
17
18
  type AIInteractionDismissedAEP = TrackAEP<ACTION.DISMISSED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
@@ -9,6 +9,12 @@ export declare function atTheEndOfBlock(state: EditorState): boolean;
9
9
  export declare function atTheBeginningOfBlock(state: EditorState): boolean;
10
10
  export declare function startPositionOfParent(resolvedPos: ResolvedPos): number;
11
11
  export declare function endPositionOfParent(resolvedPos: ResolvedPos): number;
12
+ /**
13
+ *
14
+ * @param $anchor Resolved selection anchor position
15
+ * @param $head Resolved selection head position
16
+ * @returns An expanded selection encompassing surrounding nodes. Hoists up to the shared depth anchor/head depths differ.
17
+ */
12
18
  export declare const expandSelectionBounds: ($anchor: ResolvedPos, $head: ResolvedPos) => {
13
19
  $anchor: ResolvedPos;
14
20
  $head: ResolvedPos;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "100.4.0",
3
+ "version": "100.4.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/"
@@ -144,7 +144,7 @@
144
144
  "@atlaskit/media-file-preview": "^0.11.0",
145
145
  "@atlaskit/media-picker": "^68.0.0",
146
146
  "@atlaskit/media-ui": "^28.0.0",
147
- "@atlaskit/media-viewer": "51.0.1",
147
+ "@atlaskit/media-viewer": "51.0.2",
148
148
  "@atlaskit/mention": "^24.0.0",
149
149
  "@atlaskit/menu": "^3.1.0",
150
150
  "@atlaskit/onboarding": "^13.0.0",
@@ -322,6 +322,9 @@
322
322
  },
323
323
  "platform_editor_nested_tables_column_drag_fix": {
324
324
  "type": "boolean"
325
+ },
326
+ "platform_editor_elements_dnd_multi_select_patch_1": {
327
+ "type": "boolean"
325
328
  }
326
329
  }
327
330
  }