@atlaskit/editor-core 198.6.11 → 198.7.0

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,13 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 198.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#154461](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154461)
8
+ [`ed3b12d7f1092`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ed3b12d7f1092) -
9
+ Remove WithHelpTrigger from Confluence and deprecate
10
+
3
11
  ## 198.6.11
4
12
 
5
13
  ### Patch Changes
@@ -9,30 +9,59 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
11
11
  var _question = _interopRequireDefault(require("@atlaskit/icon/glyph/question"));
12
- var _WithHelpTrigger = _interopRequireDefault(require("../WithHelpTrigger"));
12
+ var _EditorContext = require("../EditorContext");
13
13
  var _messages = require("./messages");
14
+ // Please, do not copy or use this kind of code below
15
+ // This is just a temporary solution to keep the tooltip trigger working for Trello since it's not using the composable editor
16
+ // @ts-ignore
17
+ var fakePluginKey = {
18
+ key: 'helpDialog$',
19
+ getState: function getState(state) {
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ return state['helpDialog$'];
22
+ }
23
+ };
24
+ var openHelpCommand = function openHelpCommand(tr, dispatch) {
25
+ tr = tr.setMeta(fakePluginKey, true);
26
+ if (dispatch) {
27
+ dispatch(tr);
28
+ return true;
29
+ }
30
+ return false;
31
+ };
14
32
  var TooltipHelpTrigger = function TooltipHelpTrigger(_ref) {
15
33
  var _ref$title = _ref.title,
16
34
  title = _ref$title === void 0 ? 'Open help dialog' : _ref$title,
17
35
  _ref$titlePosition = _ref.titlePosition,
18
36
  titlePosition = _ref$titlePosition === void 0 ? 'left' : _ref$titlePosition,
19
- intl = _ref.intl;
37
+ intl = _ref.intl,
38
+ editorApi = _ref.editorApi;
39
+ var editorContext = (0, _EditorContext.useEditorContext)();
40
+
20
41
  // to have translation for the default tooltip helper
21
42
  var displayTitle = title;
22
43
  if (title === 'Open help dialog') {
23
44
  displayTitle = intl.formatMessage(_messages.messages.toolbarHelpTitle);
24
45
  }
25
- return /*#__PURE__*/_react.default.createElement(_WithHelpTrigger.default, {
26
- render: function render(showHelp) {
27
- return /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarButton, {
28
- onClick: showHelp,
29
- title: displayTitle,
30
- titlePosition: titlePosition,
31
- iconBefore: /*#__PURE__*/_react.default.createElement(_question.default, {
32
- label: displayTitle
33
- })
34
- });
46
+ var showHelp = function showHelp() {
47
+ if (editorApi) {
48
+ var _editorApi$helpDialog;
49
+ editorApi === null || editorApi === void 0 || (_editorApi$helpDialog = editorApi.helpDialog) === null || _editorApi$helpDialog === void 0 || _editorApi$helpDialog.actions.openHelp();
50
+ } else {
51
+ var _editorContext$editor;
52
+ var editorView = editorContext === null || editorContext === void 0 || (_editorContext$editor = editorContext.editorActions) === null || _editorContext$editor === void 0 ? void 0 : _editorContext$editor._privateGetEditorView();
53
+ if (editorView) {
54
+ openHelpCommand(editorView.state.tr, editorView.dispatch);
55
+ }
35
56
  }
57
+ };
58
+ return /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarButton, {
59
+ onClick: showHelp,
60
+ title: displayTitle,
61
+ titlePosition: titlePosition,
62
+ iconBefore: /*#__PURE__*/_react.default.createElement(_question.default, {
63
+ label: displayTitle
64
+ })
36
65
  });
37
66
  };
38
67
  var _default = exports.default = (0, _reactIntlNext.injectIntl)(TooltipHelpTrigger);
@@ -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 = "198.6.11";
8
+ var version = exports.version = "198.7.0";
@@ -9,6 +9,11 @@ export {
9
9
  */
10
10
  default as EditorContext } from './ui/EditorContext';
11
11
  export { default as WithEditorActions } from './ui/WithEditorActions';
12
+ /**
13
+ * @deprecated
14
+ * DO NOT USE THIS WILL BE REMOVED SOON AND IS UNSAFE.
15
+ * Please use the the openHelp action via the editorAPI from the `@atlaskit/editor-plugin-help-dialog` plugin.
16
+ */
12
17
  export { default as WithHelpTrigger } from './ui/WithHelpTrigger';
13
18
  export { default as CollapsedEditor } from './ui/CollapsedEditor';
14
19
  export { default as ToolbarHelp } from './ui/ToolbarHelp';
@@ -2,26 +2,57 @@ import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
3
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
4
4
  import QuestionIcon from '@atlaskit/icon/glyph/question';
5
- import WithHelpTrigger from '../WithHelpTrigger';
5
+ import { useEditorContext } from '../EditorContext';
6
6
  import { messages } from './messages';
7
+ // Please, do not copy or use this kind of code below
8
+ // This is just a temporary solution to keep the tooltip trigger working for Trello since it's not using the composable editor
9
+ // @ts-ignore
10
+ const fakePluginKey = {
11
+ key: 'helpDialog$',
12
+ getState: state => {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ return state['helpDialog$'];
15
+ }
16
+ };
17
+ const openHelpCommand = (tr, dispatch) => {
18
+ tr = tr.setMeta(fakePluginKey, true);
19
+ if (dispatch) {
20
+ dispatch(tr);
21
+ return true;
22
+ }
23
+ return false;
24
+ };
7
25
  const TooltipHelpTrigger = ({
8
26
  title = 'Open help dialog',
9
27
  titlePosition = 'left',
10
- intl
28
+ intl,
29
+ editorApi
11
30
  }) => {
31
+ const editorContext = useEditorContext();
32
+
12
33
  // to have translation for the default tooltip helper
13
34
  let displayTitle = title;
14
35
  if (title === 'Open help dialog') {
15
36
  displayTitle = intl.formatMessage(messages.toolbarHelpTitle);
16
37
  }
17
- return /*#__PURE__*/React.createElement(WithHelpTrigger, {
18
- render: showHelp => /*#__PURE__*/React.createElement(ToolbarButton, {
19
- onClick: showHelp,
20
- title: displayTitle,
21
- titlePosition: titlePosition,
22
- iconBefore: /*#__PURE__*/React.createElement(QuestionIcon, {
23
- label: displayTitle
24
- })
38
+ const showHelp = () => {
39
+ if (editorApi) {
40
+ var _editorApi$helpDialog;
41
+ editorApi === null || editorApi === void 0 ? void 0 : (_editorApi$helpDialog = editorApi.helpDialog) === null || _editorApi$helpDialog === void 0 ? void 0 : _editorApi$helpDialog.actions.openHelp();
42
+ } else {
43
+ var _editorContext$editor;
44
+ const editorView = editorContext === null || editorContext === void 0 ? void 0 : (_editorContext$editor = editorContext.editorActions) === null || _editorContext$editor === void 0 ? void 0 : _editorContext$editor._privateGetEditorView();
45
+ if (editorView) {
46
+ openHelpCommand(editorView.state.tr, editorView.dispatch);
47
+ }
48
+ }
49
+ };
50
+ return /*#__PURE__*/React.createElement(ToolbarButton, {
51
+ onClick: showHelp,
52
+ title: displayTitle,
53
+ titlePosition: titlePosition,
54
+ iconBefore: /*#__PURE__*/React.createElement(QuestionIcon, {
55
+ label: displayTitle
25
56
  })
26
57
  });
27
58
  };
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "198.6.11";
2
+ export const version = "198.7.0";
package/dist/esm/index.js CHANGED
@@ -9,6 +9,11 @@ export {
9
9
  */
10
10
  default as EditorContext } from './ui/EditorContext';
11
11
  export { default as WithEditorActions } from './ui/WithEditorActions';
12
+ /**
13
+ * @deprecated
14
+ * DO NOT USE THIS WILL BE REMOVED SOON AND IS UNSAFE.
15
+ * Please use the the openHelp action via the editorAPI from the `@atlaskit/editor-plugin-help-dialog` plugin.
16
+ */
12
17
  export { default as WithHelpTrigger } from './ui/WithHelpTrigger';
13
18
  export { default as CollapsedEditor } from './ui/CollapsedEditor';
14
19
  export { default as ToolbarHelp } from './ui/ToolbarHelp';
@@ -2,30 +2,59 @@ import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
3
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
4
4
  import QuestionIcon from '@atlaskit/icon/glyph/question';
5
- import WithHelpTrigger from '../WithHelpTrigger';
5
+ import { useEditorContext } from '../EditorContext';
6
6
  import { messages } from './messages';
7
+ // Please, do not copy or use this kind of code below
8
+ // This is just a temporary solution to keep the tooltip trigger working for Trello since it's not using the composable editor
9
+ // @ts-ignore
10
+ var fakePluginKey = {
11
+ key: 'helpDialog$',
12
+ getState: function getState(state) {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ return state['helpDialog$'];
15
+ }
16
+ };
17
+ var openHelpCommand = function openHelpCommand(tr, dispatch) {
18
+ tr = tr.setMeta(fakePluginKey, true);
19
+ if (dispatch) {
20
+ dispatch(tr);
21
+ return true;
22
+ }
23
+ return false;
24
+ };
7
25
  var TooltipHelpTrigger = function TooltipHelpTrigger(_ref) {
8
26
  var _ref$title = _ref.title,
9
27
  title = _ref$title === void 0 ? 'Open help dialog' : _ref$title,
10
28
  _ref$titlePosition = _ref.titlePosition,
11
29
  titlePosition = _ref$titlePosition === void 0 ? 'left' : _ref$titlePosition,
12
- intl = _ref.intl;
30
+ intl = _ref.intl,
31
+ editorApi = _ref.editorApi;
32
+ var editorContext = useEditorContext();
33
+
13
34
  // to have translation for the default tooltip helper
14
35
  var displayTitle = title;
15
36
  if (title === 'Open help dialog') {
16
37
  displayTitle = intl.formatMessage(messages.toolbarHelpTitle);
17
38
  }
18
- return /*#__PURE__*/React.createElement(WithHelpTrigger, {
19
- render: function render(showHelp) {
20
- return /*#__PURE__*/React.createElement(ToolbarButton, {
21
- onClick: showHelp,
22
- title: displayTitle,
23
- titlePosition: titlePosition,
24
- iconBefore: /*#__PURE__*/React.createElement(QuestionIcon, {
25
- label: displayTitle
26
- })
27
- });
39
+ var showHelp = function showHelp() {
40
+ if (editorApi) {
41
+ var _editorApi$helpDialog;
42
+ editorApi === null || editorApi === void 0 || (_editorApi$helpDialog = editorApi.helpDialog) === null || _editorApi$helpDialog === void 0 || _editorApi$helpDialog.actions.openHelp();
43
+ } else {
44
+ var _editorContext$editor;
45
+ var editorView = editorContext === null || editorContext === void 0 || (_editorContext$editor = editorContext.editorActions) === null || _editorContext$editor === void 0 ? void 0 : _editorContext$editor._privateGetEditorView();
46
+ if (editorView) {
47
+ openHelpCommand(editorView.state.tr, editorView.dispatch);
48
+ }
28
49
  }
50
+ };
51
+ return /*#__PURE__*/React.createElement(ToolbarButton, {
52
+ onClick: showHelp,
53
+ title: displayTitle,
54
+ titlePosition: titlePosition,
55
+ iconBefore: /*#__PURE__*/React.createElement(QuestionIcon, {
56
+ label: displayTitle
57
+ })
29
58
  });
30
59
  };
31
60
  export default injectIntl(TooltipHelpTrigger);
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "198.6.11";
2
+ export var version = "198.7.0";
@@ -2705,6 +2705,10 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
2705
2705
  }, import("@atlaskit/editor-common/types").QuickInsertPluginOptions | undefined>>];
2706
2706
  pluginConfiguration: boolean;
2707
2707
  sharedState: import("@atlaskit/editor-plugin-help-dialog").HelpDialogSharedState | null;
2708
+ actions: {
2709
+ openHelp(): void;
2710
+ closeHelp(): void;
2711
+ };
2708
2712
  }, boolean> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"feedbackDialog", {
2709
2713
  pluginConfiguration: import("@atlaskit/editor-common/types").FeedbackInfo;
2710
2714
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
@@ -8,6 +8,11 @@ export {
8
8
  */
9
9
  default as EditorContext, } from './ui/EditorContext';
10
10
  export { default as WithEditorActions } from './ui/WithEditorActions';
11
+ /**
12
+ * @deprecated
13
+ * DO NOT USE THIS WILL BE REMOVED SOON AND IS UNSAFE.
14
+ * Please use the the openHelp action via the editorAPI from the `@atlaskit/editor-plugin-help-dialog` plugin.
15
+ */
11
16
  export { default as WithHelpTrigger } from './ui/WithHelpTrigger';
12
17
  export { default as CollapsedEditor } from './ui/CollapsedEditor';
13
18
  export { default as ToolbarHelp } from './ui/ToolbarHelp';
@@ -2756,6 +2756,10 @@ export default function createUniversalPresetInternal({ appearance, props, featu
2756
2756
  }, import("@atlaskit/editor-common/types").QuickInsertPluginOptions | undefined>>];
2757
2757
  pluginConfiguration: boolean;
2758
2758
  sharedState: import("@atlaskit/editor-plugins/help-dialog").HelpDialogSharedState | null;
2759
+ actions: {
2760
+ openHelp(): void;
2761
+ closeHelp(): void;
2762
+ };
2759
2763
  }, boolean> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"feedbackDialog", {
2760
2764
  pluginConfiguration: import("@atlaskit/editor-common/types").FeedbackInfo;
2761
2765
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
@@ -2705,6 +2705,10 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
2705
2705
  }, import("@atlaskit/editor-common/types").QuickInsertPluginOptions | undefined>>];
2706
2706
  pluginConfiguration: boolean;
2707
2707
  sharedState: import("@atlaskit/editor-plugin-help-dialog").HelpDialogSharedState | null;
2708
+ actions: {
2709
+ openHelp(): void;
2710
+ closeHelp(): void;
2711
+ };
2708
2712
  }, boolean> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"feedbackDialog", {
2709
2713
  pluginConfiguration: import("@atlaskit/editor-common/types").FeedbackInfo;
2710
2714
  dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { WrappedComponentProps } from 'react-intl-next';
3
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import { type HelpDialogPlugin } from '@atlaskit/editor-plugins/help-dialog';
3
5
  import type { PositionType } from '@atlaskit/tooltip/types';
4
6
  interface Props {
5
7
  title?: string;
6
8
  titlePosition?: PositionType;
9
+ editorApi?: ExtractInjectionAPI<HelpDialogPlugin> | undefined;
7
10
  }
8
11
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
9
12
  WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
@@ -3320,6 +3320,10 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
3320
3320
  ];
3321
3321
  pluginConfiguration: boolean;
3322
3322
  sharedState: import("@atlaskit/editor-plugin-help-dialog").HelpDialogSharedState | null;
3323
+ actions: {
3324
+ openHelp(): void;
3325
+ closeHelp(): void;
3326
+ };
3323
3327
  }, boolean> | undefined,
3324
3328
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"feedbackDialog", {
3325
3329
  pluginConfiguration: import("@atlaskit/editor-common/types").FeedbackInfo;
@@ -8,6 +8,11 @@ export {
8
8
  */
9
9
  default as EditorContext, } from './ui/EditorContext';
10
10
  export { default as WithEditorActions } from './ui/WithEditorActions';
11
+ /**
12
+ * @deprecated
13
+ * DO NOT USE THIS WILL BE REMOVED SOON AND IS UNSAFE.
14
+ * Please use the the openHelp action via the editorAPI from the `@atlaskit/editor-plugin-help-dialog` plugin.
15
+ */
11
16
  export { default as WithHelpTrigger } from './ui/WithHelpTrigger';
12
17
  export { default as CollapsedEditor } from './ui/CollapsedEditor';
13
18
  export { default as ToolbarHelp } from './ui/ToolbarHelp';
@@ -3371,6 +3371,10 @@ export default function createUniversalPresetInternal({ appearance, props, featu
3371
3371
  ];
3372
3372
  pluginConfiguration: boolean;
3373
3373
  sharedState: import("@atlaskit/editor-plugins/help-dialog").HelpDialogSharedState | null;
3374
+ actions: {
3375
+ openHelp(): void;
3376
+ closeHelp(): void;
3377
+ };
3374
3378
  }, boolean> | undefined,
3375
3379
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"feedbackDialog", {
3376
3380
  pluginConfiguration: import("@atlaskit/editor-common/types").FeedbackInfo;
@@ -3320,6 +3320,10 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
3320
3320
  ];
3321
3321
  pluginConfiguration: boolean;
3322
3322
  sharedState: import("@atlaskit/editor-plugin-help-dialog").HelpDialogSharedState | null;
3323
+ actions: {
3324
+ openHelp(): void;
3325
+ closeHelp(): void;
3326
+ };
3323
3327
  }, boolean> | undefined,
3324
3328
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"feedbackDialog", {
3325
3329
  pluginConfiguration: import("@atlaskit/editor-common/types").FeedbackInfo;
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { WrappedComponentProps } from 'react-intl-next';
3
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import { type HelpDialogPlugin } from '@atlaskit/editor-plugins/help-dialog';
3
5
  import type { PositionType } from '@atlaskit/tooltip/types';
4
6
  interface Props {
5
7
  title?: string;
6
8
  titlePosition?: PositionType;
9
+ editorApi?: ExtractInjectionAPI<HelpDialogPlugin> | undefined;
7
10
  }
8
11
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
9
12
  WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "198.6.11",
3
+ "version": "198.7.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"