@atlaskit/editor-core 216.6.4 → 216.6.6

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,20 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 216.6.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 216.6.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`5a01e256502a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5a01e256502a0) -
14
+ [EDITOR-3531] Fixed bug where focus is not set to the Editor for chromeless comments editor in
15
+ inline comments
16
+ - Updated dependencies
17
+
3
18
  ## 216.6.4
4
19
 
5
20
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../../tsconfig.entry-points.products.json",
2
+ "extends": "../../../../tsconfig.local-consumption.json",
3
3
  "compilerOptions": {
4
4
  "declaration": true,
5
5
  "target": "es5",
@@ -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 () {
@@ -46,7 +46,9 @@ var CollapsedEditor = exports.default = /*#__PURE__*/function (_React$Component)
46
46
  }
47
47
  }, {
48
48
  key: "render",
49
- value: function render() {
49
+ value:
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ function render() {
50
52
  var _this2 = this;
51
53
  var child = _react.default.Children.only(this.props.children);
52
54
  this.functionalEditor = typeof child.type === '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 = "216.6.5";
@@ -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(() => {
@@ -21,6 +21,7 @@ export default class CollapsedEditor extends React.Component {
21
21
  }
22
22
  this.previouslyExpanded = this.props.isExpanded;
23
23
  }
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  render() {
25
26
  const child = React.Children.only(this.props.children);
26
27
  this.functionalEditor = typeof child.type === 'function';
@@ -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 = "216.6.5";
@@ -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 () {
@@ -39,7 +39,9 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
39
39
  }
40
40
  }, {
41
41
  key: "render",
42
- value: function render() {
42
+ value:
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ function render() {
43
45
  var _this2 = this;
44
46
  var child = React.Children.only(this.props.children);
45
47
  this.functionalEditor = typeof child.type === '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 = "216.6.5";
@@ -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/docs/0-intro.tsx CHANGED
@@ -2,7 +2,8 @@ import React from 'react';
2
2
 
3
3
  import { AtlassianInternalWarning, code, Example, md, Props } from '@atlaskit/docs';
4
4
 
5
- export default md`
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const _default_1: any = md`
6
7
  ${(<AtlassianInternalWarning />)}
7
8
  ## Introduction
8
9
 
@@ -387,26 +388,27 @@ function EditorInternal() {
387
388
 
388
389
 
389
390
  ${(
390
- <Example
391
- packageName="@atlaskit/editor-core/composable-editor"
392
- // Ignored via go/ees005
393
- // eslint-disable-next-line import/no-commonjs
394
- Component={require('../examples/1-basic-composable-editor').default}
395
- title="Basic"
396
- // Ignored via go/ees005
397
- // eslint-disable-next-line import/no-commonjs
398
- source={require('!!raw-loader!../examples/1-basic-composable-editor')}
399
- />
400
- )}
391
+ <Example
392
+ packageName="@atlaskit/editor-core/composable-editor"
393
+ // Ignored via go/ees005
394
+ // eslint-disable-next-line import/no-commonjs
395
+ Component={require('../examples/1-basic-composable-editor').default}
396
+ title="Basic"
397
+ // Ignored via go/ees005
398
+ // eslint-disable-next-line import/no-commonjs
399
+ source={require('!!raw-loader!../examples/1-basic-composable-editor')}
400
+ />
401
+ )}
401
402
 
402
403
  ${(
403
- <Props
404
- shouldCollapseProps
405
- heading="Props"
406
- // Ignored via go/ees005
407
- // eslint-disable-next-line import/no-commonjs
408
- props={require('!!extract-react-types-loader!../src/composable-editor/composable-editor')}
409
- />
410
- )}
404
+ <Props
405
+ shouldCollapseProps
406
+ heading="Props"
407
+ // Ignored via go/ees005
408
+ // eslint-disable-next-line import/no-commonjs
409
+ props={require('!!extract-react-types-loader!../src/composable-editor/composable-editor')}
410
+ />
411
+ )}
411
412
 
412
413
  `;
414
+ export default _default_1;
@@ -2,7 +2,8 @@ import React from 'react';
2
2
 
3
3
  import { AtlassianInternalWarning, code, Example, md, Props } from '@atlaskit/docs';
4
4
 
5
- export default md`
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const _default_1: any = md`
6
7
  ${(<AtlassianInternalWarning />)}
7
8
 
8
9
  ### Note:
@@ -250,25 +251,26 @@ ${code`
250
251
  `}
251
252
 
252
253
  ${(
253
- <Example
254
- packageName="@atlaskit/editor-core"
255
- // Ignored via go/ees005
256
- // eslint-disable-next-line import/no-commonjs
257
- Component={require('../examples/1-basic-composable-editor').default}
258
- title="Basic"
259
- // Ignored via go/ees005
260
- // eslint-disable-next-line import/no-commonjs
261
- source={require('!!raw-loader!../examples/1-basic-composable-editor')}
262
- />
263
- )}
254
+ <Example
255
+ packageName="@atlaskit/editor-core"
256
+ // Ignored via go/ees005
257
+ // eslint-disable-next-line import/no-commonjs
258
+ Component={require('../examples/1-basic-composable-editor').default}
259
+ title="Basic"
260
+ // Ignored via go/ees005
261
+ // eslint-disable-next-line import/no-commonjs
262
+ source={require('!!raw-loader!../examples/1-basic-composable-editor')}
263
+ />
264
+ )}
264
265
 
