@atlaskit/renderer 110.0.1 → 110.0.3

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,23 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 110.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#140548](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140548)
8
+ [`93e3974b2538e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93e3974b2538e) -
9
+ Fix annotation range on triple click when text containing an inline code
10
+ - [#140574](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140574)
11
+ [`91964e2471abb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/91964e2471abb) -
12
+ Select input content when select all is triggered inside an input
13
+ - Updated dependencies
14
+
15
+ ## 110.0.2
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 110.0.1
4
22
 
5
23
  ### Patch Changes
@@ -9,6 +9,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _analyticsContext = _interopRequireDefault(require("../../analytics/analyticsContext"));
11
11
  var _elementSelection = require("./element-selection");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var useSelectAllTrap = exports.useSelectAllTrap = function useSelectAllTrap() {
13
14
  var _React$useContext = _react.default.useContext(_analyticsContext.default),
14
15
  fireAnalyticsEvent = _React$useContext.fireAnalyticsEvent;
@@ -17,6 +18,7 @@ var useSelectAllTrap = exports.useSelectAllTrap = function useSelectAllTrap() {
17
18
  var caught = _react.default.useRef();
18
19
  var mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
19
20
  var onKeyDown = _react.default.useCallback(function (e) {
21
+ var _e$target, _e$target$matches;
20
22
  var el = ref.current;
21
23
  if (!el) {
22
24
  return;
@@ -26,7 +28,8 @@ var useSelectAllTrap = exports.useSelectAllTrap = function useSelectAllTrap() {
26
28
  return;
27
29
  }
28
30
  var elementSelection = _elementSelection.ElementSelection.fromWindow();
29
- if (elementSelection.eq(caught.current)) {
31
+ var isInput = (0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync') ? (_e$target = e.target) === null || _e$target === void 0 || (_e$target$matches = _e$target.matches) === null || _e$target$matches === void 0 ? void 0 : _e$target$matches.call(_e$target, 'input') : false;
32
+ if (elementSelection.eq(caught.current) || isInput) {
30
33
  fireAnalyticsEvent({
31
34
  eventType: _analytics.EVENT_TYPE.TRACK,
32
35
  action: _analytics.ACTION.SELECT_ALL_ESCAPED,
@@ -63,7 +63,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
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 = "110.0.1";
66
+ var packageVersion = "110.0.3";
67
67
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
68
68
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
69
69
  (0, _inherits2.default)(Renderer, _PureComponent);
@@ -38,6 +38,7 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
38
38
  var startContainer = _range.startContainer,
39
39
  endContainer = _range.endContainer,
40
40
  commonAncestorContainer = _range.commonAncestorContainer;
41
+ var parentNode = startContainer.parentNode;
41
42
 
42
43
  // ED-23493
43
44
  // On triple-click in Chrome and Safari, the native Selection API's range has endContainer as a non-text node
@@ -51,8 +52,11 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
51
52
  // platform/packages/editor/renderer/src/steps/index.ts Line 180
52
53
 
53
54
  // This workaround ensures the endContainer is set to a text node when endContainer is non-text and the parent container is the root element
54
- if (isTripleClick && (0, _steps.isRoot)(commonAncestorContainer)) {
55
- _range.setEnd(startContainer, startContainer.length || 0);
55
+ if (isTripleClick && (0, _steps.isRoot)(commonAncestorContainer) && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === 'P' // ignore if the parent node is strong, em, etc.
56
+ ) {
57
+ var _parentNode$lastChild, _parentNode$lastChild2;
58
+ var lastChild = parentNode !== null && parentNode !== void 0 && parentNode.lastChild && (parentNode === null || parentNode === void 0 || (_parentNode$lastChild = parentNode.lastChild) === null || _parentNode$lastChild === void 0 ? void 0 : _parentNode$lastChild.nodeType) === Node.TEXT_NODE ? parentNode === null || parentNode === void 0 ? void 0 : parentNode.lastChild : parentNode === null || parentNode === void 0 || (_parentNode$lastChild2 = parentNode.lastChild) === null || _parentNode$lastChild2 === void 0 ? void 0 : _parentNode$lastChild2.childNodes[0];
59
+ _range.setEnd(lastChild, lastChild.length || 0);
56
60
  }
57
61
  }
58
62
  setRange(_range.cloneRange());
@@ -2,6 +2,7 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/anal
2
2
  import React from 'react';
3
3
  import AnalyticsContext from '../../analytics/analyticsContext';
4
4
  import { ElementSelection } from './element-selection';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  export const useSelectAllTrap = () => {
6
7
  const {
7
8
  fireAnalyticsEvent
@@ -11,6 +12,7 @@ export const useSelectAllTrap = () => {
11
12
  const caught = React.useRef();
12
13
  const mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
13
14
  const onKeyDown = React.useCallback(e => {
15
+ var _e$target, _e$target$matches;
14
16
  const el = ref.current;
15
17
  if (!el) {
16
18
  return;
@@ -20,7 +22,8 @@ export const useSelectAllTrap = () => {
20
22
  return;
21
23
  }
22
24
  const elementSelection = ElementSelection.fromWindow();
23
- if (elementSelection.eq(caught.current)) {
25
+ const isInput = fg('platform-datasources-enable-two-way-sync') ? (_e$target = e.target) === null || _e$target === void 0 ? void 0 : (_e$target$matches = _e$target.matches) === null || _e$target$matches === void 0 ? void 0 : _e$target$matches.call(_e$target, 'input') : false;
26
+ if (elementSelection.eq(caught.current) || isInput) {
24
27
  fireAnalyticsEvent({
25
28
  eventType: EVENT_TYPE.TRACK,
26
29
  action: ACTION.SELECT_ALL_ESCAPED,
@@ -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 = "110.0.1";
48
+ const packageVersion = "110.0.3";
49
49
  export const defaultNodeComponents = nodeToReact;
50
50
  export class Renderer extends PureComponent {
51
51
  constructor(props) {
@@ -40,6 +40,7 @@ export const useUserSelectionRange = props => {
40
40
  endContainer,
41
41
  commonAncestorContainer
42
42
  } = _range;
43
+ const parentNode = startContainer.parentNode;
43
44
 
44
45
  // ED-23493
45
46
  // On triple-click in Chrome and Safari, the native Selection API's range has endContainer as a non-text node
@@ -53,8 +54,11 @@ export const useUserSelectionRange = props => {
53
54
  // platform/packages/editor/renderer/src/steps/index.ts Line 180
54
55
 
55
56
  // This workaround ensures the endContainer is set to a text node when endContainer is non-text and the parent container is the root element
56
- if (isTripleClick && isRoot(commonAncestorContainer)) {
57
- _range.setEnd(startContainer, startContainer.length || 0);
57
+ if (isTripleClick && isRoot(commonAncestorContainer) && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === 'P' // ignore if the parent node is strong, em, etc.
58
+ ) {
59
+ var _parentNode$lastChild, _parentNode$lastChild2;
60
+ const lastChild = parentNode !== null && parentNode !== void 0 && parentNode.lastChild && (parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$lastChild = parentNode.lastChild) === null || _parentNode$lastChild === void 0 ? void 0 : _parentNode$lastChild.nodeType) === Node.TEXT_NODE ? parentNode === null || parentNode === void 0 ? void 0 : parentNode.lastChild : parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$lastChild2 = parentNode.lastChild) === null || _parentNode$lastChild2 === void 0 ? void 0 : _parentNode$lastChild2.childNodes[0];
61
+ _range.setEnd(lastChild, lastChild.length || 0);
58
62
  }
59
63
  }
60
64
  setRange(_range.cloneRange());
@@ -2,6 +2,7 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/anal
2
2
  import React from 'react';
3
3
  import AnalyticsContext from '../../analytics/analyticsContext';
4
4
  import { ElementSelection } from './element-selection';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  export var useSelectAllTrap = function useSelectAllTrap() {
6
7
  var _React$useContext = React.useContext(AnalyticsContext),
7
8
  fireAnalyticsEvent = _React$useContext.fireAnalyticsEvent;
@@ -10,6 +11,7 @@ export var useSelectAllTrap = function useSelectAllTrap() {
10
11
  var caught = React.useRef();
11
12
  var mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
12
13
  var onKeyDown = React.useCallback(function (e) {
14
+ var _e$target, _e$target$matches;
13
15
  var el = ref.current;
14
16
  if (!el) {
15
17
  return;
@@ -19,7 +21,8 @@ export var useSelectAllTrap = function useSelectAllTrap() {
19
21
  return;
20
22
  }
21
23
  var elementSelection = ElementSelection.fromWindow();
22
- if (elementSelection.eq(caught.current)) {
24
+ var isInput = fg('platform-datasources-enable-two-way-sync') ? (_e$target = e.target) === null || _e$target === void 0 || (_e$target$matches = _e$target.matches) === null || _e$target$matches === void 0 ? void 0 : _e$target$matches.call(_e$target, 'input') : false;
25
+ if (elementSelection.eq(caught.current) || isInput) {
23
26
  fireAnalyticsEvent({
24
27
  eventType: EVENT_TYPE.TRACK,
25
28
  action: ACTION.SELECT_ALL_ESCAPED,
@@ -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 = "110.0.1";
58
+ var packageVersion = "110.0.3";
59
59
  export var defaultNodeComponents = nodeToReact;
60
60
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
61
61
  _inherits(Renderer, _PureComponent);
@@ -32,6 +32,7 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
32
32
  var startContainer = _range.startContainer,
33
33
  endContainer = _range.endContainer,
34
34
  commonAncestorContainer = _range.commonAncestorContainer;
35
+ var parentNode = startContainer.parentNode;
35
36
 
36
37
  // ED-23493
37
38
  // On triple-click in Chrome and Safari, the native Selection API's range has endContainer as a non-text node
@@ -45,8 +46,11 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
45
46
  // platform/packages/editor/renderer/src/steps/index.ts Line 180
46
47
 
47
48
  // This workaround ensures the endContainer is set to a text node when endContainer is non-text and the parent container is the root element
48
- if (isTripleClick && isRoot(commonAncestorContainer)) {
49
- _range.setEnd(startContainer, startContainer.length || 0);
49
+ if (isTripleClick && isRoot(commonAncestorContainer) && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === 'P' // ignore if the parent node is strong, em, etc.
50
+ ) {
51
+ var _parentNode$lastChild, _parentNode$lastChild2;
52
+ var lastChild = parentNode !== null && parentNode !== void 0 && parentNode.lastChild && (parentNode === null || parentNode === void 0 || (_parentNode$lastChild = parentNode.lastChild) === null || _parentNode$lastChild === void 0 ? void 0 : _parentNode$lastChild.nodeType) === Node.TEXT_NODE ? parentNode === null || parentNode === void 0 ? void 0 : parentNode.lastChild : parentNode === null || parentNode === void 0 || (_parentNode$lastChild2 = parentNode.lastChild) === null || _parentNode$lastChild2 === void 0 ? void 0 : _parentNode$lastChild2.childNodes[0];
53
+ _range.setEnd(lastChild, lastChild.length || 0);
50
54
  }
51
55
  }
52
56
  setRange(_range.cloneRange());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "110.0.1",
3
+ "version": "110.0.3",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,22 +29,22 @@
29
29
  "@atlaskit/analytics-next": "^10.1.0",
30
30
  "@atlaskit/button": "^20.1.0",
31
31
  "@atlaskit/code": "^15.6.0",
32
- "@atlaskit/editor-common": "^89.0.0",
32
+ "@atlaskit/editor-common": "^89.1.0",
33
33
  "@atlaskit/editor-json-transformer": "^8.18.0",
34
34
  "@atlaskit/editor-palette": "1.6.0",
35
35
  "@atlaskit/editor-prosemirror": "6.0.0",
36
36
  "@atlaskit/editor-shared-styles": "^2.13.0",
37
37
  "@atlaskit/emoji": "^67.7.0",
38
- "@atlaskit/feature-gate-js-client": "^4.18.0",
39
- "@atlaskit/icon": "^22.16.0",
38
+ "@atlaskit/feature-gate-js-client": "^4.19.0",
39
+ "@atlaskit/icon": "^22.18.0",
40
40
  "@atlaskit/link-datasource": "^3.0.0",
41
- "@atlaskit/media-card": "^78.2.0",
42
- "@atlaskit/media-client": "^27.6.0",
41
+ "@atlaskit/media-card": "^78.3.0",
42
+ "@atlaskit/media-client": "^28.0.0",
43
43
  "@atlaskit/media-client-react": "^2.2.0",
44
44
  "@atlaskit/media-common": "^11.4.0",
45
45
  "@atlaskit/media-filmstrip": "^47.2.0",
46
46
  "@atlaskit/media-ui": "^25.11.0",
47
- "@atlaskit/media-viewer": "^48.7.0",
47
+ "@atlaskit/media-viewer": "^48.8.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/smart-card": "^28.1.0",
50
50
  "@atlaskit/status": "^1.4.0",
@@ -148,6 +148,9 @@
148
148
  },
149
149
  "platform_editor_allow_annotation_triple_click": {
150
150
  "type": "boolean"
151
+ },
152
+ "platform-datasources-enable-two-way-sync": {
153
+ "type": "boolean"
151
154
  }
152
155
  },
153
156
  "af:exports": {