@atlaskit/editor-common 96.3.1 → 96.3.2

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,15 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 96.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#175424](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/175424)
8
+ [`a58e3d02b1639`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a58e3d02b1639) -
9
+ [ux] Fixes position of the Selection/floating toolbar to avoid horizontal scroll when text is
10
+ selected close to the right side of the viewport.
11
+ - Updated dependencies
12
+
3
13
  ## 96.3.1
4
14
 
5
15
  ### Patch 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 = "96.3.1";
20
+ var packageVersion = "96.3.2";
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
@@ -74,7 +74,8 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
74
74
  disabled = _ref.disabled,
75
75
  getEditorWidth = _ref.getEditorWidth,
76
76
  parentRef = _ref.parentRef,
77
- editorAnalyticsApi = _ref.editorAnalyticsApi;
77
+ editorAnalyticsApi = _ref.editorAnalyticsApi,
78
+ displayGapCursor = _ref.displayGapCursor;
78
79
  var _useState = (0, _react.useState)({
79
80
  minWidth: undefined,
80
81
  maxWidth: undefined,
@@ -110,6 +111,7 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
110
111
  var widthState = getEditorWidth();
111
112
  var dispatch = editorView.dispatch,
112
113
  state = editorView.state;
114
+ displayGapCursor(false);
113
115
  if (widthState !== undefined && widthState.lineLength !== undefined && widthState.width !== undefined) {
114
116
  newMinWidth = Math.min(widthState.lineLength, _editorSharedStyles.akEditorDefaultLayoutWidth);
115
117
  newMaxWidth = Math.min(widthState.width - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2 - _editorSharedStyles.akEditorGutterPadding, _editorSharedStyles.akEditorFullWidthLayoutWidth);
@@ -120,7 +122,7 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
120
122
  maxWidth: newMaxWidth
121
123
  });
122
124
  dispatch(state.tr.setMeta('is-resizer-resizing', true));
123
- }, [getEditorWidth, editorView]);
125
+ }, [getEditorWidth, editorView, displayGapCursor]);
124
126
  var handleResizeStop = (0, _react.useCallback)(function (originalState, delta) {
125
127
  var newWidth = originalState.width + delta.width;
126
128
  var pos = getPos();
@@ -150,13 +152,14 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
150
152
  editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
151
153
  }
152
154
  newTr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
155
+ displayGapCursor(true);
153
156
  dispatch(newTr);
154
157
  setResizingState({
155
158
  isResizing: false,
156
159
  minWidth: undefined,
157
160
  maxWidth: undefined
158
161
  });
159
- }, [editorView, getPos, editorAnalyticsApi]);
162
+ }, [getPos, editorView, displayGapCursor, editorAnalyticsApi]);
160
163
  if (disabled) {
161
164
  return /*#__PURE__*/_react.default.createElement("div", {
162
165
  "data-testid": "breakout-resizer-editor-view-wrapper",
@@ -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 = "96.3.1";
27
+ var packageVersion = "96.3.2";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.calculateToolbarPositionTrackHead = exports.calculateToolbarPositionAboveSelection = void 0;
7
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
7
8
  /*
8
9
  Calculates the position of the floating toolbar relative to the selection.
9
10
  This is a re-implementation which closely matches the behaviour on Confluence renderer.
@@ -127,10 +128,18 @@ var calculateToolbarPositionTrackHead = exports.calculateToolbarPositionTrackHea
127
128
  top = _getCoordsBelowSelect2.top;
128
129
  left = _getCoordsBelowSelect2.left;
129
130
  }
131
+ var leftCoord = Math.max(0, left - wrapperBounds.left);
132
+ if ((0, _platformFeatureFlags.fg)('platform_editor_selection_toolbar_scroll_fix')) {
133
+ if (leftCoord + toolbarRect.width > wrapperBounds.width) {
134
+ var scrollbarWidth = 20;
135
+ leftCoord = Math.max(0, wrapperBounds.width - (toolbarRect.width + scrollbarWidth));
136
+ }
137
+ }
138
+
130
139
  // remap positions from browser document to wrapperBounds
131
140
  return {
132
141
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,
133
- left: Math.max(0, left - wrapperBounds.left)
142
+ left: leftCoord
134
143
  };
135
144
  };
136
145
  };
@@ -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 = "96.3.1";
4
+ const packageVersion = "96.3.2";
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
@@ -63,7 +63,8 @@ const BreakoutResizer = ({
63
63
  disabled,
64
64
  getEditorWidth,
65
65
  parentRef,
66
- editorAnalyticsApi
66
+ editorAnalyticsApi,
67
+ displayGapCursor
67
68
  }) => {
68
69
  const [{
69
70
  minWidth,
@@ -101,6 +102,7 @@ const BreakoutResizer = ({
101
102
  dispatch,
102
103
  state
103
104
  } = editorView;
105
+ displayGapCursor(false);
104
106
  if (widthState !== undefined && widthState.lineLength !== undefined && widthState.width !== undefined) {
105
107
  newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth);
106
108
  newMaxWidth = Math.min(widthState.width - akEditorGutterPaddingDynamic() * 2 - akEditorGutterPadding, akEditorFullWidthLayoutWidth);
@@ -111,7 +113,7 @@ const BreakoutResizer = ({
111
113
  maxWidth: newMaxWidth
112
114
  });
113
115
  dispatch(state.tr.setMeta('is-resizer-resizing', true));
114
- }, [getEditorWidth, editorView]);
116
+ }, [getEditorWidth, editorView, displayGapCursor]);
115
117
  const handleResizeStop = useCallback((originalState, delta) => {
116
118
  const newWidth = originalState.width + delta.width;
117
119
  const pos = getPos();
@@ -145,13 +147,14 @@ const BreakoutResizer = ({
145
147
  editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
146
148
  }
147
149
  newTr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
150
+ displayGapCursor(true);
148
151
  dispatch(newTr);
149
152
  setResizingState({
150
153
  isResizing: false,
151
154
  minWidth: undefined,
152
155
  maxWidth: undefined
153
156
  });
154
- }, [editorView, getPos, editorAnalyticsApi]);
157
+ }, [getPos, editorView, displayGapCursor, editorAnalyticsApi]);
155
158
  if (disabled) {
156
159
  return /*#__PURE__*/React.createElement("div", {
157
160
  "data-testid": "breakout-resizer-editor-view-wrapper",
@@ -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 = "96.3.1";
16
+ const packageVersion = "96.3.2";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -1,3 +1,4 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  /*
2
3
  Calculates the position of the floating toolbar relative to the selection.
3
4
  This is a re-implementation which closely matches the behaviour on Confluence renderer.
@@ -122,10 +123,18 @@ export const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, ne
122
123
  left
123
124
  } = getCoordsBelowSelection(bottomCoords, toolbarRect));
124
125
  }
126
+ let leftCoord = Math.max(0, left - wrapperBounds.left);
127
+ if (fg('platform_editor_selection_toolbar_scroll_fix')) {
128
+ if (leftCoord + toolbarRect.width > wrapperBounds.width) {
129
+ const scrollbarWidth = 20;
130
+ leftCoord = Math.max(0, wrapperBounds.width - (toolbarRect.width + scrollbarWidth));
131
+ }
132
+ }
133
+
125
134
  // remap positions from browser document to wrapperBounds
126
135
  return {
127
136
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,
128
- left: Math.max(0, left - wrapperBounds.left)
137
+ left: leftCoord
129
138
  };
130
139
  };
131
140
 
@@ -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 = "96.3.1";
10
+ var packageVersion = "96.3.2";
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
@@ -64,7 +64,8 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
64
64
  disabled = _ref.disabled,
65
65
  getEditorWidth = _ref.getEditorWidth,
66
66
  parentRef = _ref.parentRef,
67
- editorAnalyticsApi = _ref.editorAnalyticsApi;
67
+ editorAnalyticsApi = _ref.editorAnalyticsApi,
68
+ displayGapCursor = _ref.displayGapCursor;
68
69
  var _useState = useState({
69
70
  minWidth: undefined,
70
71
  maxWidth: undefined,
@@ -100,6 +101,7 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
100
101
  var widthState = getEditorWidth();
101
102
  var dispatch = editorView.dispatch,
102
103
  state = editorView.state;
104
+ displayGapCursor(false);
103
105
  if (widthState !== undefined && widthState.lineLength !== undefined && widthState.width !== undefined) {
104
106
  newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth);
105
107
  newMaxWidth = Math.min(widthState.width - akEditorGutterPaddingDynamic() * 2 - akEditorGutterPadding, akEditorFullWidthLayoutWidth);
@@ -110,7 +112,7 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
110
112
  maxWidth: newMaxWidth
111
113
  });
112
114
  dispatch(state.tr.setMeta('is-resizer-resizing', true));
113
- }, [getEditorWidth, editorView]);
115
+ }, [getEditorWidth, editorView, displayGapCursor]);
114
116
  var handleResizeStop = useCallback(function (originalState, delta) {
115
117
  var newWidth = originalState.width + delta.width;
116
118
  var pos = getPos();
@@ -140,13 +142,14 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
140
142
  editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
141
143
  }
142
144
  newTr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
145
+ displayGapCursor(true);
143
146
  dispatch(newTr);
144
147
  setResizingState({
145
148
  isResizing: false,
146
149
  minWidth: undefined,
147
150
  maxWidth: undefined
148
151
  });
149
- }, [editorView, getPos, editorAnalyticsApi]);
152
+ }, [getPos, editorView, displayGapCursor, editorAnalyticsApi]);
150
153
  if (disabled) {
151
154
  return /*#__PURE__*/React.createElement("div", {
152
155
  "data-testid": "breakout-resizer-editor-view-wrapper",
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "96.3.1";
24
+ var packageVersion = "96.3.2";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,3 +1,4 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  /*
2
3
  Calculates the position of the floating toolbar relative to the selection.
3
4
  This is a re-implementation which closely matches the behaviour on Confluence renderer.
@@ -121,10 +122,18 @@ export var calculateToolbarPositionTrackHead = function calculateToolbarPosition
121
122
  top = _getCoordsBelowSelect2.top;
122
123
  left = _getCoordsBelowSelect2.left;
123
124
  }
125
+ var leftCoord = Math.max(0, left - wrapperBounds.left);
126
+ if (fg('platform_editor_selection_toolbar_scroll_fix')) {
127
+ if (leftCoord + toolbarRect.width > wrapperBounds.width) {
128
+ var scrollbarWidth = 20;
129
+ leftCoord = Math.max(0, wrapperBounds.width - (toolbarRect.width + scrollbarWidth));
130
+ }
131
+ }
132
+
124
133
  // remap positions from browser document to wrapperBounds
125
134
  return {
126
135
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,
127
- left: Math.max(0, left - wrapperBounds.left)
136
+ left: leftCoord
128
137
  };
129
138
  };
130
139
  };
@@ -13,7 +13,7 @@ export declare const ignoreResizerMutations: (mutation: MutationRecord | {
13
13
  *
14
14
  * use experiment platform_editor_advanced_layouts
15
15
  */
16
- declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, editorAnalyticsApi, }: {
16
+ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, editorAnalyticsApi, displayGapCursor, }: {
17
17
  editorView: EditorView;
18
18
  nodeType: BreakoutSupportedNodes;
19
19
  getPos: getPosHandlerNode;
@@ -22,5 +22,6 @@ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled
22
22
  getEditorWidth: () => EditorContainerWidth | undefined;
23
23
  parentRef?: HTMLElement | undefined;
24
24
  editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
25
+ displayGapCursor: (toggle: boolean) => boolean;
25
26
  }) => JSX.Element;
26
27
  export { BreakoutResizer };
@@ -13,7 +13,7 @@ export declare const ignoreResizerMutations: (mutation: MutationRecord | {
13
13
  *
14
14
  * use experiment platform_editor_advanced_layouts
15
15
  */
16
- declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, editorAnalyticsApi, }: {
16
+ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled, getEditorWidth, parentRef, editorAnalyticsApi, displayGapCursor, }: {
17
17
  editorView: EditorView;
18
18
  nodeType: BreakoutSupportedNodes;
19
19
  getPos: getPosHandlerNode;
@@ -22,5 +22,6 @@ declare const BreakoutResizer: ({ editorView, nodeType, getPos, getRef, disabled
22
22
  getEditorWidth: () => EditorContainerWidth | undefined;
23
23
  parentRef?: HTMLElement | undefined;
24
24
  editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
25
+ displayGapCursor: (toggle: boolean) => boolean;
25
26
  }) => JSX.Element;
26
27
  export { BreakoutResizer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "96.3.1",
3
+ "version": "96.3.2",
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/"
@@ -142,7 +142,7 @@
142
142
  "@atlaskit/media-viewer": "49.4.4",
143
143
  "@atlaskit/mention": "^23.4.0",
144
144
  "@atlaskit/menu": "^2.13.0",
145
- "@atlaskit/onboarding": "^12.1.0",
145
+ "@atlaskit/onboarding": "^12.2.0",
146
146
  "@atlaskit/platform-feature-flags": "^0.3.0",
147
147
  "@atlaskit/popper": "^6.3.0",
148
148
  "@atlaskit/primitives": "^13.3.0",
@@ -299,6 +299,9 @@
299
299
  },
300
300
  "platform_editor_nested_tables_renderer_styles": {
301
301
  "type": "boolean"
302
+ },
303
+ "platform_editor_selection_toolbar_scroll_fix": {
304
+ "type": "boolean"
302
305
  }
303
306
  }
304
307
  }