@atlaskit/editor-core 189.0.6 → 189.0.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/{labs/CollapsedEditor → CollapsedEditor}/index.js +2 -2
  3. package/dist/cjs/{labs/EditorWithActions → EditorWithActions}/index.js +3 -3
  4. package/dist/cjs/create-editor/create-preset.js +1 -1
  5. package/dist/cjs/editor.js +1 -1
  6. package/dist/cjs/labs-next.js +1 -1
  7. package/dist/cjs/plugins/tasks-and-decisions/index.js +15 -5
  8. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +16 -5
  9. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.js +40 -0
  10. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +31 -31
  11. package/dist/cjs/preset-default.js +1 -1
  12. package/dist/cjs/preset-universal.js +1 -1
  13. package/dist/cjs/{labs/next/presets → presets}/default.js +7 -7
  14. package/dist/cjs/{labs/next/presets → presets}/universal.js +2 -2
  15. package/dist/cjs/{labs/next/presets → presets}/useUniversalPreset.js +2 -2
  16. package/dist/cjs/ui/CollapsedEditor/index.js +1 -1
  17. package/dist/cjs/version-wrapper.js +1 -1
  18. package/dist/es2019/{labs/CollapsedEditor → CollapsedEditor}/index.js +2 -2
  19. package/dist/es2019/{labs/EditorWithActions → EditorWithActions}/index.js +3 -3
  20. package/dist/es2019/create-editor/create-preset.js +1 -1
  21. package/dist/es2019/editor.js +1 -1
  22. package/dist/es2019/labs-next.js +1 -1
  23. package/dist/es2019/plugins/tasks-and-decisions/index.js +11 -1
  24. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +16 -6
  25. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.js +36 -0
  26. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +29 -30
  27. package/dist/es2019/preset-default.js +1 -1
  28. package/dist/es2019/preset-universal.js +1 -1
  29. package/dist/es2019/{labs/next/presets → presets}/default.js +7 -7
  30. package/dist/es2019/{labs/next/presets → presets}/universal.js +2 -2
  31. package/dist/es2019/{labs/next/presets → presets}/useUniversalPreset.js +2 -2
  32. package/dist/es2019/ui/CollapsedEditor/index.js +1 -1
  33. package/dist/es2019/version-wrapper.js +1 -1
  34. package/dist/esm/{labs/CollapsedEditor → CollapsedEditor}/index.js +2 -2
  35. package/dist/esm/{labs/EditorWithActions → EditorWithActions}/index.js +3 -3
  36. package/dist/esm/create-editor/create-preset.js +1 -1
  37. package/dist/esm/editor.js +1 -1
  38. package/dist/esm/labs-next.js +1 -1
  39. package/dist/esm/plugins/tasks-and-decisions/index.js +11 -1
  40. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +16 -5
  41. package/dist/esm/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.js +34 -0
  42. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +31 -32
  43. package/dist/esm/preset-default.js +1 -1
  44. package/dist/esm/preset-universal.js +1 -1
  45. package/dist/esm/{labs/next/presets → presets}/default.js +7 -7
  46. package/dist/esm/{labs/next/presets → presets}/universal.js +2 -2
  47. package/dist/esm/{labs/next/presets → presets}/useUniversalPreset.js +2 -2
  48. package/dist/esm/ui/CollapsedEditor/index.js +1 -1
  49. package/dist/esm/version-wrapper.js +1 -1
  50. package/dist/types/{labs/CollapsedEditor → CollapsedEditor}/index.d.ts +1 -1
  51. package/dist/{types-ts4.5/labs → types}/EditorWithActions/index.d.ts +2 -2
  52. package/dist/types/create-editor/create-plugins-list.d.ts +2 -2
  53. package/dist/types/labs-next.d.ts +1 -1
  54. package/dist/types/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.d.ts +11 -0
  55. package/dist/types/plugins/tasks-and-decisions/types.d.ts +4 -0
  56. package/dist/types/preset-default.d.ts +1 -1
  57. package/dist/types/preset-universal.d.ts +1 -1
  58. package/dist/types/{labs/next/presets → presets}/default.d.ts +4 -4
  59. package/dist/types/{labs/next/presets → presets}/types.d.ts +1 -1
  60. package/dist/types/{labs/next/presets → presets}/universal.d.ts +2 -2
  61. package/dist/types/{labs/next/presets → presets}/useUniversalPreset.d.ts +1 -1
  62. package/dist/types-ts4.5/{labs/CollapsedEditor → CollapsedEditor}/index.d.ts +1 -1
  63. package/dist/{types/labs → types-ts4.5}/EditorWithActions/index.d.ts +2 -2
  64. package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +2 -2
  65. package/dist/types-ts4.5/labs-next.d.ts +1 -1
  66. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/hooks/use-show-placeholder.d.ts +11 -0
  67. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +4 -0
  68. package/dist/types-ts4.5/preset-default.d.ts +1 -1
  69. package/dist/types-ts4.5/preset-universal.d.ts +1 -1
  70. package/dist/types-ts4.5/{labs/next/presets → presets}/default.d.ts +4 -4
  71. package/dist/types-ts4.5/{labs/next/presets → presets}/types.d.ts +1 -1
  72. package/dist/types-ts4.5/{labs/next/presets → presets}/universal.d.ts +2 -2
  73. package/dist/types-ts4.5/{labs/next/presets → presets}/useUniversalPreset.d.ts +1 -1
  74. package/package.json +3 -3
  75. /package/dist/cjs/{labs/next/presets → presets}/types.js +0 -0
  76. /package/dist/es2019/{labs/next/presets → presets}/types.js +0 -0
  77. /package/dist/esm/{labs/next/presets → presets}/types.js +0 -0
