@atlaskit/renderer 111.1.8 → 111.1.10

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,22 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 111.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#151121](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151121)
8
+ [`7327a31a5aaec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7327a31a5aaec) -
9
+ [ux] [ED-25172] Update resolvePos to handle when endContainer is a non-text node.
10
+ - Updated dependencies
11
+
12
+ ## 111.1.9
13
+
14
+ ### Patch Changes
15
+
16
+ - [#151050](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151050)
17
+ [`50e38f61af619`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/50e38f61af619) -
18
+ cleaned up ff for extended inline-extensions
19
+
3
20
  ## 111.1.8
4
21
 
5
22
  ### Patch Changes
@@ -150,7 +150,25 @@ function resolvePos(node, offset) {
150
150
  }
151
151
  }
152
152
  }
153
+
154
+ /**
155
+ * If anchor node is an element (e.g. after a triple click) the anchorOffset
156
+ * is the number of child nodes preceding the anchor.
157
+ * https://developer.mozilla.org/en-US/docs/Web/API/Selection/anchorOffset
158
+ *
159
+ * For end pos we calculate the number of characters by stepping through
160
+ * each of the node's children.
161
+ */
153
162
  if (node instanceof HTMLElement && isPositionPointer(node)) {
163
+ if (findEnd) {
164
+ var count = getStartPos(node);
165
+ var children = node.childNodes;
166
+ for (var i = 0; i < offset; i++) {
167
+ var _children$i;
168
+ count += ((_children$i = children[i]) === null || _children$i === void 0 || (_children$i = _children$i.textContent) === null || _children$i === void 0 ? void 0 : _children$i.length) || 1;
169
+ }
170
+ return count;
171
+ }
154
172
  return getStartPos(node) + offset;
155
173
  }
156
174
  var parent = findParent(node);
@@ -1,21 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = ExtensionRenderer;
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
9
  var _react = require("@emotion/react");
11
- var _react2 = _interopRequireWildcard(require("react"));
10
+ var _react2 = _interopRequireDefault(require("react"));
12
11
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
13
12
  var _extensions = require("@atlaskit/editor-common/extensions");
14
13
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
15
14
  var _utils = require("@atlaskit/editor-common/utils");
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
15
  /**
20
16
  * @jsxRuntime classic
21
17
  * @jsx jsx
@@ -129,14 +125,11 @@ function ExtensionRenderer(props) {
129
125
  }
130
126
  var InlineNodeRendererWrapper = function InlineNodeRendererWrapper(_ref) {
131
127
  var children = _ref.children;
132
- if ((0, _platformFeatureFlags.fg)('platform.editor.inline_extension.extended_lcqdn')) {
133
- return (
134
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
135
- (0, _react.jsx)("div", {
136
- className: "inline-extension-renderer",
137
- css: inlineExtensionStyle
138
- }, children)
139
- );
140
- }
141
- return (0, _react.jsx)(_react2.Fragment, null, children);
128
+ return (
129
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
130
+ (0, _react.jsx)("div", {
131
+ className: "inline-extension-renderer",
132
+ css: inlineExtensionStyle
133
+ }, children)
134
+ );
142
135
  };
@@ -65,7 +65,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
65
65
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
66
66
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
67
67
  var packageName = "@atlaskit/renderer";
68
- var packageVersion = "111.1.8";
68
+ var packageVersion = "111.1.10";
69
69
  var setAsQueryContainerStyles = (0, _react2.css)({
70
70
  containerName: 'ak-renderer-wrapper',
71
71
  containerType: 'inline-size',
@@ -287,7 +287,7 @@ var __RendererClassComponent = exports.__RendererClassComponent = /*#__PURE__*/f
287
287
  nodeComponents: props.nodeComponents,
288
288
  // does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
289
289
  allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
290
- isInsideOfInlineExtension: (0, _platformFeatureFlags.fg)('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
290
+ isInsideOfInlineExtension: props.isInsideOfInlineExtension,
291
291
  textHighlighter: props.UNSTABLE_textHighlighter,
292
292
  allowTableAlignment: props.UNSTABLE_allowTableAlignment,
293
293
  allowTableResizing: props.UNSTABLE_allowTableResizing
@@ -558,7 +558,7 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
558
558
  , {
559
559
  className: "ak-renderer-wrapper is-".concat(appearance),
560
560
  "data-appearance": appearance,
561
- shouldCheckExistingValue: (0, _platformFeatureFlags.fg)('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
561
+ shouldCheckExistingValue: isInsideOfInlineExtension
562
562
  }, (0, _react2.jsx)(_ui.BaseTheme, {
563
563
  baseFontSize: appearance && appearance !== 'comment' ? _editorSharedStyles.akEditorFullPageDefaultFontSize : undefined
564
564
  }, (0, _react2.jsx)(_EditorMediaClientProvider.EditorMediaClientProvider, {
@@ -144,7 +144,25 @@ export function resolvePos(node, offset, findEnd = false) {
144
144
  }
145
145
  }
146
146
  }
147
+
148
+ /**
149
+ * If anchor node is an element (e.g. after a triple click) the anchorOffset
150
+ * is the number of child nodes preceding the anchor.
151
+ * https://developer.mozilla.org/en-US/docs/Web/API/Selection/anchorOffset
152
+ *
153
+ * For end pos we calculate the number of characters by stepping through
154
+ * each of the node's children.
155
+ */
147
156
  if (node instanceof HTMLElement && isPositionPointer(node)) {
157
+ if (findEnd) {
158
+ let count = getStartPos(node);
159
+ const children = node.childNodes;
160
+ for (let i = 0; i < offset; i++) {
161
+ var _children$i, _children$i$textConte;
162
+ count += ((_children$i = children[i]) === null || _children$i === void 0 ? void 0 : (_children$i$textConte = _children$i.textContent) === null || _children$i$textConte === void 0 ? void 0 : _children$i$textConte.length) || 1;
163
+ }
164
+ return count;
165
+ }
148
166
  return getStartPos(node) + offset;
149
167
  }
150
168
  const parent = findParent(node);
@@ -4,12 +4,11 @@
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
- import React, { Fragment } from 'react';
7
+ import React from 'react';
8
8
  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
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  const inlineExtensionStyle = css({
14
13
  display: 'inline-block',
15
14
  maxWidth: '100%',
@@ -113,14 +112,11 @@ export default function ExtensionRenderer(props) {
113
112
  const InlineNodeRendererWrapper = ({
114
113
  children
115
114
  }) => {
116
- if (fg('platform.editor.inline_extension.extended_lcqdn')) {
117
- return (
118
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
119
- jsx("div", {
120
- className: "inline-extension-renderer",
121
- css: inlineExtensionStyle
122
- }, children)
123
- );
124
- }
125
- return jsx(Fragment, null, children);
115
+ return (
116
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
117
+ jsx("div", {
118
+ className: "inline-extension-renderer",
119
+ css: inlineExtensionStyle
120
+ }, children)
121
+ );
126
122
  };
@@ -45,7 +45,7 @@ import { nodeToReact } from '../../react/nodes';
45
45
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  const packageName = "@atlaskit/renderer";
48
- const packageVersion = "111.1.8";
48
+ const packageVersion = "111.1.10";
49
49
  const setAsQueryContainerStyles = css({
50
50
  containerName: 'ak-renderer-wrapper',
51
51
  containerType: 'inline-size',
@@ -265,7 +265,7 @@ export class __RendererClassComponent extends PureComponent {
265
265
  nodeComponents: props.nodeComponents,
266
266
  // does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
267
267
  allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
268
- isInsideOfInlineExtension: fg('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
268
+ isInsideOfInlineExtension: props.isInsideOfInlineExtension,
269
269
  textHighlighter: props.UNSTABLE_textHighlighter,
270
270
  allowTableAlignment: props.UNSTABLE_allowTableAlignment,
271
271
  allowTableResizing: props.UNSTABLE_allowTableResizing
@@ -531,7 +531,7 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
531
531
  , {
532
532
  className: `ak-renderer-wrapper is-${appearance}`,
533
533
  "data-appearance": appearance,
534
- shouldCheckExistingValue: fg('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
534
+ shouldCheckExistingValue: isInsideOfInlineExtension
535
535
  }, jsx(BaseTheme, {
536
536
  baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
537
537
  }, jsx(EditorMediaClientProvider, {
@@ -141,7 +141,25 @@ export function resolvePos(node, offset) {
141
141
  }
142
142
  }
143
143
  }
144
+
145
+ /**
146
+ * If anchor node is an element (e.g. after a triple click) the anchorOffset
147
+ * is the number of child nodes preceding the anchor.
148
+ * https://developer.mozilla.org/en-US/docs/Web/API/Selection/anchorOffset
149
+ *
150
+ * For end pos we calculate the number of characters by stepping through
151
+ * each of the node's children.
152
+ */
144
153
  if (node instanceof HTMLElement && isPositionPointer(node)) {
154
+ if (findEnd) {
155
+ var count = getStartPos(node);
156
+ var children = node.childNodes;
157
+ for (var i = 0; i < offset; i++) {
158
+ var _children$i;
159
+ count += ((_children$i = children[i]) === null || _children$i === void 0 || (_children$i = _children$i.textContent) === null || _children$i === void 0 ? void 0 : _children$i.length) || 1;
160
+ }
161
+ return count;
162
+ }
145
163
  return getStartPos(node) + offset;
146
164
  }
147
165
  var parent = findParent(node);
@@ -5,12 +5,11 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  */
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
7
  import { css, jsx } from '@emotion/react';
8
- import React, { Fragment } from 'react';
8
+ import React from 'react';
9
9
  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
- import { fg } from '@atlaskit/platform-feature-flags';
14
13
  var inlineExtensionStyle = css({
15
14
  display: 'inline-block',
16
15
  maxWidth: '100%',
@@ -118,14 +117,11 @@ export default function ExtensionRenderer(props) {
118
117
  }
119
118
  var InlineNodeRendererWrapper = function InlineNodeRendererWrapper(_ref) {
120
119
  var children = _ref.children;
121
- if (fg('platform.editor.inline_extension.extended_lcqdn')) {
122
- return (
123
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
124
- jsx("div", {
125
- className: "inline-extension-renderer",
126
- css: inlineExtensionStyle
127
- }, children)
128
- );
129
- }
130
- return jsx(Fragment, null, children);
120
+ return (
121
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
122
+ jsx("div", {
123
+ className: "inline-extension-renderer",
124
+ css: inlineExtensionStyle
125
+ }, children)
126
+ );
131
127
  };
@@ -55,7 +55,7 @@ import { nodeToReact } from '../../react/nodes';
55
55
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
56
56
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "111.1.8";
58
+ var packageVersion = "111.1.10";
59
59
  var setAsQueryContainerStyles = css({
60
60
  containerName: 'ak-renderer-wrapper',
61
61
  containerType: 'inline-size',
@@ -277,7 +277,7 @@ export var __RendererClassComponent = /*#__PURE__*/function (_PureComponent) {
277
277
  nodeComponents: props.nodeComponents,
278
278
  // does not currently support SSR, should not be enabled in environments where Renderer is SSR-ed
279
279
  allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
280
- isInsideOfInlineExtension: fg('platform.editor.inline_extension.extended_lcqdn') && props.isInsideOfInlineExtension,
280
+ isInsideOfInlineExtension: props.isInsideOfInlineExtension,
281
281
  textHighlighter: props.UNSTABLE_textHighlighter,
282
282
  allowTableAlignment: props.UNSTABLE_allowTableAlignment,
283
283
  allowTableResizing: props.UNSTABLE_allowTableResizing
@@ -548,7 +548,7 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
548
548
  , {
549
549
  className: "ak-renderer-wrapper is-".concat(appearance),
550
550
  "data-appearance": appearance,
551
- shouldCheckExistingValue: fg('platform.editor.inline_extension.extended_lcqdn') && isInsideOfInlineExtension
551
+ shouldCheckExistingValue: isInsideOfInlineExtension
552
552
  }, jsx(BaseTheme, {
553
553
  baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
554
554
  }, jsx(EditorMediaClientProvider, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "111.1.8",
3
+ "version": "111.1.10",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/media-ui": "^25.15.0",
47
47
  "@atlaskit/media-viewer": "^49.1.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
- "@atlaskit/smart-card": "^29.3.0",
49
+ "@atlaskit/smart-card": "^30.0.0",
50
50
  "@atlaskit/status": "^1.5.0",
51
51
  "@atlaskit/task-decision": "^17.11.0",
52
52
  "@atlaskit/theme": "^13.0.0",