@atlaskit/editor-plugin-help-dialog 2.1.1 → 2.1.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 +15 -0
- package/dist/cjs/ui/index.js +23 -6
- package/dist/es2019/ui/index.js +25 -7
- package/dist/esm/ui/index.js +24 -7
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-help-dialog
|
|
2
2
|
|
|
3
|
+
## 2.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#148126](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148126)
|
|
8
|
+
[`2839a051cf613`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2839a051cf613) -
|
|
9
|
+
Migrate to useSharedPluginStateSelector for grid, guideline, help-dialog, highlight and hyperlink
|
|
10
|
+
plugins
|
|
11
|
+
|
|
12
|
+
## 2.1.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.1.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/ui/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var _react = require("react");
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _reactIntlNext = require("react-intl-next");
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
14
|
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
14
15
|
var _commands = require("../pm-plugins/commands");
|
|
15
16
|
var _formatting = require("./formatting");
|
|
@@ -23,23 +24,39 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
23
24
|
|
|
24
25
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
26
|
|
|
27
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
28
|
+
var isVisible = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'helpDialog.isVisible');
|
|
29
|
+
var imageEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'helpDialog.imageEnabled');
|
|
30
|
+
return {
|
|
31
|
+
isVisible: isVisible,
|
|
32
|
+
imageEnabled: imageEnabled
|
|
33
|
+
};
|
|
34
|
+
}, function (api) {
|
|
35
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['helpDialog']),
|
|
36
|
+
helpDialogState = _useSharedPluginState.helpDialogState;
|
|
37
|
+
return {
|
|
38
|
+
isVisible: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.isVisible,
|
|
39
|
+
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled
|
|
40
|
+
};
|
|
41
|
+
});
|
|
26
42
|
var HelpDialog = function HelpDialog(_ref) {
|
|
27
43
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
28
44
|
editorView = _ref.editorView,
|
|
29
45
|
quickInsertEnabled = _ref.quickInsertEnabled,
|
|
30
46
|
intl = _ref.intl;
|
|
31
|
-
var
|
|
32
|
-
|
|
47
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
48
|
+
isVisible = _useSharedState.isVisible,
|
|
49
|
+
imageEnabled = _useSharedState.imageEnabled;
|
|
33
50
|
var closeDialog = (0, _react.useCallback)(function () {
|
|
34
51
|
var tr = editorView.state.tr,
|
|
35
52
|
dispatch = editorView.dispatch;
|
|
36
53
|
(0, _commands.closeHelpCommand)(tr, dispatch);
|
|
37
54
|
}, [editorView]);
|
|
38
55
|
var handleEsc = (0, _react.useCallback)(function (e) {
|
|
39
|
-
if (e.key === 'Escape' &&
|
|
56
|
+
if (e.key === 'Escape' && isVisible) {
|
|
40
57
|
closeDialog();
|
|
41
58
|
}
|
|
42
|
-
}, [closeDialog,
|
|
59
|
+
}, [closeDialog, isVisible]);
|
|
43
60
|
(0, _react.useEffect)(function () {
|
|
44
61
|
// Ignored via go/ees005
|
|
45
62
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -50,8 +67,8 @@ var HelpDialog = function HelpDialog(_ref) {
|
|
|
50
67
|
document.removeEventListener('keydown', handleEsc);
|
|
51
68
|
};
|
|
52
69
|
}, [handleEsc]);
|
|
53
|
-
var formatting = (0, _formatting.getSupportedFormatting)(editorView.state.schema, intl,
|
|
54
|
-
return (0, _react2.jsx)(_modalDialog.ModalTransition, null,
|
|
70
|
+
var formatting = (0, _formatting.getSupportedFormatting)(editorView.state.schema, intl, imageEnabled, quickInsertEnabled);
|
|
71
|
+
return (0, _react2.jsx)(_modalDialog.ModalTransition, null, isVisible ? (0, _react2.jsx)(_modalDialog.default, {
|
|
55
72
|
width: "large",
|
|
56
73
|
onClose: closeDialog,
|
|
57
74
|
testId: "help-modal-dialog"
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -7,11 +7,28 @@ import { useCallback, useEffect } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
12
|
import AkModalDialog, { ModalTransition } from '@atlaskit/modal-dialog';
|
|
12
13
|
import { closeHelpCommand } from '../pm-plugins/commands';
|
|
13
14
|
import { getSupportedFormatting } from './formatting';
|
|
14
15
|
import Modal from './Modal';
|
|
16
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
17
|
+
const isVisible = useSharedPluginStateSelector(api, 'helpDialog.isVisible');
|
|
18
|
+
const imageEnabled = useSharedPluginStateSelector(api, 'helpDialog.imageEnabled');
|
|
19
|
+
return {
|
|
20
|
+
isVisible,
|
|
21
|
+
imageEnabled
|
|
22
|
+
};
|
|
23
|
+
}, api => {
|
|
24
|
+
const {
|
|
25
|
+
helpDialogState
|
|
26
|
+
} = useSharedPluginState(api, ['helpDialog']);
|
|
27
|
+
return {
|
|
28
|
+
isVisible: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.isVisible,
|
|
29
|
+
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled
|
|
30
|
+
};
|
|
31
|
+
});
|
|
15
32
|
const HelpDialog = ({
|
|
16
33
|
pluginInjectionApi,
|
|
17
34
|
editorView,
|
|
@@ -19,8 +36,9 @@ const HelpDialog = ({
|
|
|
19
36
|
intl
|
|
20
37
|
}) => {
|
|
21
38
|
const {
|
|
22
|
-
|
|
23
|
-
|
|
39
|
+
isVisible,
|
|
40
|
+
imageEnabled
|
|
41
|
+
} = useSharedState(pluginInjectionApi);
|
|
24
42
|
const closeDialog = useCallback(() => {
|
|
25
43
|
const {
|
|
26
44
|
state: {
|
|
@@ -31,10 +49,10 @@ const HelpDialog = ({
|
|
|
31
49
|
closeHelpCommand(tr, dispatch);
|
|
32
50
|
}, [editorView]);
|
|
33
51
|
const handleEsc = useCallback(e => {
|
|
34
|
-
if (e.key === 'Escape' &&
|
|
52
|
+
if (e.key === 'Escape' && isVisible) {
|
|
35
53
|
closeDialog();
|
|
36
54
|
}
|
|
37
|
-
}, [closeDialog,
|
|
55
|
+
}, [closeDialog, isVisible]);
|
|
38
56
|
useEffect(() => {
|
|
39
57
|
// Ignored via go/ees005
|
|
40
58
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -45,8 +63,8 @@ const HelpDialog = ({
|
|
|
45
63
|
document.removeEventListener('keydown', handleEsc);
|
|
46
64
|
};
|
|
47
65
|
}, [handleEsc]);
|
|
48
|
-
const formatting = getSupportedFormatting(editorView.state.schema, intl,
|
|
49
|
-
return jsx(ModalTransition, null,
|
|
66
|
+
const formatting = getSupportedFormatting(editorView.state.schema, intl, imageEnabled, quickInsertEnabled);
|
|
67
|
+
return jsx(ModalTransition, null, isVisible ? jsx(AkModalDialog, {
|
|
50
68
|
width: "large",
|
|
51
69
|
onClose: closeDialog,
|
|
52
70
|
testId: "help-modal-dialog"
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -7,28 +7,45 @@ import { useCallback, useEffect } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
12
|
import AkModalDialog, { ModalTransition } from '@atlaskit/modal-dialog';
|
|
12
13
|
import { closeHelpCommand } from '../pm-plugins/commands';
|
|
13
14
|
import { getSupportedFormatting } from './formatting';
|
|
14
15
|
import Modal from './Modal';
|
|
16
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
17
|
+
var isVisible = useSharedPluginStateSelector(api, 'helpDialog.isVisible');
|
|
18
|
+
var imageEnabled = useSharedPluginStateSelector(api, 'helpDialog.imageEnabled');
|
|
19
|
+
return {
|
|
20
|
+
isVisible: isVisible,
|
|
21
|
+
imageEnabled: imageEnabled
|
|
22
|
+
};
|
|
23
|
+
}, function (api) {
|
|
24
|
+
var _useSharedPluginState = useSharedPluginState(api, ['helpDialog']),
|
|
25
|
+
helpDialogState = _useSharedPluginState.helpDialogState;
|
|
26
|
+
return {
|
|
27
|
+
isVisible: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.isVisible,
|
|
28
|
+
imageEnabled: helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled
|
|
29
|
+
};
|
|
30
|
+
});
|
|
15
31
|
var HelpDialog = function HelpDialog(_ref) {
|
|
16
32
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
17
33
|
editorView = _ref.editorView,
|
|
18
34
|
quickInsertEnabled = _ref.quickInsertEnabled,
|
|
19
35
|
intl = _ref.intl;
|
|
20
|
-
var
|
|
21
|
-
|
|
36
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
37
|
+
isVisible = _useSharedState.isVisible,
|
|
38
|
+
imageEnabled = _useSharedState.imageEnabled;
|
|
22
39
|
var closeDialog = useCallback(function () {
|
|
23
40
|
var tr = editorView.state.tr,
|
|
24
41
|
dispatch = editorView.dispatch;
|
|
25
42
|
closeHelpCommand(tr, dispatch);
|
|
26
43
|
}, [editorView]);
|
|
27
44
|
var handleEsc = useCallback(function (e) {
|
|
28
|
-
if (e.key === 'Escape' &&
|
|
45
|
+
if (e.key === 'Escape' && isVisible) {
|
|
29
46
|
closeDialog();
|
|
30
47
|
}
|
|
31
|
-
}, [closeDialog,
|
|
48
|
+
}, [closeDialog, isVisible]);
|
|
32
49
|
useEffect(function () {
|
|
33
50
|
// Ignored via go/ees005
|
|
34
51
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -39,8 +56,8 @@ var HelpDialog = function HelpDialog(_ref) {
|
|
|
39
56
|
document.removeEventListener('keydown', handleEsc);
|
|
40
57
|
};
|
|
41
58
|
}, [handleEsc]);
|
|
42
|
-
var formatting = getSupportedFormatting(editorView.state.schema, intl,
|
|
43
|
-
return jsx(ModalTransition, null,
|
|
59
|
+
var formatting = getSupportedFormatting(editorView.state.schema, intl, imageEnabled, quickInsertEnabled);
|
|
60
|
+
return jsx(ModalTransition, null, isVisible ? jsx(AkModalDialog, {
|
|
44
61
|
width: "large",
|
|
45
62
|
onClose: closeDialog,
|
|
46
63
|
testId: "help-modal-dialog"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-help-dialog",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Help Dialog plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
36
|
+
"@atlaskit/editor-common": "^104.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-quick-insert": "^2.4.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
41
41
|
"@atlaskit/heading": "^5.2.0",
|
|
42
|
-
"@atlaskit/icon": "^25.
|
|
42
|
+
"@atlaskit/icon": "^25.8.0",
|
|
43
43
|
"@atlaskit/modal-dialog": "^14.1.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
|
-
"@atlaskit/primitives": "^14.
|
|
45
|
+
"@atlaskit/primitives": "^14.7.0",
|
|
46
46
|
"@atlaskit/theme": "^18.0.0",
|
|
47
47
|
"@atlaskit/tokens": "^4.8.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|