@atlaskit/editor-plugin-block-menu 4.0.12 → 4.0.14
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 +16 -0
- package/dist/cjs/ui/copy-block.js +4 -1
- package/dist/cjs/ui/copy-link.js +5 -2
- package/dist/cjs/ui/delete-button.js +8 -2
- package/dist/es2019/ui/copy-block.js +5 -1
- package/dist/es2019/ui/copy-link.js +6 -2
- package/dist/es2019/ui/delete-button.js +9 -2
- package/dist/esm/ui/copy-block.js +4 -1
- package/dist/esm/ui/copy-link.js +5 -2
- package/dist/esm/ui/delete-button.js +8 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 4.0.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4141e6d6c0258`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4141e6d6c0258) -
|
|
8
|
+
[ux] ED-29125 Add danger styles for media group, tables with numbered columns and nested panels
|
|
9
|
+
- [`b775e7e1ebae1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b775e7e1ebae1) -
|
|
10
|
+
Fix incorrect selection after copy content via block menu
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 4.0.13
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 4.0.12
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -19,6 +19,7 @@ var _utils = require("@atlaskit/editor-tables/utils");
|
|
|
19
19
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
20
20
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
21
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
|
+
var _blockMenuProvider = require("./block-menu-provider");
|
|
22
23
|
var _consts = require("./consts");
|
|
23
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -29,6 +30,8 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
29
30
|
var api = _ref.api;
|
|
30
31
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
31
32
|
formatMessage = _useIntl.formatMessage;
|
|
33
|
+
var _useBlockMenu = (0, _blockMenuProvider.useBlockMenu)(),
|
|
34
|
+
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
32
35
|
var copyHandler = function copyHandler(event) {
|
|
33
36
|
var _api$selection;
|
|
34
37
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
@@ -118,7 +121,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
118
121
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
119
122
|
closeMenu: true
|
|
120
123
|
}));
|
|
121
|
-
|
|
124
|
+
onDropdownOpenChanged(false);
|
|
122
125
|
}
|
|
123
126
|
};
|
|
124
127
|
var text = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockMenuMessages.copyContent) : formatMessage(_blockMenu.messages.copyBlock);
|
package/dist/cjs/ui/copy-link.js
CHANGED
|
@@ -13,6 +13,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
13
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
14
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _blockMenuProvider = require("./block-menu-provider");
|
|
16
17
|
var _consts = require("./consts");
|
|
17
18
|
var _copyLink = require("./utils/copyLink");
|
|
18
19
|
var _isNestedNode = require("./utils/isNestedNode");
|
|
@@ -22,6 +23,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
22
23
|
config = _ref.config;
|
|
23
24
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
24
25
|
formatMessage = _useIntl.formatMessage;
|
|
26
|
+
var _useBlockMenu = (0, _blockMenuProvider.useBlockMenu)(),
|
|
27
|
+
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
25
28
|
var handleClick = (0, _react.useCallback)(function () {
|
|
26
29
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
27
30
|
var _api$analytics, _api$blockControls;
|
|
@@ -43,9 +46,9 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
43
46
|
});
|
|
44
47
|
return tr;
|
|
45
48
|
});
|
|
46
|
-
|
|
49
|
+
onDropdownOpenChanged(false);
|
|
47
50
|
return (0, _copyLink.copyLink)(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api);
|
|
48
|
-
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api]);
|
|
51
|
+
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api, onDropdownOpenChanged]);
|
|
49
52
|
var checkIsNestedNode = (0, _react.useCallback)(function () {
|
|
50
53
|
var _api$selection, _api$blockControls2;
|
|
51
54
|
var selection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.sharedState) === null || _api$selection === void 0 || (_api$selection = _api$selection.currentState()) === null || _api$selection === void 0 ? void 0 : _api$selection.selection;
|
|
@@ -78,8 +78,14 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
78
78
|
});
|
|
79
79
|
}, [api, nodeTypes]);
|
|
80
80
|
var onRemoveHoverDecoration = (0, _react.useCallback)(function () {
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref4) {
|
|
82
|
+
var _api$decorations2, _api$decorations2$rem;
|
|
83
|
+
var tr = _ref4.tr;
|
|
84
|
+
api === null || api === void 0 || (_api$decorations2 = api.decorations) === null || _api$decorations2 === void 0 || (_api$decorations2 = _api$decorations2.commands) === null || _api$decorations2 === void 0 || (_api$decorations2$rem = _api$decorations2.removeDecoration) === null || _api$decorations2$rem === void 0 || _api$decorations2$rem.call(_api$decorations2)({
|
|
85
|
+
tr: tr
|
|
86
|
+
});
|
|
87
|
+
return tr;
|
|
88
|
+
});
|
|
83
89
|
}, [api]);
|
|
84
90
|
(0, _react.useEffect)(function () {
|
|
85
91
|
if (!(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true)) {
|
|
@@ -11,6 +11,7 @@ import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
|
11
11
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
12
12
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { useBlockMenu } from './block-menu-provider';
|
|
14
15
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
15
16
|
const toDOMFromFragment = (fragment, schema) => {
|
|
16
17
|
return DOMSerializer.fromSchema(schema).serializeFragment(fragment);
|
|
@@ -21,6 +22,9 @@ const CopyBlockMenuItem = ({
|
|
|
21
22
|
const {
|
|
22
23
|
formatMessage
|
|
23
24
|
} = useIntl();
|
|
25
|
+
const {
|
|
26
|
+
onDropdownOpenChanged
|
|
27
|
+
} = useBlockMenu();
|
|
24
28
|
const copyHandler = event => {
|
|
25
29
|
var _api$selection, _api$selection$shared, _api$selection$shared2;
|
|
26
30
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
@@ -112,7 +116,7 @@ const CopyBlockMenuItem = ({
|
|
|
112
116
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
113
117
|
closeMenu: true
|
|
114
118
|
}));
|
|
115
|
-
|
|
119
|
+
onDropdownOpenChanged(false);
|
|
116
120
|
}
|
|
117
121
|
};
|
|
118
122
|
const text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.copyContent) : formatMessage(messages.copyBlock);
|
|
@@ -5,6 +5,7 @@ import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages'
|
|
|
5
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { useBlockMenu } from './block-menu-provider';
|
|
8
9
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
9
10
|
import { copyLink } from './utils/copyLink';
|
|
10
11
|
import { isNestedNode } from './utils/isNestedNode';
|
|
@@ -15,6 +16,9 @@ const CopyLinkDropdownItemContent = ({
|
|
|
15
16
|
const {
|
|
16
17
|
formatMessage
|
|
17
18
|
} = useIntl();
|
|
19
|
+
const {
|
|
20
|
+
onDropdownOpenChanged
|
|
21
|
+
} = useBlockMenu();
|
|
18
22
|
const handleClick = useCallback(() => {
|
|
19
23
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
20
24
|
tr
|
|
@@ -37,9 +41,9 @@ const CopyLinkDropdownItemContent = ({
|
|
|
37
41
|
});
|
|
38
42
|
return tr;
|
|
39
43
|
});
|
|
40
|
-
|
|
44
|
+
onDropdownOpenChanged(false);
|
|
41
45
|
return copyLink(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api);
|
|
42
|
-
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api]);
|
|
46
|
+
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api, onDropdownOpenChanged]);
|
|
43
47
|
const checkIsNestedNode = useCallback(() => {
|
|
44
48
|
var _api$selection, _api$selection$shared, _api$selection$shared2, _api$blockControls2, _api$blockControls2$s, _api$blockControls2$s2;
|
|
45
49
|
const selection = api === null || api === void 0 ? void 0 : (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : (_api$selection$shared = _api$selection.sharedState) === null || _api$selection$shared === void 0 ? void 0 : (_api$selection$shared2 = _api$selection$shared.currentState()) === null || _api$selection$shared2 === void 0 ? void 0 : _api$selection$shared2.selection;
|
|
@@ -73,8 +73,15 @@ const DeleteDropdownItemContent = ({
|
|
|
73
73
|
});
|
|
74
74
|
}, [api, nodeTypes]);
|
|
75
75
|
const onRemoveHoverDecoration = useCallback(() => {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
77
|
+
tr
|
|
78
|
+
}) => {
|
|
79
|
+
var _api$decorations2, _api$decorations2$com, _api$decorations2$com2;
|
|
80
|
+
api === null || api === void 0 ? void 0 : (_api$decorations2 = api.decorations) === null || _api$decorations2 === void 0 ? void 0 : (_api$decorations2$com = _api$decorations2.commands) === null || _api$decorations2$com === void 0 ? void 0 : (_api$decorations2$com2 = _api$decorations2$com.removeDecoration) === null || _api$decorations2$com2 === void 0 ? void 0 : _api$decorations2$com2.call(_api$decorations2$com)({
|
|
81
|
+
tr
|
|
82
|
+
});
|
|
83
|
+
return tr;
|
|
84
|
+
});
|
|
78
85
|
}, [api]);
|
|
79
86
|
useEffect(() => {
|
|
80
87
|
if (!expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true)) {
|
|
@@ -14,6 +14,7 @@ import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
|
14
14
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
15
15
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
+
import { useBlockMenu } from './block-menu-provider';
|
|
17
18
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
18
19
|
var toDOMFromFragment = function toDOMFromFragment(fragment, schema) {
|
|
19
20
|
return DOMSerializer.fromSchema(schema).serializeFragment(fragment);
|
|
@@ -22,6 +23,8 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
22
23
|
var api = _ref.api;
|
|
23
24
|
var _useIntl = useIntl(),
|
|
24
25
|
formatMessage = _useIntl.formatMessage;
|
|
26
|
+
var _useBlockMenu = useBlockMenu(),
|
|
27
|
+
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
25
28
|
var copyHandler = function copyHandler(event) {
|
|
26
29
|
var _api$selection;
|
|
27
30
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
@@ -111,7 +114,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
111
114
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
112
115
|
closeMenu: true
|
|
113
116
|
}));
|
|
114
|
-
|
|
117
|
+
onDropdownOpenChanged(false);
|
|
115
118
|
}
|
|
116
119
|
};
|
|
117
120
|
var text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.copyContent) : formatMessage(messages.copyBlock);
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -5,6 +5,7 @@ import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages'
|
|
|
5
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { useBlockMenu } from './block-menu-provider';
|
|
8
9
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
9
10
|
import { copyLink } from './utils/copyLink';
|
|
10
11
|
import { isNestedNode } from './utils/isNestedNode';
|
|
@@ -13,6 +14,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
13
14
|
config = _ref.config;
|
|
14
15
|
var _useIntl = useIntl(),
|
|
15
16
|
formatMessage = _useIntl.formatMessage;
|
|
17
|
+
var _useBlockMenu = useBlockMenu(),
|
|
18
|
+
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
16
19
|
var handleClick = useCallback(function () {
|
|
17
20
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
18
21
|
var _api$analytics, _api$blockControls;
|
|
@@ -34,9 +37,9 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
34
37
|
});
|
|
35
38
|
return tr;
|
|
36
39
|
});
|
|
37
|
-
|
|
40
|
+
onDropdownOpenChanged(false);
|
|
38
41
|
return copyLink(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api);
|
|
39
|
-
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api]);
|
|
42
|
+
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockQueryParam, api, onDropdownOpenChanged]);
|
|
40
43
|
var checkIsNestedNode = useCallback(function () {
|
|
41
44
|
var _api$selection, _api$blockControls2;
|
|
42
45
|
var selection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.sharedState) === null || _api$selection === void 0 || (_api$selection = _api$selection.currentState()) === null || _api$selection === void 0 ? void 0 : _api$selection.selection;
|
|
@@ -69,8 +69,14 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
69
69
|
});
|
|
70
70
|
}, [api, nodeTypes]);
|
|
71
71
|
var onRemoveHoverDecoration = useCallback(function () {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref4) {
|
|
73
|
+
var _api$decorations2, _api$decorations2$rem;
|
|
74
|
+
var tr = _ref4.tr;
|
|
75
|
+
api === null || api === void 0 || (_api$decorations2 = api.decorations) === null || _api$decorations2 === void 0 || (_api$decorations2 = _api$decorations2.commands) === null || _api$decorations2 === void 0 || (_api$decorations2$rem = _api$decorations2.removeDecoration) === null || _api$decorations2$rem === void 0 || _api$decorations2$rem.call(_api$decorations2)({
|
|
76
|
+
tr: tr
|
|
77
|
+
});
|
|
78
|
+
return tr;
|
|
79
|
+
});
|
|
74
80
|
}, [api]);
|
|
75
81
|
useEffect(function () {
|
|
76
82
|
if (!expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.14",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^6.1.0",
|
|
34
34
|
"@atlaskit/editor-plugin-block-controls": "^7.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
36
|
-
"@atlaskit/editor-plugin-selection": "^6.
|
|
36
|
+
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-user-intent": "^4.0.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
39
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
40
40
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
41
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
41
|
+
"@atlaskit/editor-toolbar": "^0.14.0",
|
|
42
42
|
"@atlaskit/icon": "^28.4.0",
|
|
43
43
|
"@atlaskit/icon-lab": "^5.9.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@babel/runtime": "^7.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@atlaskit/editor-common": "^110.
|
|
51
|
+
"@atlaskit/editor-common": "^110.5.0",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
54
54
|
},
|