265
266
  ${(
266
- <Props
267
- shouldCollapseProps
268
- heading="Props"
269
- // Ignored via go/ees005
270
- // eslint-disable-next-line import/no-commonjs
271
- props={require('!!extract-react-types-loader!../src/editor')}
272
- />
273
- )}
267
+ <Props
268
+ shouldCollapseProps
269
+ heading="Props"
270
+ // Ignored via go/ees005
271
+ // eslint-disable-next-line import/no-commonjs
272
+ props={require('!!extract-react-types-loader!../src/editor')}
273
+ />
274
+ )}
274
275
  `;
276
+ export default _default_1;
package/docs/2-labs.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { code, md } from '@atlaskit/docs';
2
2
 
3
- export default md`
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ const _default_1: any = md`
4
5
  # Editor Labs
5
6
 
6
7
  Where API changes can sit for experimental use
@@ -108,3 +109,4 @@ ${code`
108
109
  )
109
110
  `}
110
111
  `;
112
+ export default _default_1;
@@ -1,6 +1,7 @@
1
1
  import { code, md } from '@atlaskit/docs';
2
2
 
3
- export default md`
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ const _default_1: any = md`
4
5
  # Autoformatting Provider
5
6
 
6
7
  The custom autoformatting provider lets you specify your own function that triggers on particular regex strings, and asynchronously replace them with some content. More precisely, it returns a Promise containing ADF to replace the trigger text with.
@@ -41,3 +42,4 @@ ${code`export const autoformattingProvider: AutoformattingProvider = {
41
42
 
42
43
  At the moment, only text or \`inlineCard\` ADF nodes are permitted to be replaced.
43
44
  `;
45
+ export default _default_1;
@@ -230,7 +230,8 @@ class SplitExample extends React.Component<{ initialAdf: object }> {
230
230
  }
231
231
  }
232
232
 
233
- export default md`
233
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
234
+ const _default_1: any = md`
234
235
  # Annotations
235
236
 
236
237
  ## Introduction
@@ -244,20 +245,20 @@ Currently, there is only the \`inlineComment\` type of annotation. In the future
244
245
  These denote a comment thread about the given text, and are denoted by a yellow highlight. This is commonly seen within Confluence after selecting some text in View mode.
245
246
 
246
247
  ${(
247
- <div
248
- style={{
249
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
250
- margin: token('space.100', '8px'),
251
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
252
- padding: token('space.100', '8px'),
253
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
254
- backgroundColor: N20,
255
- border: `${token('border.width')} solid ${N30}`,
256
- }}
257
- >
258
- {inlineCommentEditor(initialExample)}
259
- </div>
260
- )}
248
+ <div
249
+ style={{
250
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
251
+ margin: token('space.100', '8px'),
252
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
253
+ padding: token('space.100', '8px'),
254
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
255
+ backgroundColor: N20,
256
+ border: `${token('border.width')} solid ${N30}`,
257
+ }}
258
+ >
259
+ {inlineCommentEditor(initialExample)}
260
+ </div>
261
+ )}
261
262
 
262
263
  ### Example ADF
263
264
 
@@ -386,3 +387,4 @@ It is unmounted when exiting a region of text with an annotation.
386
387
 
387
388
  * [ADF change proposal](https://product-fabric.atlassian.net/wiki/spaces/E/pages/853377081/ADF+Change+38+Annotation+mark)
388
389
  `;
390
+ export default _default_1;
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.6",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/editor-shared-styles": "^3.10.0",
57
57
  "@atlaskit/editor-ssr-renderer": "^2.0.0",
58
58
  "@atlaskit/editor-toolbar": "^0.19.0",
59
- "@atlaskit/editor-toolbar-model": "^0.2.0",
59
+ "@atlaskit/editor-toolbar-model": "^0.3.0",
60
60
  "@atlaskit/emoji": "^69.10.0",
61
61
  "@atlaskit/icon": "^29.4.0",
62
62
  "@atlaskit/link": "^3.3.0",
@@ -66,8 +66,8 @@
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",
70
- "@atlaskit/tokens": "^9.1.0",
69
+ "@atlaskit/tmp-editor-statsig": "^16.23.0",
70
+ "@atlaskit/tokens": "^10.0.0",
71
71
  "@atlaskit/tooltip": "^20.14.0",
72
72
  "@atlaskit/width-detector": "^5.0.0",
73
73
  "@babel/runtime": "^7.0.0",
@@ -107,7 +107,7 @@
107
107
  "@atlaskit/media-integration-test-helpers": "workspace:^",
108
108
  "@atlaskit/media-test-helpers": "^39.0.0",
109
109
  "@atlaskit/modal-dialog": "^14.10.0",
110
- "@atlaskit/renderer": "^125.4.0",
110
+ "@atlaskit/renderer": "^126.0.0",
111
111
  "@atlaskit/section-message": "^8.12.0",
112
112
  "@atlaskit/synchrony-test-helpers": "workspace:^",
113
113
  "@atlaskit/toggle": "^15.2.0",