@atlaskit/editor-plugin-panel 8.2.2 → 8.2.4
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,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-panel
|
|
2
2
|
|
|
3
|
+
## 8.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9cb0ce7857313`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9cb0ce7857313) -
|
|
8
|
+
Fix const name.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 8.2.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`b5d004bf834f8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b5d004bf834f8) -
|
|
16
|
+
[ux] Adds block menu action to check if 'Turn into' item should be rendered or not.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 8.2.2
|
|
4
20
|
|
|
5
21
|
### 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
|
-
|
|
18
|
-
var nodeName = 'panel';
|
|
14
|
+
var NODE_NAME = '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;
|
|
@@ -40,16 +26,19 @@ var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
|
|
|
40
26
|
var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.panel, {
|
|
41
27
|
inputMethod: inputMethod,
|
|
42
28
|
triggeredFrom: triggeredFrom,
|
|
43
|
-
targetTypeName:
|
|
29
|
+
targetTypeName: NODE_NAME
|
|
44
30
|
});
|
|
45
31
|
return command ? command({
|
|
46
32
|
tr: tr
|
|
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(NODE_NAME);
|
|
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
|
-
const
|
|
7
|
+
const NODE_NAME = '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;
|
|
@@ -34,16 +22,19 @@ const PanelBlockMenuItem = ({
|
|
|
34
22
|
const command = api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.panel, {
|
|
35
23
|
inputMethod,
|
|
36
24
|
triggeredFrom,
|
|
37
|
-
targetTypeName:
|
|
25
|
+
targetTypeName: NODE_NAME
|
|
38
26
|
});
|
|
39
27
|
return command ? command({
|
|
40
28
|
tr
|
|
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(NODE_NAME);
|
|
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
|
-
var
|
|
7
|
+
var NODE_NAME = '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;
|
|
@@ -31,16 +19,19 @@ var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
|
|
|
31
19
|
var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.panel, {
|
|
32
20
|
inputMethod: inputMethod,
|
|
33
21
|
triggeredFrom: triggeredFrom,
|
|
34
|
-
targetTypeName:
|
|
22
|
+
targetTypeName: NODE_NAME
|
|
35
23
|
});
|
|
36
24
|
return command ? command({
|
|
37
25
|
tr: tr
|
|
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(NODE_NAME);
|
|
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.4",
|
|
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.
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^16.2.0",
|
|
46
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.49.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"
|