@atlaskit/editor-core 216.6.4 → 216.6.5

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/editor-core
2
2
 
3
+ ## 216.6.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5a01e256502a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5a01e256502a0) -
8
+ [EDITOR-3531] Fixed bug where focus is not set to the Editor for chromeless comments editor in
9
+ inline comments
10
+ - Updated dependencies
11
+
3
12
  ## 216.6.4
4
13
 
5
14
  ### Patch Changes
@@ -17,9 +17,6 @@ function handleEditorFocus(view) {
17
17
  if (view !== null && view !== void 0 && view.isDestroyed) {
18
18
  return;
19
19
  }
20
- if (view !== null && view !== void 0 && view.hasFocus()) {
21
- return;
22
- }
23
20
  if (!window.getSelection) {
24
21
  view === null || view === void 0 || view.focus();
25
22
  return;
@@ -37,6 +37,7 @@ var _useProviders = require("../composable-editor/hooks/useProviders");
37
37
  var _featureFlagsFromProps = require("../utils/feature-flags-from-props");
38
38
  var _getNodesCount = require("../utils/getNodesCount");
39
39
  var _getNodesVisibleInViewport = require("../utils/getNodesVisibleInViewport");
40
+ var _isChromeless = require("../utils/is-chromeless");
40
41
  var _isFullPage = require("../utils/is-full-page");
41
42
  var _RenderTracking = require("../utils/performance/components/RenderTracking");
42
43
  var _measureEnum = _interopRequireDefault(require("../utils/performance/measure-enum"));
@@ -553,6 +554,9 @@ function ReactEditorView(props) {
553
554
  if (!liveDocWithContent) {
554
555
  focusTimeoutId.current = (0, _handleEditorFocus.handleEditorFocus)(editorView);
555
556
  }
557
+ if ((0, _isChromeless.isChromeless)(props.editorProps.appearance) && (0, _expValEquals.expValEquals)('platform_editor_focus_on_chromeless_editor', 'isEnabled', true)) {
558
+ focusTimeoutId.current = (0, _handleEditorFocus.handleEditorFocus)(editorView);
559
+ }
556
560
  if ((0, _expValEquals.expValEquals)('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('cc_editor_focus_before_editor_on_load')) {
557
561
  if (!disabled && shouldFocus && !(0, _document.isEmptyDocument)(editorView.state.doc)) {
558
562
  (0, _focusEditorElement.focusEditorElement)(editorId.current);
@@ -560,7 +564,7 @@ function ReactEditorView(props) {
560
564
  }
561
565
  }
562
566
  }
563
- }, [editorView, shouldFocus, __livePage, mitigateScrollJump, disabled]);
567
+ }, [editorView, shouldFocus, __livePage, mitigateScrollJump, disabled, props.editorProps.appearance]);
564
568
  var scrollElement = _react.default.useRef();
565
569
  var possibleListeners = _react.default.useRef([]);
