@atlaskit/renderer 118.6.6 → 118.6.8

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/renderer
2
2
 
3
+ ## 118.6.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#166323](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/166323)
8
+ [`51519a7335b4d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51519a7335b4d) -
9
+ [ux] Remove 1px margin top from inline macro wrapper that is causing hydration shift
10
+ - Updated dependencies
11
+
12
+ ## 118.6.7
13
+
14
+ ### Patch Changes
15
+
16
+ - [#165439](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165439)
17
+ [`1b15e228a1e86`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1b15e228a1e86) -
18
+ Fixed an issue which meant the new annotation manager still realied on a FG to be enabled when in
19
+ fact it should be enabled if an instance of the manager is supplied. Thie removed all dependencies
20
+ relying on the FG.
21
+
3
22
  ## 118.6.6
4
23
 
5
24
  ### Patch Changes
@@ -19,21 +19,18 @@ var _utils = require("@atlaskit/editor-common/utils");
19
19
  */
20
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
21
21
 
22
- // When running on server-side emotion will generate style tags before elements.
23
- // This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
24
- // However as soon as the styles are extracted to <head> it adds back the margin.
25
- // The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
26
- // This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
27
- var forceMarginTopStyle = (0, _react.css)({
28
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
29
- marginTop: "1px !important"
30
- });
31
22
  var inlineExtensionStyle = (0, _react.css)({
32
23
  display: 'inline-block',
33
24
  maxWidth: '100%',
34
25
  verticalAlign: 'middle',
26
+ // 0px margin top is important here.
27
+ // When running on server-side emotion will generate style tags before elements.
28
+ // This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
29
+ // However as soon as the styles are extracted to <head> it adds back the margin.
30
+ // The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
31
+ // This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
35
32
  // es-lint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
36
- margin: "1px 1px ".concat("var(--ds-space-050, 4px)"),
33
+ margin: "0px 1px ".concat("var(--ds-space-050, 4px)"),
37
34
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
38
35
  '& .rich-media-item': {
39
36
  maxWidth: '100%'
@@ -137,12 +134,10 @@ function ExtensionRenderer(props) {
137
134
  });
138
135
  }
139
136
  var InlineNodeRendererWrapper = exports.InlineNodeRendererWrapper = function InlineNodeRendererWrapper(_ref) {
140
- var _ref$forceMarginTop = _ref.forceMarginTop,
141
- forceMarginTop = _ref$forceMarginTop === void 0 ? false : _ref$forceMarginTop,
142
- children = _ref.children;
137
+ var children = _ref.children;
143
138
  return (0, _react.jsx)("div", {
144
139
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
145
140
  className: "inline-extension-renderer",
146
- css: [inlineExtensionStyle, forceMarginTop && forceMarginTopStyle]
141
+ css: inlineExtensionStyle
147
142
  }, children);
148
143
  };
@@ -62,7 +62,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
62
62
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
63
63
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
64
64
  var packageName = "@atlaskit/renderer";
65
- var packageVersion = "118.6.6";
65
+ var packageVersion = "118.6.8";
66
66
  var setAsQueryContainerStyles = (0, _react2.css)({
67
67
  containerName: 'ak-renderer-wrapper',
68
68
  containerType: 'inline-size'
@@ -128,9 +128,11 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
128
128
  return (0, _toConsumableArray2.default)(new Set([].concat((0, _toConsumableArray2.default)(annotationParentIds), [id])));
129
129
  }, [id, annotationParentIds]);
130
130
  var _useAnnotationManager = (0, _AnnotationManagerContext.useAnnotationManagerDispatch)(),
131
+ annotationManager = _useAnnotationManager.annotationManager,
131
132
  dispatch = _useAnnotationManager.dispatch;
132
133
  var _useAnnotationManager2 = (0, _AnnotationManagerContext.useAnnotationManagerState)(),
133
134
  currentSelectedAnnotationId = _useAnnotationManager2.currentSelectedAnnotationId;
135
+ var isAnnotationManagerEnabled = !!annotationManager;
134
136
 
135
137
  // after creating a new annotation, we need to set the markRef to the new mark
136
138
  var markRef = (0, _react.useCallback)(function (node) {
@@ -169,7 +171,7 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
169
171
  // prevents from opening link URL inside webView in Safari
170
172
  event.preventDefault();
171
173
  }
172
- if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
174
+ if (isAnnotationManagerEnabled) {
173
175
  // currentTarget is the right element if there are multiple overlapping annotations
174
176
  // Ignored via go/ees005
175
177
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -185,7 +187,7 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
185
187
  annotationIds: annotationIds
186
188
  });
187
189
  }
188
- }, [annotationIds, onClick, state]);
190
+ }, [annotationIds, onClick, state, isAnnotationManagerEnabled]);
189
191
  var onMarkEnter = function onMarkEnter(evt) {
190
192
  var _document$activeEleme;
191
193
  var focusedElementTag = (_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.tagName;
@@ -12,7 +12,6 @@ var _types = require("@atlaskit/editor-common/types");
12
12
  var _adfSchema = require("@atlaskit/adf-schema");
13
13
  var _analytics = require("@atlaskit/editor-common/analytics");
14
14
  var _types2 = require("@atlaskit/analytics-listeners/types");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _AnnotationManagerContext = require("../contexts/AnnotationManagerContext");
17
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -24,9 +23,11 @@ var useAnnotationStateByTypeEvent = exports.useAnnotationStateByTypeEvent = func
24
23
  states = _useState2[0],
25
24
  setStates = _useState2[1];
26
25
  var _useAnnotationManager = (0, _AnnotationManagerContext.useAnnotationManagerDispatch)(),
26
+ annotationManager = _useAnnotationManager.annotationManager,
27
27
  dispatch = _useAnnotationManager.dispatch;
28
28
  var _useAnnotationManager2 = (0, _AnnotationManagerContext.useAnnotationManagerState)(),
29
29
  annotations = _useAnnotationManager2.annotations;
30
+ var isAnnotationManagerEnabled = !!annotationManager;
30
31
  (0, _react.useLayoutEffect)(function () {
31
32
  if (!updateSubscriber) {
32
33
  return;
@@ -45,19 +46,19 @@ var useAnnotationStateByTypeEvent = exports.useAnnotationStateByTypeEvent = func
45
46
  }, {});
46
47
  setStates(_objectSpread(_objectSpread({}, states), nextStates));
47
48
  };
48
- if (!(0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
49
+ if (!isAnnotationManagerEnabled) {
49
50
  updateSubscriber.on(_types.AnnotationUpdateEvent.SET_ANNOTATION_STATE, cb);
50
51
  return function () {
51
52
  updateSubscriber.off(_types.AnnotationUpdateEvent.SET_ANNOTATION_STATE, cb);
52
53
  };
53
54
  }
54
- }, [states, type, updateSubscriber, dispatch]);
55
+ }, [states, type, updateSubscriber, dispatch, isAnnotationManagerEnabled]);
55
56
  var annotationMarkStates = (0, _react.useMemo)(function () {
56
57
  return Object.values(annotations).reduce(function (acc, curr) {
57
58
  return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, curr.id, curr.markState));
58
59
  }, {});
59
60
  }, [annotations]);
60
- if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
61
+ if (isAnnotationManagerEnabled) {
61
62
  return annotationMarkStates;
62
63
  } else {
63
64
  return states;
@@ -77,6 +78,9 @@ var useHasFocusEvent = exports.useHasFocusEvent = function useHasFocusEvent(_ref
77
78
  var _useAnnotationManager3 = (0, _AnnotationManagerContext.useAnnotationManagerState)(),
78
79
  currentSelectedAnnotationId = _useAnnotationManager3.currentSelectedAnnotationId,
79
80
  currentHoveredAnnotationId = _useAnnotationManager3.currentHoveredAnnotationId;
81
+ var _useAnnotationManager4 = (0, _AnnotationManagerContext.useAnnotationManagerDispatch)(),
82
+ annotationManager = _useAnnotationManager4.annotationManager;
83
+ var isAnnotationManagerEnabled = !!annotationManager;
80
84
  (0, _react.useLayoutEffect)(function () {
81
85
  if (!updateSubscriber) {
82
86
  return;
@@ -99,7 +103,7 @@ var useHasFocusEvent = exports.useHasFocusEvent = function useHasFocusEvent(_ref
99
103
  document.activeElement.blur();
100
104
  }
101
105
  };
102
- if (!(0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
106
+ if (!isAnnotationManagerEnabled) {
103
107
  updateSubscriber.on(_types.AnnotationUpdateEvent.SET_ANNOTATION_FOCUS, cb);
104
108
  updateSubscriber.on(_types.AnnotationUpdateEvent.SET_ANNOTATION_HOVERED, callbackForHoveredAnnotation);
105
109
  updateSubscriber.on(_types.AnnotationUpdateEvent.REMOVE_ANNOTATION_FOCUS, removeFocus);
@@ -111,8 +115,8 @@ var useHasFocusEvent = exports.useHasFocusEvent = function useHasFocusEvent(_ref
111
115
  updateSubscriber.off(_types.AnnotationUpdateEvent.SET_ANNOTATION_HOVERED, removeHoverEffect);
112
116
  };
113
117
  }
114
- }, [id, updateSubscriber]);
115
- if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
118
+ }, [id, updateSubscriber, isAnnotationManagerEnabled]);
119
+ if (isAnnotationManagerEnabled) {
116
120
  return {
117
121
  hasFocus: currentSelectedAnnotationId === id,
118
122
  isHovered: currentHoveredAnnotationId === id
@@ -136,9 +140,12 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
136
140
  var updateSubscriber = props.updateSubscriber,
137
141
  createAnalyticsEvent = props.createAnalyticsEvent,
138
142
  isNestedRender = props.isNestedRender;
139
- var _useAnnotationManager4 = (0, _AnnotationManagerContext.useAnnotationManagerState)(),
140
- currentSelectedAnnotationId = _useAnnotationManager4.currentSelectedAnnotationId,
141
- currentSelectedMarkRef = _useAnnotationManager4.currentSelectedMarkRef;
143
+ var _useAnnotationManager5 = (0, _AnnotationManagerContext.useAnnotationManagerDispatch)(),
144
+ annotationManager = _useAnnotationManager5.annotationManager;
145
+ var isAnnotationManagerEnabled = !!annotationManager;
146
+ var _useAnnotationManager6 = (0, _AnnotationManagerContext.useAnnotationManagerState)(),
147
+ currentSelectedAnnotationId = _useAnnotationManager6.currentSelectedAnnotationId,
148
+ currentSelectedMarkRef = _useAnnotationManager6.currentSelectedMarkRef;
142
149
  var selectedAnnotation = (0, _react.useMemo)(function () {
143
150
  return currentSelectedAnnotationId && currentSelectedMarkRef && currentSelectedMarkRef.id === currentSelectedAnnotationId ? {
144
151
  annotations: [{
@@ -196,7 +203,7 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
196
203
  document.activeElement.blur();
197
204
  }
198
205
  };
199
- if (!(0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
206
+ if (!isAnnotationManagerEnabled) {
200
207
  updateSubscriber.on(_types.AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
201
208
  updateSubscriber.on(_types.AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
202
209
  return function () {
@@ -204,8 +211,8 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
204
211
  updateSubscriber.off(_types.AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
205
212
  };
206
213
  }
207
- }, [updateSubscriber, createAnalyticsEvent, isNestedRender]);
208
- if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
214
+ }, [updateSubscriber, createAnalyticsEvent, isNestedRender, isAnnotationManagerEnabled]);
215
+ if (isAnnotationManagerEnabled) {
209
216
  return isNestedRender ? null : selectedAnnotation;
210
217
  } else {
211
218
  return annotationClickEvent;
@@ -21,7 +21,9 @@ var useLoadAnnotations = exports.useLoadAnnotations = function useLoadAnnotation
21
21
  var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
22
22
  var providers = (0, _react.useContext)(_context.ProvidersContext);
23
23
  var _useAnnotationManager = (0, _AnnotationManagerContext.useAnnotationManagerDispatch)(),
24
+ annotationManager = _useAnnotationManager.annotationManager,
24
25
  dispatch = _useAnnotationManager.dispatch;
26
+ var isAnnotationManagerEnabled = !!annotationManager;
25
27
  (0, _react.useEffect)(function () {
26
28
  if (!providers) {
27
29
  return;
@@ -51,7 +53,7 @@ var useLoadAnnotations = exports.useLoadAnnotations = function useLoadAnnotation
51
53
  var payload = data.reduce(function (acc, value) {
52
54
  return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, value.id, value));
53
55
  }, {});
54
- if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
56
+ if (isAnnotationManagerEnabled) {
55
57
  dispatch({
56
58
  type: 'loadAnnotation',
57
59
  data: Object.keys(payload).map(function (id) {
@@ -72,5 +74,5 @@ var useLoadAnnotations = exports.useLoadAnnotations = function useLoadAnnotation
72
74
  });
73
75
  };
74
76
  inlineCommentGetState(ids, isNestedRender).then(cb);
75
- }, [actions, providers, adfDocument, isNestedRender, onLoadComplete, dispatch]);
77
+ }, [actions, providers, adfDocument, isNestedRender, onLoadComplete, dispatch, isAnnotationManagerEnabled]);
76
78
  };
@@ -9,6 +9,7 @@ var _AnnotationRangeContext = require("../contexts/AnnotationRangeContext");
9
9
  var _utils = require("./utils");
10
10
  var _steps = require("../../../steps");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _AnnotationManagerContext = require("../contexts/AnnotationManagerContext");
12
13
  var useUserSelectionRange = exports.useUserSelectionRange = function useUserSelectionRange(props) {
13
14
  var rendererDOM = props.rendererRef.current;
14
15
  var selectionTimeoutRef = (0, _react.useRef)();
@@ -19,7 +20,10 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
19
20
  range = _useAnnotationRangeSt.range,
20
21
  type = _useAnnotationRangeSt.type,
21
22
  selectionDraftRange = _useAnnotationRangeSt.selectionDraftRange;
23
+ var _useAnnotationManager = (0, _AnnotationManagerContext.useAnnotationManagerDispatch)(),
24
+ annotationManager = _useAnnotationManager.annotationManager;
22
25
  var lastRangeRef = (0, _react.useRef)(null);
26
+ var isAnnotationManagerEnabled = !!annotationManager;
23
27
  var onSelectionChange = (0, _react.useCallback)(function (event) {
24
28
  if ((0, _platformFeatureFlags.fg)('platform_renderer_triple_click_selects_paragraph')) {
25
29
  if (selectionTimeoutRef.current) {
@@ -29,7 +33,7 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
29
33
  var sel = document.getSelection();
30
34
  if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
31
35
  lastRangeRef.current = null; // Clear last range if selection is invalid
32
- if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
36
+ if (isAnnotationManagerEnabled) {
33
37
  clearSelectionRange();
34
38
  }
35
39
  return;
@@ -69,7 +73,7 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
69
73
  selectionTimeoutRef.current = setTimeout(function () {
70
74
  var sel = document.getSelection();
71
75
  if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
72
- if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
76
+ if (isAnnotationManagerEnabled) {
73
77
  clearSelectionRange();
74
78
  }
75
79
  return;
@@ -106,7 +110,7 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
106
110
  }
107
111
  }, 250);
108
112
  }
109
- }, [rendererDOM, setSelectionRange, clearSelectionRange]);
113
+ }, [rendererDOM, setSelectionRange, clearSelectionRange, isAnnotationManagerEnabled]);
110
114
  (0, _react.useEffect)(function () {
111
115
  if (!document || !rendererDOM) {
112
116
  return;
@@ -9,21 +9,18 @@ import memoizeOne from 'memoize-one';
9
9
  import { getNodeRenderer } from '@atlaskit/editor-common/extensions';
10
10
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
11
11
  import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
12
- // When running on server-side emotion will generate style tags before elements.
13
- // This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
14
- // However as soon as the styles are extracted to <head> it adds back the margin.
15
- // The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
16
- // This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
17
- const forceMarginTopStyle = css({
18
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
19
- marginTop: `1px !important`
20
- });
21
12
  const inlineExtensionStyle = css({
22
13
  display: 'inline-block',
23
14
  maxWidth: '100%',
24
15
  verticalAlign: 'middle',
16
+ // 0px margin top is important here.
17
+ // When running on server-side emotion will generate style tags before elements.
18
+ // This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
19
+ // However as soon as the styles are extracted to <head> it adds back the margin.
20
+ // The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
21
+ // This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
25
22
  // es-lint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
26
- margin: `1px 1px ${"var(--ds-space-050, 4px)"}`,
23
+ margin: `0px 1px ${"var(--ds-space-050, 4px)"}`,
27
24
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
28
25
  '& .rich-media-item': {
29
26
  maxWidth: '100%'
@@ -122,12 +119,11 @@ export default function ExtensionRenderer(props) {
122
119
  });
123
120
  }
124
121
  export const InlineNodeRendererWrapper = ({
125
- forceMarginTop = false,
126
122
  children
127
123
  }) => {
128
124
  return jsx("div", {
129
125
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
130
126
  className: "inline-extension-renderer",
131
- css: [inlineExtensionStyle, forceMarginTop && forceMarginTopStyle]
127
+ css: inlineExtensionStyle
132
128
  }, children);
133
129
  };
@@ -48,7 +48,7 @@ import { PortalContext } from './PortalContext';
48
48
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
49
49
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
50
50
  const packageName = "@atlaskit/renderer";
51
- const packageVersion = "118.6.6";
51
+ const packageVersion = "118.6.8";
52
52
  const setAsQueryContainerStyles = css({
53
53
  containerName: 'ak-renderer-wrapper',
54
54
  containerType: 'inline-size'
@@ -133,11 +133,13 @@ export const MarkComponent = ({
133
133
  const intl = useIntl();
134
134
  const annotationIds = useMemo(() => [...new Set([...annotationParentIds, id])], [id, annotationParentIds]);
135
135
  const {
136
+ annotationManager,
136
137
  dispatch
137
138
  } = useAnnotationManagerDispatch();
138
139
  const {
139
140
  currentSelectedAnnotationId
140
141
  } = useAnnotationManagerState();
142
+ const isAnnotationManagerEnabled = !!annotationManager;
141
143
 
142
144
  // after creating a new annotation, we need to set the markRef to the new mark
143
145
  const markRef = useCallback(node => {
@@ -176,7 +178,7 @@ export const MarkComponent = ({
176
178
  // prevents from opening link URL inside webView in Safari
177
179
  event.preventDefault();
178
180
  }
179
- if (fg('platform_editor_comments_api_manager')) {
181
+ if (isAnnotationManagerEnabled) {
180
182
  // currentTarget is the right element if there are multiple overlapping annotations
181
183
  // Ignored via go/ees005
182
184
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -192,7 +194,7 @@ export const MarkComponent = ({
192
194
  annotationIds
193
195
  });
194
196
  }
195
- }, [annotationIds, onClick, state]);
197
+ }, [annotationIds, onClick, state, isAnnotationManagerEnabled]);
196
198
  const onMarkEnter = evt => {
197
199
  var _document$activeEleme;
198
200
  const focusedElementTag = (_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.tagName;
@@ -3,7 +3,6 @@ import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
3
3
  import { AnnotationTypes } from '@atlaskit/adf-schema';
4
4
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
5
5
  import { FabricChannel } from '@atlaskit/analytics-listeners/types';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
8
7
  export const useAnnotationStateByTypeEvent = ({
9
8
  type,
@@ -11,11 +10,13 @@ export const useAnnotationStateByTypeEvent = ({
11
10
  }) => {
12
11
  const [states, setStates] = useState({});
13
12
  const {
13
+ annotationManager,
14
14
  dispatch
15
15
  } = useAnnotationManagerDispatch();
16
16
  const {
17
17
  annotations
18
18
  } = useAnnotationManagerState();
19
+ const isAnnotationManagerEnabled = !!annotationManager;
19
20
  useLayoutEffect(() => {
20
21
  if (!updateSubscriber) {
21
22
  return;
@@ -40,13 +41,13 @@ export const useAnnotationStateByTypeEvent = ({
40
41
  ...nextStates
41
42
  });
42
43
  };
43
- if (!fg('platform_editor_comments_api_manager')) {
44
+ if (!isAnnotationManagerEnabled) {
44
45
  updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_STATE, cb);
45
46
  return () => {
46
47
  updateSubscriber.off(AnnotationUpdateEvent.SET_ANNOTATION_STATE, cb);
47
48
  };
48
49
  }
49
- }, [states, type, updateSubscriber, dispatch]);
50
+ }, [states, type, updateSubscriber, dispatch, isAnnotationManagerEnabled]);
50
51
  const annotationMarkStates = useMemo(() => {
51
52
  return Object.values(annotations).reduce((acc, curr) => {
52
53
  return {
@@ -55,7 +56,7 @@ export const useAnnotationStateByTypeEvent = ({
55
56
  };
56
57
  }, {});
57
58
  }, [annotations]);
58
- if (fg('platform_editor_comments_api_manager')) {
59
+ if (isAnnotationManagerEnabled) {
59
60
  return annotationMarkStates;
60
61
  } else {
61
62
  return states;
@@ -71,6 +72,10 @@ export const useHasFocusEvent = ({
71
72
  currentSelectedAnnotationId,
72
73
  currentHoveredAnnotationId
73
74
  } = useAnnotationManagerState();
75
+ const {
76
+ annotationManager
77
+ } = useAnnotationManagerDispatch();
78
+ const isAnnotationManagerEnabled = !!annotationManager;
74
79
  useLayoutEffect(() => {
75
80
  if (!updateSubscriber) {
76
81
  return;
@@ -93,7 +98,7 @@ export const useHasFocusEvent = ({
93
98
  document.activeElement.blur();
94
99
  }
95
100
  };
96
- if (!fg('platform_editor_comments_api_manager')) {
101
+ if (!isAnnotationManagerEnabled) {
97
102
  updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_FOCUS, cb);
98
103
  updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_HOVERED, callbackForHoveredAnnotation);
99
104
  updateSubscriber.on(AnnotationUpdateEvent.REMOVE_ANNOTATION_FOCUS, removeFocus);
@@ -105,8 +110,8 @@ export const useHasFocusEvent = ({
105
110
  updateSubscriber.off(AnnotationUpdateEvent.SET_ANNOTATION_HOVERED, removeHoverEffect);
106
111
  };
107
112
  }
108
- }, [id, updateSubscriber]);
109
- if (fg('platform_editor_comments_api_manager')) {
113
+ }, [id, updateSubscriber, isAnnotationManagerEnabled]);
114
+ if (isAnnotationManagerEnabled) {
110
115
  return {
111
116
  hasFocus: currentSelectedAnnotationId === id,
112
117
  isHovered: currentHoveredAnnotationId === id
@@ -129,6 +134,10 @@ export const useAnnotationClickEvent = props => {
129
134
  createAnalyticsEvent,
130
135
  isNestedRender
131
136
  } = props;
137
+ const {
138
+ annotationManager
139
+ } = useAnnotationManagerDispatch();
140
+ const isAnnotationManagerEnabled = !!annotationManager;
132
141
  const {
133
142
  currentSelectedAnnotationId,
134
143
  currentSelectedMarkRef
@@ -187,7 +196,7 @@ export const useAnnotationClickEvent = props => {
187
196
  document.activeElement.blur();
188
197
  }
189
198
  };
190
- if (!fg('platform_editor_comments_api_manager')) {
199
+ if (!isAnnotationManagerEnabled) {
191
200
  updateSubscriber.on(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
192
201
  updateSubscriber.on(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
193
202
  return () => {
@@ -195,8 +204,8 @@ export const useAnnotationClickEvent = props => {
195
204
  updateSubscriber.off(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
196
205
  };
197
206
  }
198
- }, [updateSubscriber, createAnalyticsEvent, isNestedRender]);
199
- if (fg('platform_editor_comments_api_manager')) {
207
+ }, [updateSubscriber, createAnalyticsEvent, isNestedRender, isAnnotationManagerEnabled]);
208
+ if (isAnnotationManagerEnabled) {
200
209
  return isNestedRender ? null : selectedAnnotation;
201
210
  } else {
202
211
  return annotationClickEvent;
@@ -12,8 +12,10 @@ export const useLoadAnnotations = ({
12
12
  const actions = useContext(ActionsContext);
13
13
  const providers = useContext(ProvidersContext);
14
14
  const {
15
+ annotationManager,
15
16
  dispatch
16
17
  } = useAnnotationManagerDispatch();
18
+ const isAnnotationManagerEnabled = !!annotationManager;
17
19
  useEffect(() => {
18
20
  if (!providers) {
19
21
  return;
@@ -45,7 +47,7 @@ export const useLoadAnnotations = ({
45
47
  ...acc,
46
48
  [value.id]: value
47
49
  }), {});
48
- if (fg('platform_editor_comments_api_manager')) {
50
+ if (isAnnotationManagerEnabled) {
49
51
  dispatch({
50
52
  type: 'loadAnnotation',
51
53
  data: Object.keys(payload).map(id => {
@@ -64,5 +66,5 @@ export const useLoadAnnotations = ({
64
66
  });
65
67
  };
66
68
  inlineCommentGetState(ids, isNestedRender).then(cb);
67
- }, [actions, providers, adfDocument, isNestedRender, onLoadComplete, dispatch]);
69
+ }, [actions, providers, adfDocument, isNestedRender, onLoadComplete, dispatch, isAnnotationManagerEnabled]);
68
70
  };
@@ -3,6 +3,7 @@ import { useAnnotationRangeDispatch, useAnnotationRangeState } from '../contexts
3
3
  import { isRangeInsideOfRendererContainer } from './utils';
4
4
  import { isRoot } from '../../../steps';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { useAnnotationManagerDispatch } from '../contexts/AnnotationManagerContext';
6
7
  export const useUserSelectionRange = props => {
7
8
  const {
8
9
  rendererRef: {
@@ -19,7 +20,11 @@ export const useUserSelectionRange = props => {
19
20
  type,
20
21
  selectionDraftRange
21
22
  } = useAnnotationRangeState();
23
+ const {
24
+ annotationManager
25
+ } = useAnnotationManagerDispatch();
22
26
  const lastRangeRef = useRef(null);
27
+ const isAnnotationManagerEnabled = !!annotationManager;
23
28
  const onSelectionChange = useCallback(event => {
24
29
  if (fg('platform_renderer_triple_click_selects_paragraph')) {
25
30
  if (selectionTimeoutRef.current) {
@@ -29,7 +34,7 @@ export const useUserSelectionRange = props => {
29
34
  const sel = document.getSelection();
30
35
  if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
31
36
  lastRangeRef.current = null; // Clear last range if selection is invalid
32
- if (fg('platform_editor_comments_api_manager')) {
37
+ if (isAnnotationManagerEnabled) {
33
38
  clearSelectionRange();
34
39
  }
35
40
  return;
@@ -70,7 +75,7 @@ export const useUserSelectionRange = props => {
70
75
  selectionTimeoutRef.current = setTimeout(() => {
71
76
  const sel = document.getSelection();
72
77
  if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
73
- if (fg('platform_editor_comments_api_manager')) {
78
+ if (isAnnotationManagerEnabled) {
74
79
  clearSelectionRange();
75
80
  }
76
81
  return;
@@ -109,7 +114,7 @@ export const useUserSelectionRange = props => {
109
114
  }
110
115
  }, 250);
111
116
  }
112
- }, [rendererDOM, setSelectionRange, clearSelectionRange]);
117
+ }, [rendererDOM, setSelectionRange, clearSelectionRange, isAnnotationManagerEnabled]);
113
118
  useEffect(() => {
114
119
  if (!document || !rendererDOM) {
115
120
  return;
@@ -10,21 +10,18 @@ import memoizeOne from 'memoize-one';
10
10
  import { getNodeRenderer } from '@atlaskit/editor-common/extensions';
11
11
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
12
12
  import { getExtensionRenderer } from '@atlaskit/editor-common/utils';
13
- // When running on server-side emotion will generate style tags before elements.
14
- // This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
15
- // However as soon as the styles are extracted to <head> it adds back the margin.
16
- // The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
17
- // This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
18
- var forceMarginTopStyle = css({
19
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
20
- marginTop: "1px !important"
21
- });
22
13
  var inlineExtensionStyle = css({
23
14
  display: 'inline-block',
24
15
  maxWidth: '100%',
25
16
  verticalAlign: 'middle',
17
+ // 0px margin top is important here.
18
+ // When running on server-side emotion will generate style tags before elements.
19
+ // This caused packages/editor/editor-common/src/styles/shared/block-marks.ts to override the margin-top.
20
+ // However as soon as the styles are extracted to <head> it adds back the margin.
21
+ // The timing is tricky as it happens to be when UFO collects the dimension for the placeholder for TTVC calculation.
22
+ // This resulted 1px mismatch on the image. Further cause everything on page to shift by 1px.
26
23
  // es-lint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
27
- margin: "1px 1px ".concat("var(--ds-space-050, 4px)"),
24
+ margin: "0px 1px ".concat("var(--ds-space-050, 4px)"),
28
25
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
29
26
  '& .rich-media-item': {
30
27
  maxWidth: '100%'
@@ -128,12 +125,10 @@ export default function ExtensionRenderer(props) {
128
125
  });
129
126
  }
130
127
  export var InlineNodeRendererWrapper = function InlineNodeRendererWrapper(_ref) {
131
- var _ref$forceMarginTop = _ref.forceMarginTop,
132
- forceMarginTop = _ref$forceMarginTop === void 0 ? false : _ref$forceMarginTop,
133
- children = _ref.children;
128
+ var children = _ref.children;
134
129
  return jsx("div", {
135
130
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
136
131
  className: "inline-extension-renderer",
137
- css: [inlineExtensionStyle, forceMarginTop && forceMarginTopStyle]
132
+ css: inlineExtensionStyle
138
133
  }, children);
139
134
  };
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
53
53
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
54
54
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
55
55
  var packageName = "@atlaskit/renderer";
56
- var packageVersion = "118.6.6";
56
+ var packageVersion = "118.6.8";
57
57
  var setAsQueryContainerStyles = css({
58
58
  containerName: 'ak-renderer-wrapper',
59
59
  containerType: 'inline-size'
@@ -124,9 +124,11 @@ export var MarkComponent = function MarkComponent(_ref) {
124
124
  return _toConsumableArray(new Set([].concat(_toConsumableArray(annotationParentIds), [id])));
125
125
  }, [id, annotationParentIds]);
126
126
  var _useAnnotationManager = useAnnotationManagerDispatch(),
127
+ annotationManager = _useAnnotationManager.annotationManager,
127
128
  dispatch = _useAnnotationManager.dispatch;
128
129
  var _useAnnotationManager2 = useAnnotationManagerState(),
129
130
  currentSelectedAnnotationId = _useAnnotationManager2.currentSelectedAnnotationId;
131
+ var isAnnotationManagerEnabled = !!annotationManager;
130
132
 
131
133
  // after creating a new annotation, we need to set the markRef to the new mark
132
134
  var markRef = useCallback(function (node) {
@@ -165,7 +167,7 @@ export var MarkComponent = function MarkComponent(_ref) {
165
167
  // prevents from opening link URL inside webView in Safari
166
168
  event.preventDefault();
167
169
  }
168
- if (fg('platform_editor_comments_api_manager')) {
170
+ if (isAnnotationManagerEnabled) {
169
171
  // currentTarget is the right element if there are multiple overlapping annotations
170
172
  // Ignored via go/ees005
171
173
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -181,7 +183,7 @@ export var MarkComponent = function MarkComponent(_ref) {
181
183
  annotationIds: annotationIds
182
184
  });
183
185
  }
184
- }, [annotationIds, onClick, state]);
186
+ }, [annotationIds, onClick, state, isAnnotationManagerEnabled]);
185
187
  var onMarkEnter = function onMarkEnter(evt) {
186
188
  var _document$activeEleme;
187
189
  var focusedElementTag = (_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.tagName;
@@ -7,7 +7,6 @@ import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
7
7
  import { AnnotationTypes } from '@atlaskit/adf-schema';
8
8
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
9
9
  import { FabricChannel } from '@atlaskit/analytics-listeners/types';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
12
11
  export var useAnnotationStateByTypeEvent = function useAnnotationStateByTypeEvent(_ref) {
13
12
  var type = _ref.type,
@@ -17,9 +16,11 @@ export var useAnnotationStateByTypeEvent = function useAnnotationStateByTypeEven
17
16
  states = _useState2[0],
18
17
  setStates = _useState2[1];
19
18
  var _useAnnotationManager = useAnnotationManagerDispatch(),
19
+ annotationManager = _useAnnotationManager.annotationManager,
20
20
  dispatch = _useAnnotationManager.dispatch;
21
21
  var _useAnnotationManager2 = useAnnotationManagerState(),
22
22
  annotations = _useAnnotationManager2.annotations;
23
+ var isAnnotationManagerEnabled = !!annotationManager;
23
24
  useLayoutEffect(function () {
24
25
  if (!updateSubscriber) {
25
26
  return;
@@ -38,19 +39,19 @@ export var useAnnotationStateByTypeEvent = function useAnnotationStateByTypeEven
38
39
  }, {});
39
40
  setStates(_objectSpread(_objectSpread({}, states), nextStates));
40
41
  };
41
- if (!fg('platform_editor_comments_api_manager')) {
42
+ if (!isAnnotationManagerEnabled) {
42
43
  updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_STATE, cb);
43
44
  return function () {
44
45
  updateSubscriber.off(AnnotationUpdateEvent.SET_ANNOTATION_STATE, cb);
45
46
  };
46
47
  }
47
- }, [states, type, updateSubscriber, dispatch]);
48
+ }, [states, type, updateSubscriber, dispatch, isAnnotationManagerEnabled]);
48
49
  var annotationMarkStates = useMemo(function () {
49
50
  return Object.values(annotations).reduce(function (acc, curr) {
50
51
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, curr.id, curr.markState));
51
52
  }, {});
52
53
  }, [annotations]);
53
- if (fg('platform_editor_comments_api_manager')) {
54
+ if (isAnnotationManagerEnabled) {
54
55
  return annotationMarkStates;
55
56
  } else {
56
57
  return states;
@@ -70,6 +71,9 @@ export var useHasFocusEvent = function useHasFocusEvent(_ref2) {
70
71
  var _useAnnotationManager3 = useAnnotationManagerState(),
71
72
  currentSelectedAnnotationId = _useAnnotationManager3.currentSelectedAnnotationId,
72
73
  currentHoveredAnnotationId = _useAnnotationManager3.currentHoveredAnnotationId;
74
+ var _useAnnotationManager4 = useAnnotationManagerDispatch(),
75
+ annotationManager = _useAnnotationManager4.annotationManager;
76
+ var isAnnotationManagerEnabled = !!annotationManager;
73
77
  useLayoutEffect(function () {
74
78
  if (!updateSubscriber) {
75
79
  return;
@@ -92,7 +96,7 @@ export var useHasFocusEvent = function useHasFocusEvent(_ref2) {
92
96
  document.activeElement.blur();
93
97
  }
94
98
  };
95
- if (!fg('platform_editor_comments_api_manager')) {
99
+ if (!isAnnotationManagerEnabled) {
96
100
  updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_FOCUS, cb);
97
101
  updateSubscriber.on(AnnotationUpdateEvent.SET_ANNOTATION_HOVERED, callbackForHoveredAnnotation);
98
102
  updateSubscriber.on(AnnotationUpdateEvent.REMOVE_ANNOTATION_FOCUS, removeFocus);
@@ -104,8 +108,8 @@ export var useHasFocusEvent = function useHasFocusEvent(_ref2) {
104
108
  updateSubscriber.off(AnnotationUpdateEvent.SET_ANNOTATION_HOVERED, removeHoverEffect);
105
109
  };
106
110
  }
107
- }, [id, updateSubscriber]);
108
- if (fg('platform_editor_comments_api_manager')) {
111
+ }, [id, updateSubscriber, isAnnotationManagerEnabled]);
112
+ if (isAnnotationManagerEnabled) {
109
113
  return {
110
114
  hasFocus: currentSelectedAnnotationId === id,
111
115
  isHovered: currentHoveredAnnotationId === id
@@ -129,9 +133,12 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
129
133
  var updateSubscriber = props.updateSubscriber,
130
134
  createAnalyticsEvent = props.createAnalyticsEvent,
131
135
  isNestedRender = props.isNestedRender;
132
- var _useAnnotationManager4 = useAnnotationManagerState(),
133
- currentSelectedAnnotationId = _useAnnotationManager4.currentSelectedAnnotationId,
134
- currentSelectedMarkRef = _useAnnotationManager4.currentSelectedMarkRef;
136
+ var _useAnnotationManager5 = useAnnotationManagerDispatch(),
137
+ annotationManager = _useAnnotationManager5.annotationManager;
138
+ var isAnnotationManagerEnabled = !!annotationManager;
139
+ var _useAnnotationManager6 = useAnnotationManagerState(),
140
+ currentSelectedAnnotationId = _useAnnotationManager6.currentSelectedAnnotationId,
141
+ currentSelectedMarkRef = _useAnnotationManager6.currentSelectedMarkRef;
135
142
  var selectedAnnotation = useMemo(function () {
136
143
  return currentSelectedAnnotationId && currentSelectedMarkRef && currentSelectedMarkRef.id === currentSelectedAnnotationId ? {
137
144
  annotations: [{
@@ -189,7 +196,7 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
189
196
  document.activeElement.blur();
190
197
  }
191
198
  };
192
- if (!fg('platform_editor_comments_api_manager')) {
199
+ if (!isAnnotationManagerEnabled) {
193
200
  updateSubscriber.on(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
194
201
  updateSubscriber.on(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
195
202
  return function () {
@@ -197,8 +204,8 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
197
204
  updateSubscriber.off(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
198
205
  };
199
206
  }
200
- }, [updateSubscriber, createAnalyticsEvent, isNestedRender]);
201
- if (fg('platform_editor_comments_api_manager')) {
207
+ }, [updateSubscriber, createAnalyticsEvent, isNestedRender, isAnnotationManagerEnabled]);
208
+ if (isAnnotationManagerEnabled) {
202
209
  return isNestedRender ? null : selectedAnnotation;
203
210
  } else {
204
211
  return annotationClickEvent;
@@ -14,7 +14,9 @@ export var useLoadAnnotations = function useLoadAnnotations(_ref) {
14
14
  var actions = useContext(ActionsContext);
15
15
  var providers = useContext(ProvidersContext);
16
16
  var _useAnnotationManager = useAnnotationManagerDispatch(),
17
+ annotationManager = _useAnnotationManager.annotationManager,
17
18
  dispatch = _useAnnotationManager.dispatch;
19
+ var isAnnotationManagerEnabled = !!annotationManager;
18
20
  useEffect(function () {
19
21
  if (!providers) {
20
22
  return;
@@ -44,7 +46,7 @@ export var useLoadAnnotations = function useLoadAnnotations(_ref) {
44
46
  var payload = data.reduce(function (acc, value) {
45
47
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, value.id, value));
46
48
  }, {});
47
- if (fg('platform_editor_comments_api_manager')) {
49
+ if (isAnnotationManagerEnabled) {
48
50
  dispatch({
49
51
  type: 'loadAnnotation',
50
52
  data: Object.keys(payload).map(function (id) {
@@ -65,5 +67,5 @@ export var useLoadAnnotations = function useLoadAnnotations(_ref) {
65
67
  });
66
68
  };
67
69
  inlineCommentGetState(ids, isNestedRender).then(cb);
68
- }, [actions, providers, adfDocument, isNestedRender, onLoadComplete, dispatch]);
70
+ }, [actions, providers, adfDocument, isNestedRender, onLoadComplete, dispatch, isAnnotationManagerEnabled]);
69
71
  };
@@ -3,6 +3,7 @@ import { useAnnotationRangeDispatch, useAnnotationRangeState } from '../contexts
3
3
  import { isRangeInsideOfRendererContainer } from './utils';
4
4
  import { isRoot } from '../../../steps';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { useAnnotationManagerDispatch } from '../contexts/AnnotationManagerContext';
6
7
  export var useUserSelectionRange = function useUserSelectionRange(props) {
7
8
  var rendererDOM = props.rendererRef.current;
8
9
  var selectionTimeoutRef = useRef();
@@ -13,7 +14,10 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
13
14
  range = _useAnnotationRangeSt.range,
14
15
  type = _useAnnotationRangeSt.type,
15
16
  selectionDraftRange = _useAnnotationRangeSt.selectionDraftRange;
17
+ var _useAnnotationManager = useAnnotationManagerDispatch(),
18
+ annotationManager = _useAnnotationManager.annotationManager;
16
19
  var lastRangeRef = useRef(null);
20
+ var isAnnotationManagerEnabled = !!annotationManager;
17
21
  var onSelectionChange = useCallback(function (event) {
18
22
  if (fg('platform_renderer_triple_click_selects_paragraph')) {
19
23
  if (selectionTimeoutRef.current) {
@@ -23,7 +27,7 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
23
27
  var sel = document.getSelection();
24
28
  if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
25
29
  lastRangeRef.current = null; // Clear last range if selection is invalid
26
- if (fg('platform_editor_comments_api_manager')) {
30
+ if (isAnnotationManagerEnabled) {
27
31
  clearSelectionRange();
28
32
  }
29
33
  return;
@@ -63,7 +67,7 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
63
67
  selectionTimeoutRef.current = setTimeout(function () {
64
68
  var sel = document.getSelection();
65
69
  if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
66
- if (fg('platform_editor_comments_api_manager')) {
70
+ if (isAnnotationManagerEnabled) {
67
71
  clearSelectionRange();
68
72
  }
69
73
  return;
@@ -100,7 +104,7 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
100
104
  }
101
105
  }, 250);
102
106
  }
103
- }, [rendererDOM, setSelectionRange, clearSelectionRange]);
107
+ }, [rendererDOM, setSelectionRange, clearSelectionRange, isAnnotationManagerEnabled]);
104
108
  useEffect(function () {
105
109
  if (!document || !rendererDOM) {
106
110
  return;
@@ -28,7 +28,5 @@ interface Props {
28
28
  }) => JSX.Element;
29
29
  }
30
30
  export default function ExtensionRenderer(props: Props): JSX.Element;
31
- export declare const InlineNodeRendererWrapper: ({ forceMarginTop, children, }: React.PropsWithChildren<{
32
- forceMarginTop?: boolean | undefined;
33
- }>) => jsx.JSX.Element;
31
+ export declare const InlineNodeRendererWrapper: ({ children }: React.PropsWithChildren<unknown>) => jsx.JSX.Element;
34
32
  export {};
@@ -28,7 +28,5 @@ interface Props {
28
28
  }) => JSX.Element;
29
29
  }
30
30
  export default function ExtensionRenderer(props: Props): JSX.Element;
31
- export declare const InlineNodeRendererWrapper: ({ forceMarginTop, children, }: React.PropsWithChildren<{
32
- forceMarginTop?: boolean | undefined;
33
- }>) => jsx.JSX.Element;
31
+ export declare const InlineNodeRendererWrapper: ({ children }: React.PropsWithChildren<unknown>) => jsx.JSX.Element;
34
32
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "118.6.6",
3
+ "version": "118.6.8",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,13 +31,13 @@
31
31
  "@atlaskit/analytics-next": "^11.1.0",
32
32
  "@atlaskit/button": "^23.2.0",
33
33
  "@atlaskit/code": "^17.2.0",
34
- "@atlaskit/editor-common": "^106.1.0",
34
+ "@atlaskit/editor-common": "^106.2.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.24.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
37
  "@atlaskit/editor-prosemirror": "7.0.0",
38
38
  "@atlaskit/editor-shared-styles": "^3.4.0",
39
39
  "@atlaskit/editor-tables": "^2.9.0",
40
- "@atlaskit/emoji": "^69.2.0",
40
+ "@atlaskit/emoji": "^69.3.0",
41
41
  "@atlaskit/feature-gate-js-client": "^5.3.0",
42
42
  "@atlaskit/icon": "^26.4.0",
43
43
  "@atlaskit/link": "^3.2.0",
@@ -52,13 +52,13 @@
52
52
  "@atlaskit/platform-feature-flags": "^1.1.0",
53
53
  "@atlaskit/platform-feature-flags-react": "^0.2.0",
54
54
  "@atlaskit/react-ufo": "^3.13.0",
55
- "@atlaskit/smart-card": "^38.5.0",
55
+ "@atlaskit/smart-card": "^38.7.0",
56
56
  "@atlaskit/status": "^3.0.0",
57
57
  "@atlaskit/task-decision": "^19.2.0",
58
58
  "@atlaskit/theme": "^18.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^5.8.0",
59
+ "@atlaskit/tmp-editor-statsig": "^5.12.0",
60
60
  "@atlaskit/tokens": "^5.0.0",
61
- "@atlaskit/tooltip": "^20.2.0",
61
+ "@atlaskit/tooltip": "^20.3.0",
62
62
  "@atlaskit/visually-hidden": "^3.0.0",
63
63
  "@babel/runtime": "^7.0.0",
64
64
  "@emotion/react": "^11.7.1",
@@ -70,7 +70,7 @@
70
70
  "uuid": "^3.1.0"
71
71
  },
72
72
  "peerDependencies": {
73
- "@atlaskit/link-provider": "^3.2.0",
73
+ "@atlaskit/link-provider": "^3.3.0",
74
74
  "@atlaskit/media-core": "^36.1.0",
75
75
  "react": "^18.2.0",
76
76
  "react-dom": "^18.2.0"
@@ -81,7 +81,7 @@
81
81
  "@atlaskit/analytics-gas-types": "^5.1.0",
82
82
  "@atlaskit/checkbox": "^17.1.0",
83
83
  "@atlaskit/css-reset": "^7.3.0",
84
- "@atlaskit/link-provider": "^3.2.0",
84
+ "@atlaskit/link-provider": "^3.3.0",
85
85
  "@atlaskit/link-test-helpers": "^8.0.0",
86
86
  "@atlaskit/linking-common": "^9.0.0",
87
87
  "@atlaskit/media-core": "^36.1.0",