@@ -2,34 +2,38 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { AnalyticsListener } from '@atlaskit/analytics-next';
4
4
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
5
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
5
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
7
- import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
8
- import { stateKey as taskPluginKey } from '../pm-plugins/plugin-key';
6
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
+ import { useShowPlaceholder } from './hooks/use-show-placeholder';
9
8
  import TaskItem from '../ui/Task';
10
-
11
- //import { isTypeAheadOpen } from '../../type-ahead/utils';
12
-
13
9
  const TaskItemWrapper = ({
14
10
  localId,
15
11
  forwardRef,
16
12
  isDone,
17
13
  onChange,
18
- isFocused,
19
- isContentNodeEmpty,
20
14
  providerFactory,
21
- api
15
+ isContentNodeEmpty,
16
+ api,
17
+ getPos,
18
+ editorView
22
19
  }) => {
23
20
  const {
24
- typeAheadState
25
- } = useSharedPluginState(api, ['typeAhead']);
21
+ taskDecisionState
22
+ } = useSharedPluginState(api, ['taskDecision']);
23
+ const isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
24
+ const showPlaceholder = useShowPlaceholder({
25
+ editorView,
26
+ isContentNodeEmpty,
27
+ getPos,
28
+ api
29
+ });
26
30
  return /*#__PURE__*/React.createElement(TaskItem, {
27
31
  taskId: localId,
28
32
  contentRef: forwardRef,
29
33
  isDone: isDone,
30
34
  onChange: onChange,
31
35
  isFocused: isFocused,
32
- showPlaceholder: isContentNodeEmpty && !(typeAheadState !== null && typeAheadState !== void 0 && typeAheadState.isOpen),
36
+ showPlaceholder: showPlaceholder,
33
37
  providers: providerFactory
34
38
  });
35
39
  };
