@atlaskit/renderer 118.4.1 → 118.5.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 +22 -0
- package/dist/cjs/react/nodes/media/index.js +1 -4
- package/dist/cjs/react/nodes/tableNew.js +30 -14
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/context.js +3 -99
- package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +25 -163
- package/dist/cjs/ui/annotations/draft/component.js +1 -5
- package/dist/cjs/ui/annotations/element/useInlineAnnotationProps.js +1 -5
- package/dist/cjs/ui/annotations/hooks/user-selection.js +3 -8
- package/dist/cjs/ui/annotations/hover/mounter.js +7 -31
- package/dist/cjs/ui/annotations/hover/range-validator.js +0 -4
- package/dist/cjs/ui/annotations/selection/mounter.js +9 -37
- package/dist/cjs/ui/annotations/selection/range-validator.js +0 -4
- package/dist/cjs/ui/annotations/wrapper.js +2 -77
- package/dist/es2019/react/nodes/media/index.js +1 -4
- package/dist/es2019/react/nodes/tableNew.js +31 -14
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/context.js +2 -84
- package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +24 -168
- package/dist/es2019/ui/annotations/draft/component.js +1 -5
- package/dist/es2019/ui/annotations/element/useInlineAnnotationProps.js +1 -5
- package/dist/es2019/ui/annotations/hooks/user-selection.js +3 -8
- package/dist/es2019/ui/annotations/hover/mounter.js +8 -27
- package/dist/es2019/ui/annotations/hover/range-validator.js +0 -4
- package/dist/es2019/ui/annotations/selection/mounter.js +10 -34
- package/dist/es2019/ui/annotations/selection/range-validator.js +0 -4
- package/dist/es2019/ui/annotations/wrapper.js +3 -83
- package/dist/esm/react/nodes/media/index.js +1 -4
- package/dist/esm/react/nodes/tableNew.js +30 -14
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/context.js +2 -94
- package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +24 -162
- package/dist/esm/ui/annotations/draft/component.js +1 -5
- package/dist/esm/ui/annotations/element/useInlineAnnotationProps.js +1 -5
- package/dist/esm/ui/annotations/hooks/user-selection.js +3 -8
- package/dist/esm/ui/annotations/hover/mounter.js +8 -31
- package/dist/esm/ui/annotations/hover/range-validator.js +0 -4
- package/dist/esm/ui/annotations/selection/mounter.js +10 -38
- package/dist/esm/ui/annotations/selection/range-validator.js +0 -4
- package/dist/esm/ui/annotations/wrapper.js +3 -78
- package/dist/types/react/nodes/tableNew.d.ts +6 -0
- package/dist/types/ui/Renderer/breakout-ssr.d.ts +1 -1
- package/dist/types/ui/annotations/context.d.ts +3 -40
- package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +2 -20
- package/dist/types/ui/annotations/hover/mounter.d.ts +0 -10
- package/dist/types/ui/annotations/hover/range-validator.d.ts +0 -11
- package/dist/types/ui/annotations/selection/mounter.d.ts +0 -10
- package/dist/types/ui/annotations/selection/range-validator.d.ts +0 -11
- package/dist/types/ui/annotations/wrapper.d.ts +0 -2
- package/dist/types-ts4.5/react/nodes/tableNew.d.ts +6 -0
- package/dist/types-ts4.5/ui/Renderer/breakout-ssr.d.ts +1 -1
- package/dist/types-ts4.5/ui/annotations/context.d.ts +3 -40
- package/dist/types-ts4.5/ui/annotations/contexts/AnnotationRangeContext.d.ts +2 -20
- package/dist/types-ts4.5/ui/annotations/hover/mounter.d.ts +0 -10
- package/dist/types-ts4.5/ui/annotations/hover/range-validator.d.ts +0 -11
- package/dist/types-ts4.5/ui/annotations/selection/mounter.d.ts +0 -10
- package/dist/types-ts4.5/ui/annotations/selection/range-validator.d.ts +0 -11
- package/dist/types-ts4.5/ui/annotations/wrapper.d.ts +0 -2
- package/package.json +8 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 118.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161072](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161072)
|
|
8
|
+
[`a0c4a3b5661b9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a0c4a3b5661b9) -
|
|
9
|
+
EDITOR-775 - Could not create new comment on extension Excerpt in renderer
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 118.5.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#158238](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158238)
|
|
17
|
+
[`6e8934b998a34`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e8934b998a34) -
|
|
18
|
+
Cleanup FG platform_renderer_annotation_draft_position_fix and removed all deprecated code as it
|
|
19
|
+
no longer needed since this gate is rolled out
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 118.4.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -29,7 +29,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
29
29
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
30
30
|
var _events = require("../../../analytics/events");
|
|
31
31
|
var _annotation = _interopRequireDefault(require("../../marks/annotation"));
|
|
32
|
-
var _context = require("../../../ui/annotations/context");
|
|
33
32
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
34
33
|
var _reactIntlNext = require("react-intl-next");
|
|
35
34
|
var _useInlineCommentsFilter = require("../../../ui/annotations/hooks/use-inline-comments-filter");
|
|
@@ -434,10 +433,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
434
433
|
}]);
|
|
435
434
|
}(_react.PureComponent);
|
|
436
435
|
var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
437
|
-
var draftPositionOld = _react.default.useContext(_context.AnnotationsDraftContext);
|
|
438
436
|
var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
|
|
439
|
-
|
|
440
|
-
var draftPosition = (0, _platformFeatureFlags.fg)('platform_renderer_annotation_draft_position_fix') ? hoverDraftDocumentPosition : draftPositionOld;
|
|
437
|
+
draftPosition = _useAnnotationRangeSt.hoverDraftDocumentPosition;
|
|
441
438
|
var dataAttributes = props.dataAttributes;
|
|
442
439
|
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
443
440
|
var _useState9 = (0, _react.useState)(),
|
|
@@ -15,6 +15,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
16
16
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
17
17
|
var _style = require("../../ui/Renderer/style");
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
20
|
var _types = require("@atlaskit/editor-common/types");
|
|
20
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -24,11 +25,30 @@ var _sticky = require("./table/sticky");
|
|
|
24
25
|
var _table = require("./table/table");
|
|
25
26
|
var _appearance = require("../utils/appearance");
|
|
26
27
|
var _TableStickyScrollbar = require("./TableStickyScrollbar");
|
|
28
|
+
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; }
|
|
29
|
+
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; }
|
|
27
30
|
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; } } }; }
|
|
28
31
|
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; } }
|
|
29
32
|
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; }
|
|
30
33
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
31
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
34
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop, @repo/internal/react/no-class-components */
|
|
35
|
+
var stickyContainerBaseStyles = {
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
37
|
+
height: "var(--ds-space-250, 20px)",
|
|
38
|
+
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
39
|
+
// Follow editor to hide by default so it does not show empty gap in SSR
|
|
40
|
+
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
|
|
41
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
42
|
+
display: 'block',
|
|
43
|
+
width: '100%'
|
|
44
|
+
};
|
|
45
|
+
var stickyContainerAdditionalStyles = {
|
|
46
|
+
visibility: 'hidden',
|
|
47
|
+
overflowX: 'auto',
|
|
48
|
+
position: 'sticky',
|
|
49
|
+
bottom: "var(--ds-space-0, 0px)",
|
|
50
|
+
zIndex: 1
|
|
51
|
+
};
|
|
32
52
|
var isTableResizingEnabled = exports.isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
33
53
|
return (0, _appearance.isFullWidthOrFullPageAppearance)(appearance) || (0, _appearance.isCommentAppearance)(appearance) && (0, _experiments.editorExperiment)('support_table_in_comment', true, {
|
|
34
54
|
exposure: true
|
|
@@ -125,6 +145,9 @@ var tableCanBeSticky = exports.tableCanBeSticky = function tableCanBeSticky(node
|
|
|
125
145
|
*/
|
|
126
146
|
// Ignored via go/ees005
|
|
127
147
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
*/
|
|
128
151
|
var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
129
152
|
function TableContainer() {
|
|
130
153
|
var _this;
|
|
@@ -504,23 +527,13 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
504
527
|
isPresentational: isPresentational
|
|
505
528
|
}, this.grabFirstRowRef(children))), isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/_react.default.createElement("div", {
|
|
506
529
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
507
|
-
className: _styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
|
|
530
|
+
className: "".concat(_styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER).concat((0, _platformFeatureFlags.fg)('confluence_frontend_table_scrollbar_ttvc_fix') ? '-view-page' : ''),
|
|
508
531
|
ref: this.stickyScrollbarRef,
|
|
509
532
|
"data-vc": "table-sticky-scrollbar-container",
|
|
510
|
-
style: {
|
|
511
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
512
|
-
height: "var(--ds-space-250, 20px)",
|
|
513
|
-
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
514
|
-
// Follow editor to hide by default so it does not show empty gap in SSR
|
|
515
|
-
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
|
|
516
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
517
|
-
display: 'block',
|
|
518
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
519
|
-
width: '100%'
|
|
520
|
-
}
|
|
533
|
+
style: (0, _platformFeatureFlags.fg)('confluence_frontend_table_scrollbar_ttvc_fix') ? _objectSpread(_objectSpread({}, stickyContainerBaseStyles), stickyContainerAdditionalStyles) : stickyContainerBaseStyles
|
|
521
534
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
522
535
|
style: {
|
|
523
|
-
width: (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.clientWidth,
|
|
536
|
+
width: (0, _platformFeatureFlags.fg)('confluence_frontend_table_scrollbar_ttvc_fix') ? '100%' : (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.clientWidth,
|
|
524
537
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
525
538
|
height: '100%'
|
|
526
539
|
}
|
|
@@ -537,6 +550,9 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
537
550
|
*/
|
|
538
551
|
// Ignored via go/ees005
|
|
539
552
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
553
|
+
/**
|
|
554
|
+
*
|
|
555
|
+
*/
|
|
540
556
|
var TableProcessorWithContainerStyles = exports.TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Component2) {
|
|
541
557
|
function TableProcessorWithContainerStyles() {
|
|
542
558
|
var _this2;
|
|
@@ -1397,7 +1397,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
|
|
|
1397
1397
|
'--ak-renderer-editor-font-heading-h6': "".concat((0, _ugcTokens.editorUGCToken)('editor.font.heading.h6')),
|
|
1398
1398
|
'--ak-renderer-editor-font-normal-text': "".concat((0, _ugcTokens.editorUGCToken)('editor.font.body'))
|
|
1399
1399
|
},
|
|
1400
|
-
css: [baseStyles,
|
|
1400
|
+
css: [baseStyles, hideHeadingCopyLinkWrapperStyles, appearance === 'full-page' && rendererFullPageStyles, appearance === 'full-width' && rendererFullWidthStyles, appearance === 'full-width' && !(0, _table.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, telepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_typography_ugc') ? headingsSharedStylesWithEditorUGC : headingsSharedStyles, headingWithAlignmentStyles, ruleSharedStyles, (0, _platformFeatureFlags.fg)('platform_editor_typography_ugc') ? paragraphSharedStylesWithEditorUGC : paragraphSharedStyles, listsSharedStyles, _browser.browser.gecko && listsSharedStylesForGekko, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, tasksAndDecisionsStyles, smartCardStyles, (0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') && smartCardStylesAvatarFix, (0, _platformFeatureFlags.fg)('smartcard_avatar_margin_fix') && smartCardStylesAvatarMarginFix,
|
|
1401
1401
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
1402
1402
|
(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') && rendererAnnotationStyles,
|
|
1403
1403
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning, @atlaskit/platform/ensure-feature-flag-prefix
|
|
@@ -63,7 +63,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
63
63
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
64
64
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
65
65
|
var packageName = "@atlaskit/renderer";
|
|
66
|
-
var packageVersion = "118.
|
|
66
|
+
var packageVersion = "118.5.1";
|
|
67
67
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
68
68
|
containerName: 'ak-renderer-wrapper',
|
|
69
69
|
containerType: 'inline-size'
|
|
@@ -1,105 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.ProvidersContext = exports.InlineCommentsStateContext =
|
|
9
|
-
var
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
-
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; }
|
|
19
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
20
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
6
|
+
exports.ProvidersContext = exports.InlineCommentsStateContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
21
8
|
var ProvidersContext = exports.ProvidersContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
22
|
-
var InlineCommentsStateContext = exports.InlineCommentsStateContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @private
|
|
26
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
27
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
28
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
29
|
-
*/
|
|
30
|
-
var AnnotationsDraftContext = exports.AnnotationsDraftContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @private
|
|
34
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
35
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
36
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
37
|
-
*/
|
|
38
|
-
// Ignored via go/ees005
|
|
39
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
40
|
-
var AnnotationsDraftContextWrapper = exports.AnnotationsDraftContextWrapper = /*#__PURE__*/function (_React$Component) {
|
|
41
|
-
function AnnotationsDraftContextWrapper() {
|
|
42
|
-
var _this;
|
|
43
|
-
(0, _classCallCheck2.default)(this, AnnotationsDraftContextWrapper);
|
|
44
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
|
-
args[_key] = arguments[_key];
|
|
46
|
-
}
|
|
47
|
-
_this = _callSuper(this, AnnotationsDraftContextWrapper, [].concat(args));
|
|
48
|
-
(0, _defineProperty2.default)(_this, "state", {
|
|
49
|
-
position: null
|
|
50
|
-
});
|
|
51
|
-
(0, _defineProperty2.default)(_this, "applyAnnotationDraftAt", function (nextPosition) {
|
|
52
|
-
var setDraftRange = _this.props.setDraftRange;
|
|
53
|
-
|
|
54
|
-
// Set the draft range to preserve it downstream
|
|
55
|
-
setDraftRange();
|
|
56
|
-
|
|
57
|
-
// We need to support a new draft being made while one exists and overwrite it
|
|
58
|
-
// Set the document position for the newly created draft
|
|
59
|
-
_this.setState({
|
|
60
|
-
position: nextPosition
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
(0, _defineProperty2.default)(_this, "clearAnnotationDraft", function () {
|
|
64
|
-
var clearDraftRange = _this.props.clearDraftRange;
|
|
65
|
-
|
|
66
|
-
// Clear the draft range
|
|
67
|
-
clearDraftRange();
|
|
68
|
-
|
|
69
|
-
// Clear the draft position in the document
|
|
70
|
-
_this.setState({
|
|
71
|
-
position: null
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
return _this;
|
|
75
|
-
}
|
|
76
|
-
(0, _inherits2.default)(AnnotationsDraftContextWrapper, _React$Component);
|
|
77
|
-
return (0, _createClass2.default)(AnnotationsDraftContextWrapper, [{
|
|
78
|
-
key: "render",
|
|
79
|
-
value: function render() {
|
|
80
|
-
var _this$props = this.props,
|
|
81
|
-
children = _this$props.children,
|
|
82
|
-
isNestedRender = _this$props.isNestedRender;
|
|
83
|
-
var position = this.state.position;
|
|
84
|
-
var applyAnnotationDraftAt = this.applyAnnotationDraftAt;
|
|
85
|
-
var clearAnnotationDraft = this.clearAnnotationDraft;
|
|
86
|
-
|
|
87
|
-
/*
|
|
88
|
-
* If this is a nested render, we do not provide the draft context
|
|
89
|
-
* because it has already been provided higher up the component tree
|
|
90
|
-
* and we need the original context to create draft annotations on extensions.
|
|
91
|
-
*/
|
|
92
|
-
return isNestedRender && (0, _platformFeatureFlags.fg)('confluence_frontend_fix_extension_draft_annotation') ? /*#__PURE__*/_react.default.createElement("span", {
|
|
93
|
-
"data-testid": "context-wrapper-without-provider"
|
|
94
|
-
}, children({
|
|
95
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
96
|
-
clearAnnotationDraft: clearAnnotationDraft
|
|
97
|
-
})) : /*#__PURE__*/_react.default.createElement(AnnotationsDraftContext.Provider, {
|
|
98
|
-
value: position
|
|
99
|
-
}, children({
|
|
100
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
101
|
-
clearAnnotationDraft: clearAnnotationDraft
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
}]);
|
|
105
|
-
}(_react.default.Component);
|
|
9
|
+
var InlineCommentsStateContext = exports.InlineCommentsStateContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
@@ -5,18 +5,15 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useAnnotationRangeState = exports.useAnnotationRangeDispatch = exports.AnnotationRangeProviderInner = exports.AnnotationRangeProvider = void 0;
|
|
8
|
+
exports.useAnnotationRangeState = exports.useAnnotationRangeDispatch = exports.AnnotationRangeStateContext = exports.AnnotationRangeProviderInner = exports.AnnotationRangeProvider = exports.AnnotationRangeDispatchContext = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
13
|
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; }
|
|
15
14
|
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; }
|
|
16
15
|
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; }
|
|
17
16
|
var initialState = {
|
|
18
|
-
range: null,
|
|
19
|
-
draftRange: null,
|
|
20
17
|
type: null,
|
|
21
18
|
selectionRange: null,
|
|
22
19
|
hoverRange: null,
|
|
@@ -25,80 +22,8 @@ var initialState = {
|
|
|
25
22
|
selectionDraftDocumentPosition: null,
|
|
26
23
|
hoverDraftDocumentPosition: null
|
|
27
24
|
};
|
|
28
|
-
function
|
|
29
|
-
switch (action.type) {
|
|
30
|
-
case 'clear':
|
|
31
|
-
return initialState;
|
|
32
|
-
case 'clearSelection':
|
|
33
|
-
if (state.type === 'selection') {
|
|
34
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
35
|
-
range: null,
|
|
36
|
-
type: null
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return state;
|
|
40
|
-
case 'clearDraftSelection':
|
|
41
|
-
if (state.type === 'selection') {
|
|
42
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
43
|
-
draftRange: null
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return state;
|
|
47
|
-
case 'clearDraftHover':
|
|
48
|
-
if (state.type === 'hover') {
|
|
49
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
50
|
-
draftRange: null
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return state;
|
|
54
|
-
case 'clearHover':
|
|
55
|
-
if (state.type === 'hover') {
|
|
56
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
57
|
-
range: null,
|
|
58
|
-
draftRange: null,
|
|
59
|
-
type: null
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return state;
|
|
63
|
-
case 'setSelection':
|
|
64
|
-
if (state.range !== action.range || state.type !== 'selection') {
|
|
65
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
66
|
-
range: action.range,
|
|
67
|
-
type: 'selection'
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return state;
|
|
71
|
-
case 'setHover':
|
|
72
|
-
if (state.range !== action.range || state.type !== 'hover') {
|
|
73
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
74
|
-
range: action.range,
|
|
75
|
-
type: 'hover'
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return state;
|
|
79
|
-
case 'setDraftSelection':
|
|
80
|
-
if (state.draftRange !== action.draftRange || state.type !== 'selection') {
|
|
81
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
82
|
-
range: null,
|
|
83
|
-
draftRange: action.draftRange,
|
|
84
|
-
type: null
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return state;
|
|
88
|
-
case 'setDraftHover':
|
|
89
|
-
if (state.draftRange !== action.draftRange || state.type !== 'hover') {
|
|
90
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
91
|
-
draftRange: action.draftRange
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return state;
|
|
95
|
-
}
|
|
96
|
-
return state;
|
|
97
|
-
}
|
|
98
|
-
function reducerNew(state, action) {
|
|
25
|
+
function reducer(state, action) {
|
|
99
26
|
switch (action.type) {
|
|
100
|
-
case 'clear':
|
|
101
|
-
return initialState;
|
|
102
27
|
case 'clearSelection':
|
|
103
28
|
if (state.selectionRange !== null) {
|
|
104
29
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -173,9 +98,8 @@ function reducerNew(state, action) {
|
|
|
173
98
|
}
|
|
174
99
|
return state;
|
|
175
100
|
}
|
|
176
|
-
return state;
|
|
177
101
|
}
|
|
178
|
-
var AnnotationRangeStateContext = /*#__PURE__*/(0, _react.createContext)({
|
|
102
|
+
var AnnotationRangeStateContext = exports.AnnotationRangeStateContext = /*#__PURE__*/(0, _react.createContext)({
|
|
179
103
|
range: null,
|
|
180
104
|
type: null,
|
|
181
105
|
selectionDraftRange: null,
|
|
@@ -183,31 +107,21 @@ var AnnotationRangeStateContext = /*#__PURE__*/(0, _react.createContext)({
|
|
|
183
107
|
selectionDraftDocumentPosition: null,
|
|
184
108
|
hoverDraftDocumentPosition: null
|
|
185
109
|
});
|
|
186
|
-
var AnnotationRangeDispatchContext = /*#__PURE__*/(0, _react.createContext)({
|
|
187
|
-
clearRange: function clearRange() {},
|
|
110
|
+
var AnnotationRangeDispatchContext = exports.AnnotationRangeDispatchContext = /*#__PURE__*/(0, _react.createContext)({
|
|
188
111
|
clearSelectionRange: function clearSelectionRange() {},
|
|
189
112
|
clearHoverRange: function clearHoverRange() {},
|
|
190
113
|
setSelectionRange: function setSelectionRange() {},
|
|
191
|
-
// if platform_renderer_annotation_draft_position_fix is off; then
|
|
192
|
-
setDraftRange: function setDraftRange() {},
|
|
193
|
-
clearDraftRange: function clearDraftRange() {},
|
|
194
|
-
// end-if
|
|
195
|
-
|
|
196
|
-
// if platform_renderer_annotation_draft_position_fix is on; then
|
|
197
114
|
promoteSelectionToDraft: function promoteSelectionToDraft() {},
|
|
198
115
|
promoteHoverToDraft: function promoteHoverToDraft() {},
|
|
199
116
|
clearSelectionDraft: function clearSelectionDraft() {},
|
|
200
117
|
clearHoverDraft: function clearHoverDraft() {}
|
|
201
|
-
// end-if
|
|
202
118
|
});
|
|
203
119
|
var AnnotationRangeProviderInner = exports.AnnotationRangeProviderInner = function AnnotationRangeProviderInner(_ref) {
|
|
204
120
|
var children = _ref.children,
|
|
205
121
|
allowCommentsOnMedia = _ref.allowCommentsOnMedia;
|
|
206
|
-
var _useReducer = (0, _react.useReducer)(
|
|
122
|
+
var _useReducer = (0, _react.useReducer)(reducer, initialState),
|
|
207
123
|
_useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
|
|
208
124
|
_useReducer2$ = _useReducer2[0],
|
|
209
|
-
range = _useReducer2$.range,
|
|
210
|
-
draftRange = _useReducer2$.draftRange,
|
|
211
125
|
selectionRange = _useReducer2$.selectionRange,
|
|
212
126
|
hoverRange = _useReducer2$.hoverRange,
|
|
213
127
|
type = _useReducer2$.type,
|
|
@@ -216,27 +130,11 @@ var AnnotationRangeProviderInner = exports.AnnotationRangeProviderInner = functi
|
|
|
216
130
|
hoverDraftRange = _useReducer2$.hoverDraftRange,
|
|
217
131
|
hoverDraftDocumentPosition = _useReducer2$.hoverDraftDocumentPosition,
|
|
218
132
|
dispatch = _useReducer2[1];
|
|
219
|
-
var clearRange = (0, _react.useCallback)(function () {
|
|
220
|
-
return dispatch({
|
|
221
|
-
type: 'clear'
|
|
222
|
-
});
|
|
223
|
-
}, []);
|
|
224
133
|
var clearSelectionRange = (0, _react.useCallback)(function () {
|
|
225
134
|
return dispatch({
|
|
226
135
|
type: 'clearSelection'
|
|
227
136
|
});
|
|
228
137
|
}, []);
|
|
229
|
-
var clearDraftRange = (0, _react.useCallback)(function (type) {
|
|
230
|
-
if (type === 'hover') {
|
|
231
|
-
dispatch({
|
|
232
|
-
type: 'clearDraftHover'
|
|
233
|
-
});
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
dispatch({
|
|
237
|
-
type: 'clearDraftSelection'
|
|
238
|
-
});
|
|
239
|
-
}, []);
|
|
240
138
|
var clearHoverRange = (0, _react.useCallback)(function () {
|
|
241
139
|
return dispatch({
|
|
242
140
|
type: 'clearHover'
|
|
@@ -248,19 +146,6 @@ var AnnotationRangeProviderInner = exports.AnnotationRangeProviderInner = functi
|
|
|
248
146
|
range: range
|
|
249
147
|
});
|
|
250
148
|
}, []);
|
|
251
|
-
var setDraftRange = (0, _react.useCallback)(function (range, type) {
|
|
252
|
-
if (type === 'hover') {
|
|
253
|
-
dispatch({
|
|
254
|
-
type: 'setDraftHover',
|
|
255
|
-
draftRange: range
|
|
256
|
-
});
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
dispatch({
|
|
260
|
-
type: 'setDraftSelection',
|
|
261
|
-
draftRange: range
|
|
262
|
-
});
|
|
263
|
-
}, []);
|
|
264
149
|
var setHoverTarget = (0, _react.useCallback)(function (target) {
|
|
265
150
|
// the HoverComponent expects an element deeply nested inside media, these classes work with the current implementation
|
|
266
151
|
var mediaNode = target.querySelector('.media-card-inline-player, .media-file-card-view');
|
|
@@ -298,46 +183,29 @@ var AnnotationRangeProviderInner = exports.AnnotationRangeProviderInner = functi
|
|
|
298
183
|
});
|
|
299
184
|
}, []);
|
|
300
185
|
var stateData = (0, _react.useMemo)(function () {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
} else {
|
|
313
|
-
return {
|
|
314
|
-
range: range,
|
|
315
|
-
draftRange: draftRange,
|
|
316
|
-
type: type,
|
|
317
|
-
// I've updated some refs to use the new selectionDraftRange, this is being add here to be fowards compatible
|
|
318
|
-
// with the new changes coming in platform_renderer_annotation_draft_position_fix.
|
|
319
|
-
selectionDraftRange: draftRange,
|
|
320
|
-
hoverDraftRange: draftRange,
|
|
321
|
-
selectionDraftDocumentPosition: null,
|
|
322
|
-
hoverDraftDocumentPosition: null
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
}, [range, draftRange, selectionRange, hoverRange, type, selectionDraftRange, selectionDraftDocumentPosition, hoverDraftRange, hoverDraftDocumentPosition]);
|
|
186
|
+
return {
|
|
187
|
+
// We techinically have two ranges, however we only want to expose one of them at a time, because only one draft
|
|
188
|
+
// can be active at a time. The type of range is used to determine which range is active.
|
|
189
|
+
range: type === 'selection' ? selectionRange : hoverRange,
|
|
190
|
+
type: type,
|
|
191
|
+
selectionDraftRange: selectionDraftRange,
|
|
192
|
+
hoverDraftRange: hoverDraftRange,
|
|
193
|
+
selectionDraftDocumentPosition: selectionDraftDocumentPosition,
|
|
194
|
+
hoverDraftDocumentPosition: hoverDraftDocumentPosition
|
|
195
|
+
};
|
|
196
|
+
}, [selectionRange, hoverRange, type, selectionDraftRange, selectionDraftDocumentPosition, hoverDraftRange, hoverDraftDocumentPosition]);
|
|
326
197
|
var dispatchData = (0, _react.useMemo)(function () {
|
|
327
198
|
return {
|
|
328
|
-
clearRange: clearRange,
|
|
329
199
|
clearSelectionRange: clearSelectionRange,
|
|
330
|
-
clearDraftRange: clearDraftRange,
|
|
331
200
|
clearHoverRange: clearHoverRange,
|
|
332
201
|
setSelectionRange: setSelectionRange,
|
|
333
|
-
setDraftRange: setDraftRange,
|
|
334
202
|
setHoverTarget: !!allowCommentsOnMedia ? setHoverTarget : undefined,
|
|
335
203
|
promoteSelectionToDraft: promoteSelectionToDraft,
|
|
336
204
|
promoteHoverToDraft: promoteHoverToDraft,
|
|
337
205
|
clearSelectionDraft: clearSelectionDraft,
|
|
338
206
|
clearHoverDraft: clearHoverDraft
|
|
339
207
|
};
|
|
340
|
-
}, [allowCommentsOnMedia,
|
|
208
|
+
}, [allowCommentsOnMedia, clearSelectionRange, clearHoverRange, setSelectionRange, setHoverTarget, promoteSelectionToDraft, promoteHoverToDraft, clearSelectionDraft, clearHoverDraft]);
|
|
341
209
|
return /*#__PURE__*/_react.default.createElement(AnnotationRangeStateContext.Provider, {
|
|
342
210
|
value: stateData
|
|
343
211
|
}, /*#__PURE__*/_react.default.createElement(AnnotationRangeDispatchContext.Provider, {
|
|
@@ -348,20 +216,14 @@ var AnnotationRangeProvider = exports.AnnotationRangeProvider = function Annotat
|
|
|
348
216
|
var children = _ref2.children,
|
|
349
217
|
allowCommentsOnMedia = _ref2.allowCommentsOnMedia,
|
|
350
218
|
isNestedRender = _ref2.isNestedRender;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}, children);
|
|
360
|
-
} else {
|
|
361
|
-
return /*#__PURE__*/_react.default.createElement(AnnotationRangeProviderInner, {
|
|
362
|
-
allowCommentsOnMedia: allowCommentsOnMedia
|
|
363
|
-
}, children);
|
|
364
|
-
}
|
|
219
|
+
/*
|
|
220
|
+
* If this is a nested render, we do not provide the context
|
|
221
|
+
* because it has already been provided higher up the component tree
|
|
222
|
+
* and we need the original context to create annotations on extensions.
|
|
223
|
+
*/
|
|
224
|
+
return isNestedRender ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children) : /*#__PURE__*/_react.default.createElement(AnnotationRangeProviderInner, {
|
|
225
|
+
allowCommentsOnMedia: allowCommentsOnMedia
|
|
226
|
+
}, children);
|
|
365
227
|
};
|
|
366
228
|
var useAnnotationRangeState = exports.useAnnotationRangeState = function useAnnotationRangeState() {
|
|
367
229
|
return (0, _react.useContext)(AnnotationRangeStateContext);
|
|
@@ -9,9 +9,7 @@ exports.getAnnotationIndex = exports.applyAnnotationOnText = exports.TextWithAnn
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _types = require("../types");
|
|
14
|
-
var _context = require("../context");
|
|
15
13
|
var _text = require("./text");
|
|
16
14
|
var _position = require("./position");
|
|
17
15
|
var _dom = require("./dom");
|
|
@@ -122,10 +120,8 @@ var TextWithAnnotationDraft = exports.TextWithAnnotationDraft = function TextWit
|
|
|
122
120
|
end: endPos
|
|
123
121
|
};
|
|
124
122
|
}, [endPos, startPos]);
|
|
125
|
-
var nextDraftPositionOld = _react.default.useContext(_context.AnnotationsDraftContext);
|
|
126
123
|
var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
|
|
127
|
-
|
|
128
|
-
var nextDraftPosition = (0, _platformFeatureFlags.fg)('platform_renderer_annotation_draft_position_fix') ? selectionDraftDocumentPosition : nextDraftPositionOld;
|
|
124
|
+
nextDraftPosition = _useAnnotationRangeSt.selectionDraftDocumentPosition;
|
|
129
125
|
var shouldApplyAnnotationAt = _react.default.useMemo(function () {
|
|
130
126
|
if (!nextDraftPosition) {
|
|
131
127
|
return false;
|
|
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useInlineAnnotationProps = useInlineAnnotationProps;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
|
-
var _context = require("../context");
|
|
10
8
|
var _AnnotationRangeContext = require("../contexts/AnnotationRangeContext");
|
|
11
9
|
function useInlineAnnotationProps(props) {
|
|
12
|
-
var draftPositionOld = (0, _react.useContext)(_context.AnnotationsDraftContext);
|
|
13
10
|
var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
|
|
14
|
-
|
|
15
|
-
var draftPosition = (0, _platformFeatureFlags.fg)('platform_renderer_annotation_draft_position_fix') ? selectionDraftDocumentPosition : draftPositionOld;
|
|
11
|
+
draftPosition = _useAnnotationRangeSt.selectionDraftDocumentPosition;
|
|
16
12
|
if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
17
13
|
return {};
|
|
18
14
|
}
|
|
@@ -13,7 +13,6 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
|
|
|
13
13
|
var rendererDOM = props.rendererRef.current;
|
|
14
14
|
var selectionTimeoutRef = (0, _react.useRef)();
|
|
15
15
|
var _useAnnotationRangeDi = (0, _AnnotationRangeContext.useAnnotationRangeDispatch)(),
|
|
16
|
-
clearRange = _useAnnotationRangeDi.clearRange,
|
|
17
16
|
clearSelectionRange = _useAnnotationRangeDi.clearSelectionRange,
|
|
18
17
|
setSelectionRange = _useAnnotationRangeDi.setSelectionRange;
|
|
19
18
|
var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
|
|
@@ -113,12 +112,8 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
|
|
|
113
112
|
// Ignored via go/ees005
|
|
114
113
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
115
114
|
document.removeEventListener('selectionchange', onSelectionChange);
|
|
116
|
-
|
|
117
|
-
clearSelectionRange();
|
|
118
|
-
} else {
|
|
119
|
-
clearRange();
|
|
120
|
-
}
|
|
115
|
+
clearSelectionRange();
|
|
121
116
|
};
|
|
122
|
-
}, [rendererDOM, onSelectionChange, clearSelectionRange
|
|
123
|
-
return [type, range, selectionDraftRange,
|
|
117
|
+
}, [rendererDOM, onSelectionChange, clearSelectionRange]);
|
|
118
|
+
return [type, range, selectionDraftRange, clearSelectionRange];
|
|
124
119
|
};
|