@atlaskit/editor-plugin-panel 8.2.1 → 8.2.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
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-panel
|
|
2
2
|
|
|
3
|
+
## 8.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b5d004bf834f8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b5d004bf834f8) -
|
|
8
|
+
[ux] Adds block menu action to check if 'Turn into' item should be rendered or not.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 8.2.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 8.2.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createPanelBlockMenuItem = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _reactIntlNext = require("react-intl-next");
|
|
11
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
14
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
12
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
13
|
var _informationCircle = _interopRequireDefault(require("@atlaskit/icon/core/information-circle"));
|
|
17
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
14
|
var nodeName = 'panel';
|
|
19
15
|
var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
|
|
16
|
+
var _api$blockMenu2;
|
|
20
17
|
var api = _ref.api;
|
|
21
18
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
22
19
|
formatMessage = _useIntl.formatMessage;
|
|
23
|
-
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
24
|
-
var isPanelSelected = (0, _react.useMemo)(function () {
|
|
25
|
-
if (!selection) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
if (selection instanceof _state.NodeSelection) {
|
|
29
|
-
// Note: we are checking for any type of panel, not just of type infopanel
|
|
30
|
-
return selection.node.type.name === nodeName;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
}, [selection]);
|
|
34
20
|
var handleClick = function handleClick(event) {
|
|
35
21
|
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
|
|
36
22
|
var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
|
|
@@ -47,9 +33,12 @@ var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
|
|
|
47
33
|
}) : null;
|
|
48
34
|
});
|
|
49
35
|
};
|
|
36
|
+
var isTransfromToPanelDisabled = api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(nodeName);
|
|
37
|
+
if (isTransfromToPanelDisabled) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
50
40
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
51
41
|
onClick: handleClick,
|
|
52
|
-
isSelected: isPanelSelected,
|
|
53
42
|
elemBefore: /*#__PURE__*/_react.default.createElement(_informationCircle.default, {
|
|
54
43
|
label: ""
|
|
55
44
|
})
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
|
-
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
6
|
import InformationCircleIcon from '@atlaskit/icon/core/information-circle';
|
|
9
7
|
const nodeName = 'panel';
|
|
10
8
|
const PanelBlockMenuItem = ({
|
|
11
9
|
api
|
|
12
10
|
}) => {
|
|
11
|
+
var _api$blockMenu2;
|
|
13
12
|
const {
|
|
14
13
|
formatMessage
|
|
15
14
|
} = useIntl();
|
|
16
|
-
const selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
17
|
-
const isPanelSelected = useMemo(() => {
|
|
18
|
-
if (!selection) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
if (selection instanceof NodeSelection) {
|
|
22
|
-
// Note: we are checking for any type of panel, not just of type infopanel
|
|
23
|
-
return selection.node.type.name === nodeName;
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
26
|
-
}, [selection]);
|
|
27
15
|
const handleClick = event => {
|
|
28
16
|
const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
|
|
29
17
|
const inputMethod = INPUT_METHOD.BLOCK_MENU;
|
|
@@ -41,9 +29,12 @@ const PanelBlockMenuItem = ({
|
|
|
41
29
|
}) : null;
|
|
42
30
|
});
|
|
43
31
|
};
|
|
32
|
+
const isTransfromToPanelDisabled = api === null || api === void 0 ? void 0 : (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(nodeName);
|
|
33
|
+
if (isTransfromToPanelDisabled) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
44
36
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
45
37
|
onClick: handleClick,
|
|
46
|
-
isSelected: isPanelSelected,
|
|
47
38
|
elemBefore: /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
48
39
|
label: ""
|
|
49
40
|
})
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
|
-
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
6
|
import InformationCircleIcon from '@atlaskit/icon/core/information-circle';
|
|
9
7
|
var nodeName = 'panel';
|
|
10
8
|
var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
|
|
9
|
+
var _api$blockMenu2;
|
|
11
10
|
var api = _ref.api;
|
|
12
11
|
var _useIntl = useIntl(),
|
|
13
12
|
formatMessage = _useIntl.formatMessage;
|
|
14
|
-
var selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
15
|
-
var isPanelSelected = useMemo(function () {
|
|
16
|
-
if (!selection) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (selection instanceof NodeSelection) {
|
|
20
|
-
// Note: we are checking for any type of panel, not just of type infopanel
|
|
21
|
-
return selection.node.type.name === nodeName;
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
}, [selection]);
|
|
25
13
|
var handleClick = function handleClick(event) {
|
|
26
14
|
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
|
|
27
15
|
var inputMethod = INPUT_METHOD.BLOCK_MENU;
|
|
@@ -38,9 +26,12 @@ var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
|
|
|
38
26
|
}) : null;
|
|
39
27
|
});
|
|
40
28
|
};
|
|
29
|
+
var isTransfromToPanelDisabled = api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(nodeName);
|
|
30
|
+
if (isTransfromToPanelDisabled) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
41
33
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
42
34
|
onClick: handleClick,
|
|
43
|
-
isSelected: isPanelSelected,
|
|
44
35
|
elemBefore: /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
45
36
|
label: ""
|
|
46
37
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-panel",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.3",
|
|
4
4
|
"description": "Panel plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
33
33
|
"@atlaskit/editor-plugin-block-menu": "^5.2.0",
|
|
34
34
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
35
|
-
"@atlaskit/editor-plugin-emoji": "^7.
|
|
35
|
+
"@atlaskit/editor-plugin-emoji": "^7.8.0",
|
|
36
36
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
37
|
-
"@atlaskit/editor-plugin-toolbar": "^3.
|
|
37
|
+
"@atlaskit/editor-plugin-toolbar": "^3.5.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
39
39
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
40
40
|
"@atlaskit/editor-toolbar": "^0.18.0",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"@atlaskit/icon": "^29.3.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/theme": "^21.0.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
46
|
-
"@atlaskit/tokens": "^
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^16.1.0",
|
|
46
|
+
"@atlaskit/tokens": "^9.0.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"uuid": "^3.1.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@atlaskit/editor-common": "^110.
|
|
51
|
+
"@atlaskit/editor-common": "^110.48.0",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-dom": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|