@atlaskit/editor-plugin-layout 6.2.19 → 6.2.21
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-layout
|
|
2
2
|
|
|
3
|
+
## 6.2.21
|
|
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
|
+
## 6.2.20
|
|
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
|
## 6.2.19
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1,34 +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.createLayoutBlockMenuItem = 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 _layoutTwoColumns = _interopRequireDefault(require("@atlaskit/icon/core/layout-two-columns"));
|
|
17
|
-
|
|
14
|
+
var NODE_NAME = 'layoutSection';
|
|
18
15
|
var LayoutBlockMenuItem = function LayoutBlockMenuItem(_ref) {
|
|
16
|
+
var _api$blockMenu2;
|
|
19
17
|
var api = _ref.api;
|
|
20
18
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
19
|
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
23
|
-
var isLayoutSelected = (0, _react.useMemo)(function () {
|
|
24
|
-
if (!selection) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
if (selection instanceof _state.NodeSelection) {
|
|
28
|
-
return selection.node.type.name === 'layoutSection';
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
}, [selection]);
|
|
32
20
|
var handleClick = function handleClick(event) {
|
|
33
21
|
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
|
|
34
22
|
var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
|
|
@@ -38,16 +26,19 @@ var LayoutBlockMenuItem = function LayoutBlockMenuItem(_ref) {
|
|
|
38
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.layoutSection, {
|
|
39
27
|
inputMethod: inputMethod,
|
|
40
28
|
triggeredFrom: triggeredFrom,
|
|
41
|
-
targetTypeName:
|
|
29
|
+
targetTypeName: NODE_NAME
|
|
42
30
|
});
|
|
43
31
|
return command ? command({
|
|
44
32
|
tr: tr
|
|
45
33
|
}) : null;
|
|
46
34
|
});
|
|
47
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
|
+
}
|
|
48
40
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
49
41
|
onClick: handleClick,
|
|
50
|
-
isSelected: isLayoutSelected,
|
|
51
42
|
elemBefore: /*#__PURE__*/_react.default.createElement(_layoutTwoColumns.default, {
|
|
52
43
|
label: ""
|
|
53
44
|
})
|
|
@@ -1,27 +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 { blockMenuMessages } 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 LayoutTwoColumnsIcon from '@atlaskit/icon/core/layout-two-columns';
|
|
7
|
+
const NODE_NAME = 'layoutSection';
|
|
9
8
|
const LayoutBlockMenuItem = ({
|
|
10
9
|
api
|
|
11
10
|
}) => {
|
|
11
|
+
var _api$blockMenu2;
|
|
12
12
|
const {
|
|
13
13
|
formatMessage
|
|
14
14
|
} = useIntl();
|
|
15
|
-
const selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
16
|
-
const isLayoutSelected = useMemo(() => {
|
|
17
|
-
if (!selection) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
if (selection instanceof NodeSelection) {
|
|
21
|
-
return selection.node.type.name === 'layoutSection';
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
}, [selection]);
|
|
25
15
|
const handleClick = event => {
|
|
26
16
|
const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
|
|
27
17
|
const inputMethod = INPUT_METHOD.BLOCK_MENU;
|
|
@@ -32,16 +22,19 @@ const LayoutBlockMenuItem = ({
|
|
|
32
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.layoutSection, {
|
|
33
23
|
inputMethod,
|
|
34
24
|
triggeredFrom,
|
|
35
|
-
targetTypeName:
|
|
25
|
+
targetTypeName: NODE_NAME
|
|
36
26
|
});
|
|
37
27
|
return command ? command({
|
|
38
28
|
tr
|
|
39
29
|
}) : null;
|
|
40
30
|
});
|
|
41
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
|
+
}
|
|
42
36
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
43
37
|
onClick: handleClick,
|
|
44
|
-
isSelected: isLayoutSelected,
|
|
45
38
|
elemBefore: /*#__PURE__*/React.createElement(LayoutTwoColumnsIcon, {
|
|
46
39
|
label: ""
|
|
47
40
|
})
|
|
@@ -1,25 +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 { blockMenuMessages } 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 LayoutTwoColumnsIcon from '@atlaskit/icon/core/layout-two-columns';
|
|
7
|
+
var NODE_NAME = 'layoutSection';
|
|
9
8
|
var LayoutBlockMenuItem = function LayoutBlockMenuItem(_ref) {
|
|
9
|
+
var _api$blockMenu2;
|
|
10
10
|
var api = _ref.api;
|
|
11
11
|
var _useIntl = useIntl(),
|
|
12
12
|
formatMessage = _useIntl.formatMessage;
|
|
13
|
-
var selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
14
|
-
var isLayoutSelected = useMemo(function () {
|
|
15
|
-
if (!selection) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
if (selection instanceof NodeSelection) {
|
|
19
|
-
return selection.node.type.name === 'layoutSection';
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}, [selection]);
|
|
23
13
|
var handleClick = function handleClick(event) {
|
|
24
14
|
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
|
|
25
15
|
var inputMethod = INPUT_METHOD.BLOCK_MENU;
|
|
@@ -29,16 +19,19 @@ var LayoutBlockMenuItem = function LayoutBlockMenuItem(_ref) {
|
|
|
29
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.layoutSection, {
|
|
30
20
|
inputMethod: inputMethod,
|
|
31
21
|
triggeredFrom: triggeredFrom,
|
|
32
|
-
targetTypeName:
|
|
22
|
+
targetTypeName: NODE_NAME
|
|
33
23
|
});
|
|
34
24
|
return command ? command({
|
|
35
25
|
tr: tr
|
|
36
26
|
}) : null;
|
|
37
27
|
});
|
|
38
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
|
+
}
|
|
39
33
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
40
34
|
onClick: handleClick,
|
|
41
|
-
isSelected: isLayoutSelected,
|
|
42
35
|
elemBefore: /*#__PURE__*/React.createElement(LayoutTwoColumnsIcon, {
|
|
43
36
|
label: ""
|
|
44
37
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.21",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-guideline": "^6.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-interaction": "^11.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
40
|
-
"@atlaskit/editor-plugin-toolbar": "^3.
|
|
40
|
+
"@atlaskit/editor-plugin-toolbar": "^3.5.0",
|
|
41
41
|
"@atlaskit/editor-plugin-width": "^7.0.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"@atlaskit/icon": "^29.3.0",
|
|
46
46
|
"@atlaskit/icon-lab": "^5.13.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^16.2.0",
|
|
49
49
|
"@atlaskit/tokens": "^9.0.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@atlaskit/editor-common": "^110.
|
|
54
|
+
"@atlaskit/editor-common": "^110.49.0",
|
|
55
55
|
"react": "^18.2.0",
|
|
56
56
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
57
57
|
},
|