@@ -130,24 +134,19 @@ class Task extends ReactNodeView {
130
134
  return /*#__PURE__*/React.createElement(AnalyticsListener, {
131
135
  channel: "fabric-elements",
132
136
  onEvent: this.addListAnalyticsData
133
- }, /*#__PURE__*/React.createElement(WithPluginState, {
134
- plugins: {
135
- taskDecisionPlugin: taskPluginKey
136
- },
137
- render: ({
138
- taskDecisionPlugin
139
- }) => {
140
- return /*#__PURE__*/React.createElement(TaskItemWrapper, {
141
- localId: localId,
142
- forwardRef: forwardRef,
143
- isDone: state === 'DONE',
144
- onChange: this.handleOnChange,
145
- isFocused: Boolean((taskDecisionPlugin === null || taskDecisionPlugin === void 0 ? void 0 : taskDecisionPlugin.focusedTaskItemLocalId) === localId),
146
- isContentNodeEmpty: isContentNodeEmpty,
147
- providerFactory: props.providerFactory,
148
- api: this.api
149
- });
150
- }
137
+ }, /*#__PURE__*/React.createElement(TaskItemWrapper, {
138
+ localId: localId,
139
+ forwardRef: forwardRef,
140
+ isDone: state === 'DONE',
141
+ onChange: this.handleOnChange,
142
+ isContentNodeEmpty: isContentNodeEmpty,
143
+ providerFactory: props.providerFactory
144
+ // The getPosHandler type is wrong, there is no `boolean` in the real implementation
145
+ // @ts-expect-error 2322: Type 'getPosHandler' is not assignable to type '() => number | undefined'.
146
+ ,
147
+ getPos: this.getPos,
148
+ editorView: this.view,
149
+ api: this.api
151
150
  }));
152
151
  }
153
152
  viewShouldUpdate(nextNode) {
@@ -1 +1 @@
1
- export { createDefaultPreset } from './labs/next/presets/default';
1
+ export { createDefaultPreset } from './presets/default';
@@ -1 +1 @@
1
- export { default as useUniversalPreset } from './labs/next/presets/useUniversalPreset';
1
+ export { default as useUniversalPreset } from './presets/useUniversalPreset';
@@ -1,8 +1,8 @@
1
1
  // #region Imports
2
2
 
3
- import pastePlugin from '../../../plugins/paste';
3
+ import pastePlugin from '../plugins/paste';
4
4
  import { blockTypePlugin } from '@atlaskit/editor-plugin-block-type';
5
- import clearMarksOnChangeToEmptyDocumentPlugin from '../../../plugins/clear-marks-on-change-to-empty-document';
5
+ import clearMarksOnChangeToEmptyDocumentPlugin from '../plugins/clear-marks-on-change-to-empty-document';
6
6
  import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
7
  import { textFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
8
8
  import { betterTypeHistoryPlugin } from '@atlaskit/editor-plugin-better-type-history';
@@ -13,20 +13,20 @@ import { focusPlugin } from '@atlaskit/editor-plugin-focus';
13
13
  import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
14
14
  import { typeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
15
15
  import { submitEditorPlugin } from '@atlaskit/editor-plugin-submit-editor';
16
- import fakeTextCursorPlugin from '../../../plugins/fake-text-cursor';
16
+ import fakeTextCursorPlugin from '../plugins/fake-text-cursor';
17
17
  import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
18
18
  import { copyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
19
19
  import { floatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
20
20
  import { clipboardPlugin } from '@atlaskit/editor-plugin-clipboard';
21
- import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../../../plugins';
21
+ import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../plugins';
22
22
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
23
23
  import { placeholderPlugin } from '@atlaskit/editor-plugin-placeholder';
24
- import annotationPlugin from '../../../plugins/annotation';
24
+ import annotationPlugin from '../plugins/annotation';
25
25
  import { compositionPlugin } from '@atlaskit/editor-plugin-composition';
26
26
  import { quickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
27
27
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
28
- import codeBlockPlugin from '../../../plugins/code-block';
29
- import undoRedoPlugin from '../../../plugins/undo-redo';
28
+ import codeBlockPlugin from '../plugins/code-block';
29
+ import undoRedoPlugin from '../plugins/undo-redo';
30
30
  import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
31
31
  import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
32
32
  // #endregion
@@ -1,4 +1,4 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
1
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
2
2
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
3
3
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
4
4
  import { datePlugin } from '@atlaskit/editor-plugin-date';
@@ -22,7 +22,7 @@ import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
22
22
  import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
23
23
  import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
24
24
  import { selectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
25
- import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
25
+ import { isFullPage as fullPageCheck } from '../utils/is-full-page';
26
26
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
27
27
  import { createDefaultPreset } from './default';
28
28
  import { shouldForceTracking } from '@atlaskit/editor-common/utils';
@@ -1,7 +1,7 @@
1
1
  import { useLayoutEffect, useState } from 'react';
2
2
  import { usePreviousState } from '@atlaskit/editor-common/hooks';
3
- import { createPreset } from '../../../create-editor/create-preset';
4
- import { shouldRecreatePreset } from '../../../create-editor/preset-utils';
3
+ import { createPreset } from '../create-editor/create-preset';
4
+ import { shouldRecreatePreset } from '../create-editor/preset-utils';
5
5
  export default function useUniversalPreset({
6
6
  props
7
7
  }) {
@@ -3,7 +3,7 @@ import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
3
3
  import React from 'react';
4
4
  import Editor from '../../editor';
5
5
  import { ComposableEditor } from '../../composable-editor';
6
- import EditorWithActions from '../../labs/EditorWithActions';
6
+ import EditorWithActions from '../../EditorWithActions';
7
7
  import ChromeCollapsed from '../ChromeCollapsed';
8
8
  export default class CollapsedEditor extends React.Component {
9
9
  constructor(...args) {
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "189.0.6";
2
+ export const version = "189.0.10";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -10,7 +10,7 @@ var _excluded = ["Editor"];
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import React from 'react';
13
- import ChromeCollapsed from '../../ui/ChromeCollapsed';
13
+ import ChromeCollapsed from '../ui/ChromeCollapsed';
14
14
  var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
15
15
  _inherits(CollapsedEditor, _React$Component);
16
16
  var _super = _createSuper(CollapsedEditor);
@@ -37,7 +37,7 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
37
37
  key: "loadEditorModules",
38
38
  value: function loadEditorModules() {
39
39
  var _this2 = this;
40
- import( /* webpackChunkName:"@atlaskit-internal_editor-core-async" */'../../').then(function (modules) {
40
+ import( /* webpackChunkName:"@atlaskit-internal_editor-core-async" */'../').then(function (modules) {
41
41
  CollapsedEditor.editorModules = modules;
42
42
  _this2.setState({
43
43
  editorModules: modules
@@ -10,9 +10,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
11
  import React from 'react';
12
12
  import PropTypes from 'prop-types';
13
- import Editor from '../../editor';
14
- import EditorContext from '../../ui/EditorContext';
15
- import WithEditorActions from '../../ui/WithEditorActions';
13
+ import Editor from '../editor';
14
+ import EditorContext from '../ui/EditorContext';
15
+ import WithEditorActions from '../ui/WithEditorActions';
16
16
  var EditorWithActions = /*#__PURE__*/function (_React$Component) {
17
17
  _inherits(EditorWithActions, _React$Component);
18
18
  var _super = _createSuper(EditorWithActions);
@@ -1,4 +1,4 @@
1
- import createUniversalPreset from '../labs/next/presets/universal';
1
+ import createUniversalPreset from '../presets/universal';
2
2
  import { getDefaultPresetOptionsFromEditorProps } from './create-plugins-list';
3
3
  import { createFeatureFlagsFromProps } from './feature-flags-from-props';
4
4
  // Separate file, we should not accidentally import this into the `ComposableEditor`
@@ -12,7 +12,7 @@ import React from 'react';
12
12
  import { jsx } from '@emotion/react';
13
13
  import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
14
14
  import { ComposableEditor } from './composable-editor';
15
- import useUniversalPreset from './labs/next/presets/useUniversalPreset';
15
+ import useUniversalPreset from './presets/useUniversalPreset';
16
16
  var ComposableEditorWrapper = function ComposableEditorWrapper(_ref) {
17
17
  var props = _ref.props;
18
18
  var preset = useUniversalPreset({
@@ -1 +1 @@
1
- export { createDefaultPreset } from './labs/next/presets/default';
1
+ export { createDefaultPreset } from './presets/default';
@@ -4,8 +4,9 @@ var _templateObject;
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import { decisionItem, decisionList, taskItem, taskList } from '@atlaskit/adf-schema';
6
6
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
- import { messages as insertBlockMessages } from '../insert-block/ui/ToolbarInsertBlock/messages';
7
+ import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
8
8
  import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
9
+ import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
9
10
  import { insertTaskDecisionAction, getListTypes } from './commands';
10
11
  import inputRulePlugin from './pm-plugins/input-rules';
11
12
  import keymap from './pm-plugins/keymaps';
@@ -51,6 +52,15 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
51
52
  node: taskItem
52
53
  }];
53
54
  },
55
+ getSharedState: function getSharedState(editorState) {
56
+ if (!editorState) {
57
+ return undefined;
58
+ }
59
+ var pluginState = taskPluginKey.getState(editorState);
60
+ return {
61
+ focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null
62
+ };
63
+ },
54
64
  pmPlugins: function pmPlugins() {
55
65
  return [{
56
66
  name: 'tasksAndDecisions',
@@ -8,17 +8,23 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
8
8
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
9
9
  import React from 'react';
10
10
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
11
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
+ import { useShowPlaceholder } from './hooks/use-show-placeholder';
12
12
  import DecisionItem from '../ui/Decision';
13
13
  var DecisionItemWrapper = function DecisionItemWrapper(_ref) {
14
14
  var api = _ref.api,
15
+ editorView = _ref.editorView,
15
16
  forwardRef = _ref.forwardRef,
16
- isContentNodeEmpty = _ref.isContentNodeEmpty;
17
- var _useSharedPluginState = useSharedPluginState(api, ['typeAhead']),
18
- typeAheadState = _useSharedPluginState.typeAheadState;
17
+ isContentNodeEmpty = _ref.isContentNodeEmpty,
18
+ getPos = _ref.getPos;
19
+ var showPlaceholder = useShowPlaceholder({
20
+ editorView: editorView,
21
+ isContentNodeEmpty: isContentNodeEmpty,
22
+ getPos: getPos,
23
+ api: api
24
+ });
19
25
  return /*#__PURE__*/React.createElement(DecisionItem, {
20
26
  contentRef: forwardRef,
21
- showPlaceholder: isContentNodeEmpty && !(typeAheadState !== null && typeAheadState !== void 0 && typeAheadState.isOpen)
27
+ showPlaceholder: showPlaceholder
22
28
  });
23
29
  };
24
30
  var Decision = /*#__PURE__*/function (_ReactNodeView) {
@@ -66,6 +72,11 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
66
72
  forwardRef: forwardRef,
67
73
  isContentNodeEmpty: isContentNodeEmpty,
68
74
  api: this.api
75
+ // The getPosHandler type is wrong, there is no `boolean` in the real implementation
76
+ // @ts-expect-error 2322: Type 'getPosHandler' is not assignable to type '() => number | undefined'.
77
+ ,
78
+ getPos: this.getPos,
79
+ editorView: this.view
69
80
  });
70
81
  }
71
82
  }, {
@@ -0,0 +1,34 @@
1
+ import { useMemo } from 'react';
2
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
+ export var useShowPlaceholder = function useShowPlaceholder(_ref) {
5
+ var editorView = _ref.editorView,
6
+ api = _ref.api,
7
+ isContentNodeEmpty = _ref.isContentNodeEmpty,
8
+ getPos = _ref.getPos;
9
+ var _useSharedPluginState = useSharedPluginState(api, ['typeAhead']),
10
+ typeAheadState = _useSharedPluginState.typeAheadState;
11
+ var isTypeAheadOpen = Boolean(typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen);
12
+ var isTypeAheadOpenedInsideItem = useMemo(function () {
13
+ var _selection$$cursor;
14
+ if (!isTypeAheadOpen) {
15
+ return false;
16
+ }
17
+ var itemPosition = getPos();
18
+ if (typeof itemPosition !== 'number') {
19
+ return false;
20
+ }
21
+ var selection = editorView.state.selection;
22
+ if (!(selection instanceof TextSelection)) {
23
+ return false;
24
+ }
25
+ var maybeItemNode = editorView.state.doc.nodeAt(itemPosition);
26
+ var maybeParentItemNode = (_selection$$cursor = selection.$cursor) === null || _selection$$cursor === void 0 ? void 0 : _selection$$cursor.node();
27
+ if (maybeItemNode && maybeParentItemNode && maybeItemNode.eq(maybeParentItemNode)) {
28
+ return true;
29
+ }
30
+ return false;
31
+ }, [isTypeAheadOpen, getPos, editorView]);
32
+ var showPlaceholder = Boolean(!isTypeAheadOpenedInsideItem && isContentNodeEmpty);
33
+ return showPlaceholder;
34
+ };
@@ -13,32 +13,36 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
13
13
  import React from 'react';
14
14
  import { AnalyticsListener } from '@atlaskit/analytics-next';
15
15
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
16
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
17
16
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
18
- import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
19
- import { stateKey as taskPluginKey } from '../pm-plugins/plugin-key';
17
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
18
+ import { useShowPlaceholder } from './hooks/use-show-placeholder';
20
19
  import TaskItem from '../ui/Task';
21
-
22
- //import { isTypeAheadOpen } from '../../type-ahead/utils';
23
-
24
20
  var TaskItemWrapper = function TaskItemWrapper(_ref) {
25
21
  var localId = _ref.localId,
26
22
  forwardRef = _ref.forwardRef,
27
23
  isDone = _ref.isDone,
28
24
  onChange = _ref.onChange,
29
- isFocused = _ref.isFocused,
30
- isContentNodeEmpty = _ref.isContentNodeEmpty,
31
25
  providerFactory = _ref.providerFactory,
32
- api = _ref.api;
33
- var _useSharedPluginState = useSharedPluginState(api, ['typeAhead']),
34
- typeAheadState = _useSharedPluginState.typeAheadState;
26
+ isContentNodeEmpty = _ref.isContentNodeEmpty,
27
+ api = _ref.api,
28
+ getPos = _ref.getPos,
29
+ editorView = _ref.editorView;
30
+ var _useSharedPluginState = useSharedPluginState(api, ['taskDecision']),
31
+ taskDecisionState = _useSharedPluginState.taskDecisionState;
32
+ var isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
33
+ var showPlaceholder = useShowPlaceholder({
34
+ editorView: editorView,
35
+ isContentNodeEmpty: isContentNodeEmpty,
36
+ getPos: getPos,
37
+ api: api
38
+ });
35
39
  return /*#__PURE__*/React.createElement(TaskItem, {
36
40
  taskId: localId,
37
41
  contentRef: forwardRef,
38
42
  isDone: isDone,
39
43
  onChange: onChange,
40
44
  isFocused: isFocused,
41
- showPlaceholder: isContentNodeEmpty && !(typeAheadState !== null && typeAheadState !== void 0 && typeAheadState.isOpen),
45
+ showPlaceholder: showPlaceholder,
42
46
  providers: providerFactory
43
47
  });
44
48
  };
@@ -144,7 +148,6 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
144
148
  }, {
145
149
  key: "render",
146
150
  value: function render(props, forwardRef) {
147
- var _this2 = this;
148
151
  var _this$node$attrs = this.node.attrs,
149
152
  localId = _this$node$attrs.localId,
150
153
  state = _this$node$attrs.state;
@@ -152,23 +155,19 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
152
155
  return /*#__PURE__*/React.createElement(AnalyticsListener, {
153
156
  channel: "fabric-elements",
154
157
  onEvent: this.addListAnalyticsData
155
- }, /*#__PURE__*/React.createElement(WithPluginState, {
156
- plugins: {
157
- taskDecisionPlugin: taskPluginKey
158
- },
159
- render: function render(_ref2) {
160
- var taskDecisionPlugin = _ref2.taskDecisionPlugin;
161
- return /*#__PURE__*/React.createElement(TaskItemWrapper, {
162
- localId: localId,
163
- forwardRef: forwardRef,
164
- isDone: state === 'DONE',
165
- onChange: _this2.handleOnChange,
166
- isFocused: Boolean((taskDecisionPlugin === null || taskDecisionPlugin === void 0 ? void 0 : taskDecisionPlugin.focusedTaskItemLocalId) === localId),
167
- isContentNodeEmpty: isContentNodeEmpty,
168
- providerFactory: props.providerFactory,
169
- api: _this2.api
170
- });
171
- }
158
+ }, /*#__PURE__*/React.createElement(TaskItemWrapper, {
159
+ localId: localId,
160
+ forwardRef: forwardRef,
161
+ isDone: state === 'DONE',
162
+ onChange: this.handleOnChange,
163
+ isContentNodeEmpty: isContentNodeEmpty,
164
+ providerFactory: props.providerFactory
165
+ // The getPosHandler type is wrong, there is no `boolean` in the real implementation
166
+ // @ts-expect-error 2322: Type 'getPosHandler' is not assignable to type '() => number | undefined'.
167
+ ,
168
+ getPos: this.getPos,
169
+ editorView: this.view,
170
+ api: this.api
172
171
  }));
173
172
  }
174
173
  }, {
@@ -184,11 +183,11 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
184
183
  }, {
185
184
  key: "update",
186
185
  value: function update(node, decorations) {
187
- var _this3 = this;
186
+ var _this2 = this;
188
187
  return _get(_getPrototypeOf(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
189
188
  return (
190
189
  // Toggle the placeholder based on whether user input exists
191
- !_this3.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state)
190
+ !_this2.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state)
192
191
  );
193
192
  });
194
193
  }
@@ -1 +1 @@
1
- export { createDefaultPreset } from './labs/next/presets/default';
1
+ export { createDefaultPreset } from './presets/default';
@@ -1 +1 @@
1
- export { default as useUniversalPreset } from './labs/next/presets/useUniversalPreset';
1
+ export { default as useUniversalPreset } from './presets/useUniversalPreset';
@@ -1,8 +1,8 @@
1
1
  // #region Imports
2
2
 
3
- import pastePlugin from '../../../plugins/paste';
3
+ import pastePlugin from '../plugins/paste';
4
4
  import { blockTypePlugin } from '@atlaskit/editor-plugin-block-type';
5
- import clearMarksOnChangeToEmptyDocumentPlugin from '../../../plugins/clear-marks-on-change-to-empty-document';
5
+ import clearMarksOnChangeToEmptyDocumentPlugin from '../plugins/clear-marks-on-change-to-empty-document';
6
6
  import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
7
  import { textFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
8
8
  import { betterTypeHistoryPlugin } from '@atlaskit/editor-plugin-better-type-history';
@@ -13,20 +13,20 @@ import { focusPlugin } from '@atlaskit/editor-plugin-focus';
13
13
  import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
14
14
  import { typeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
15
15
  import { submitEditorPlugin } from '@atlaskit/editor-plugin-submit-editor';
16
- import fakeTextCursorPlugin from '../../../plugins/fake-text-cursor';
16
+ import fakeTextCursorPlugin from '../plugins/fake-text-cursor';
17
17
  import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
18
18
  import { copyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
19
19
  import { floatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
20
20
  import { clipboardPlugin } from '@atlaskit/editor-plugin-clipboard';
21
- import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../../../plugins';
21
+ import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../plugins';
22
22
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
23
23
  import { placeholderPlugin } from '@atlaskit/editor-plugin-placeholder';
24
- import annotationPlugin from '../../../plugins/annotation';
24
+ import annotationPlugin from '../plugins/annotation';
25
25
  import { compositionPlugin } from '@atlaskit/editor-plugin-composition';
26
26
  import { quickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
27
27
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
28
- import codeBlockPlugin from '../../../plugins/code-block';
29
- import undoRedoPlugin from '../../../plugins/undo-redo';
28
+ import codeBlockPlugin from '../plugins/code-block';
29
+ import undoRedoPlugin from '../plugins/undo-redo';
30
30
  import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
31
31
  import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
32
32
  // #endregion
@@ -2,7 +2,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
5
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
6
6
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
7
7
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
8
8
  import { datePlugin } from '@atlaskit/editor-plugin-date';
@@ -26,7 +26,7 @@ import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
26
26
  import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
27
27
  import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
28
28
  import { selectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
29
- import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
29
+ import { isFullPage as fullPageCheck } from '../utils/is-full-page';
30
30
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
31
31
  import { createDefaultPreset } from './default';
32
32
  import { shouldForceTracking } from '@atlaskit/editor-common/utils';
@@ -1,8 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useLayoutEffect, useState } from 'react';
3
3
  import { usePreviousState } from '@atlaskit/editor-common/hooks';
4
- import { createPreset } from '../../../create-editor/create-preset';
5
- import { shouldRecreatePreset } from '../../../create-editor/preset-utils';
4
+ import { createPreset } from '../create-editor/create-preset';
5
+ import { shouldRecreatePreset } from '../create-editor/preset-utils';
6
6
  export default function useUniversalPreset(_ref) {
7
7
  var props = _ref.props;
8
8
  var previousEditorProps = usePreviousState(props);
@@ -11,7 +11,7 @@ import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
11
11
  import React from 'react';
12
12
  import Editor from '../../editor';
13
13
  import { ComposableEditor } from '../../composable-editor';
14
- import EditorWithActions from '../../labs/EditorWithActions';
14
+ import EditorWithActions from '../../EditorWithActions';
15
15
  import ChromeCollapsed from '../ChromeCollapsed';
16
16
  var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
17
17
  _inherits(CollapsedEditor, _React$Component);
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.0.6";
2
+ export var version = "189.0.10";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import * as EditorImports from '../../';
2
+ import type * as EditorImports from '../';
3
3
  export type EditorModule = {
4
4
  EditorContext: typeof EditorImports.EditorContext;
5
5
  WithEditorActions: typeof EditorImports.WithEditorActions;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { EditorProps } from '../../editor';
4
- import EditorActions from '../../actions';
3
+ import type { EditorProps } from '../editor';
4
+ import type EditorActions from '../actions';
5
5
  export interface EditorWithActionsPropsOverride extends EditorProps {
6
6
  onSave?: any;
7
7
  onChange?: any;
@@ -2,8 +2,8 @@ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { EditorPlugin, EditorProps } from '../types';
3
3
  import type { EditorPluginFeatureProps } from '../types/editor-props';
4
4
  import type { ScrollGutterPluginOptions } from '@atlaskit/editor-plugin-base';
5
- import type { DefaultPresetPluginOptions } from '../labs/next/presets/default';
6
- import type { EditorPresetProps } from '../labs/next/presets/types';
5
+ import type { DefaultPresetPluginOptions } from '../presets/default';
6
+ import type { EditorPresetProps } from '../presets/types';
7
7
  import type { EditorPresetBuilder, EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
8
8
  export declare function getScrollGutterOptions(props: EditorProps): ScrollGutterPluginOptions | undefined;
9
9
  export declare function getDefaultPresetOptionsFromEditorProps(props: EditorProps, createAnalyticsEvent?: CreateUIAnalyticsEvent): EditorPresetProps & DefaultPresetPluginOptions & EditorPluginFeatureProps;
@@ -1 +1 @@
1
- export { createDefaultPreset } from './labs/next/presets/default';
1
+ export { createDefaultPreset } from './presets/default';
@@ -0,0 +1,11 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { TaskAndDecisionsPlugin } from '../../types';
4
+ type Props2 = {
5
+ editorView: EditorView;
6
+ api: ExtractInjectionAPI<TaskAndDecisionsPlugin> | undefined;
7
+ getPos: () => number | undefined;
8
+ isContentNodeEmpty: boolean;
9
+ };
10
+ export declare const useShowPlaceholder: ({ editorView, api, isContentNodeEmpty, getPos, }: Props2) => boolean;
11
+ export {};
@@ -26,8 +26,12 @@ export interface TaskDecisionPluginOptions extends LongPressSelectionPluginOptio
26
26
  allowNestedTasks?: boolean;
27
27
  consumeTabs?: boolean;
28
28
  }
29
+ export type TaskAndDecisionsSharedState = {
30
+ focusedTaskItemLocalId: string | null;
31
+ };
29
32
  export type TaskAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
30
33
  pluginConfiguration: TaskDecisionPluginOptions | undefined;
34
+ sharedState: TaskAndDecisionsSharedState | undefined;
31
35
  dependencies: [
32
36
  OptionalPlugin<TypeAheadPlugin>,
33
37
  OptionalPlugin<AnalyticsPlugin>
@@ -1 +1 @@
1
- export { createDefaultPreset } from './labs/next/presets/default';
1
+ export { createDefaultPreset } from './presets/default';
@@ -1 +1 @@
1
- export { default as useUniversalPreset } from './labs/next/presets/useUniversalPreset';
1
+ export { default as useUniversalPreset } from './presets/useUniversalPreset';