566
570
  (0, _react.useEffect)(function () {
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isChromeless = isChromeless;
7
+ function isChromeless(appearance) {
8
+ return appearance === 'chromeless';
9
+ }
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "216.6.3";
8
+ var version = exports.version = "0.0.0-development";
@@ -11,9 +11,6 @@ export function handleEditorFocus(view) {
11
11
  if (view !== null && view !== void 0 && view.isDestroyed) {
12
12
  return;
13
13
  }
14
- if (view !== null && view !== void 0 && view.hasFocus()) {
15
- return;
16
- }
17
14
  if (!window.getSelection) {
18
15
  view === null || view === void 0 ? void 0 : view.focus();
19
16
  return;
@@ -26,6 +26,7 @@ import { useProviders } from '../composable-editor/hooks/useProviders';
26
26
  import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
27
27
  import { getNodesCount } from '../utils/getNodesCount';
28
28
  import { getNodesVisibleInViewport } from '../utils/getNodesVisibleInViewport';
29
+ import { isChromeless } from '../utils/is-chromeless';
29
30
  import { isFullPage } from '../utils/is-full-page';
30
31
  import { RenderTracking } from '../utils/performance/components/RenderTracking';
31
32
  import measurements from '../utils/performance/measure-enum';
@@ -522,6 +523,9 @@ export function ReactEditorView(props) {
522
523
  if (!liveDocWithContent) {
523
524
  focusTimeoutId.current = handleEditorFocus(editorView);
524
525
  }
526
+ if (isChromeless(props.editorProps.appearance) && expValEquals('platform_editor_focus_on_chromeless_editor', 'isEnabled', true)) {
527
+ focusTimeoutId.current = handleEditorFocus(editorView);
528
+ }
525
529
  if (expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && fg('cc_editor_focus_before_editor_on_load')) {
526
530
  if (!disabled && shouldFocus && !isEmptyDocument(editorView.state.doc)) {
527
531
  focusEditorElement(editorId.current);
@@ -529,7 +533,7 @@ export function ReactEditorView(props) {
529
533
  }
530
534
  }
531
535
  }
532
- }, [editorView, shouldFocus, __livePage, mitigateScrollJump, disabled]);
536
+ }, [editorView, shouldFocus, __livePage, mitigateScrollJump, disabled, props.editorProps.appearance]);
533
537
  const scrollElement = React.useRef();
534
538
  const possibleListeners = React.useRef([]);
535
539
  useEffect(() => {
@@ -0,0 +1,3 @@
1
+ export function isChromeless(appearance) {
2
+ return appearance === 'chromeless';
3
+ }
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "216.6.3";
2
+ export const version = "0.0.0-development";
@@ -11,9 +11,6 @@ export function handleEditorFocus(view) {
11
11
  if (view !== null && view !== void 0 && view.isDestroyed) {
12
12
  return;
13
13
  }
14
- if (view !== null && view !== void 0 && view.hasFocus()) {
15
- return;
16
- }
17
14
  if (!window.getSelection) {
18
15
  view === null || view === void 0 || view.focus();
19
16
  return;
@@ -34,6 +34,7 @@ import { useProviders } from '../composable-editor/hooks/useProviders';
34
34
  import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
35
35
  import { getNodesCount } from '../utils/getNodesCount';
36
36
  import { getNodesVisibleInViewport } from '../utils/getNodesVisibleInViewport';
37
+ import { isChromeless } from '../utils/is-chromeless';
37
38
  import { isFullPage } from '../utils/is-full-page';
38
39
  import { RenderTracking } from '../utils/performance/components/RenderTracking';
39
40
  import measurements from '../utils/performance/measure-enum';
@@ -544,6 +545,9 @@ export function ReactEditorView(props) {
544
545
  if (!liveDocWithContent) {
545
546
  focusTimeoutId.current = handleEditorFocus(editorView);
546
547
  }
548
+ if (isChromeless(props.editorProps.appearance) && expValEquals('platform_editor_focus_on_chromeless_editor', 'isEnabled', true)) {
549
+ focusTimeoutId.current = handleEditorFocus(editorView);
550
+ }
547
551
  if (expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && fg('cc_editor_focus_before_editor_on_load')) {
548
552
  if (!disabled && shouldFocus && !isEmptyDocument(editorView.state.doc)) {
549
553
  focusEditorElement(editorId.current);
@@ -551,7 +555,7 @@ export function ReactEditorView(props) {
551
555
  }
552
556
  }
553
557
  }
554
- }, [editorView, shouldFocus, __livePage, mitigateScrollJump, disabled]);
558
+ }, [editorView, shouldFocus, __livePage, mitigateScrollJump, disabled, props.editorProps.appearance]);
555
559
  var scrollElement = React.useRef();
556
560
  var possibleListeners = React.useRef([]);
557
561
  useEffect(function () {
@@ -0,0 +1,3 @@
1
+ export function isChromeless(appearance) {
2
+ return appearance === 'chromeless';
3
+ }
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "216.6.3";
2
+ export var version = "0.0.0-development";
@@ -0,0 +1,2 @@
1
+ import type { EditorAppearance } from '@atlaskit/editor-common/types';
2
+ export declare function isChromeless(appearance?: EditorAppearance): appearance is "chromeless";
@@ -0,0 +1,2 @@
1
+ import type { EditorAppearance } from '@atlaskit/editor-common/types';
2
+ export declare function isChromeless(appearance?: EditorAppearance): appearance is "chromeless";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "216.6.4",
3
+ "version": "216.6.5",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
67
67
  "@atlaskit/react-ufo": "^4.17.0",
68
68
  "@atlaskit/task-decision": "^19.2.0",
69
- "@atlaskit/tmp-editor-statsig": "^16.19.0",
69
+ "@atlaskit/tmp-editor-statsig": "^16.22.0",
70
70
  "@atlaskit/tokens": "^9.1.0",
71
71
  "@atlaskit/tooltip": "^20.14.0",
72
72
  "@atlaskit/width-detector": "^5.0.0",