@atlaskit/renderer 111.1.9 → 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,14 @@
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
+
3
12
  ## 111.1.9
4
13
 
5
14
  ### 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);
@@ -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.9";
68
+ var packageVersion = "111.1.10";
69
69
  var setAsQueryContainerStyles = (0, _react2.css)({
70
70
  containerName: 'ak-renderer-wrapper',
71
71
  containerType: 'inline-size',
@@ -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);
@@ -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.9";
48
+ const packageVersion = "111.1.10";
49
49
  const setAsQueryContainerStyles = css({
50
50
  containerName: 'ak-renderer-wrapper',
51
51
  containerType: 'inline-size',
@@ -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);
@@ -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.9";
58
+ var packageVersion = "111.1.10";
59
59
  var setAsQueryContainerStyles = css({
60
60
  containerName: 'ak-renderer-wrapper',
61
61
  containerType: 'inline-size',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "111.1.9",
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.4.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",