@atlaskit/editor-plugin-block-menu 5.0.12 → 5.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/editor-commands/formatNode.js +1 -4
- package/dist/cjs/ui/copy-block.js +2 -5
- package/dist/cjs/ui/copy-link.js +1 -2
- package/dist/cjs/ui/delete-button.js +1 -4
- package/dist/cjs/ui/format-menu-nested.js +1 -3
- package/dist/cjs/ui/utils/checkIsFormatMenuHidden.js +2 -8
- package/dist/es2019/editor-commands/formatNode.js +1 -4
- package/dist/es2019/ui/copy-block.js +2 -5
- package/dist/es2019/ui/copy-link.js +1 -2
- package/dist/es2019/ui/delete-button.js +1 -4
- package/dist/es2019/ui/format-menu-nested.js +1 -3
- package/dist/es2019/ui/utils/checkIsFormatMenuHidden.js +2 -8
- package/dist/esm/editor-commands/formatNode.js +1 -4
- package/dist/esm/ui/copy-block.js +2 -5
- package/dist/esm/ui/copy-link.js +1 -2
- package/dist/esm/ui/delete-button.js +1 -4
- package/dist/esm/ui/format-menu-nested.js +1 -3
- package/dist/esm/ui/utils/checkIsFormatMenuHidden.js +2 -8
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 5.0.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b5dc6946c55d9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b5dc6946c55d9) -
|
|
8
|
+
Clean up platform_editor_block_menu_layout_format
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 5.0.13
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`6f765533c791b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6f765533c791b) -
|
|
16
|
+
FG platform_editor_block_menu_patch_1 clean up.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 5.0.12
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -146,10 +146,7 @@ var formatNode = exports.formatNode = function formatNode(api) {
|
|
|
146
146
|
return newTr;
|
|
147
147
|
} else {
|
|
148
148
|
var _newTr = formatNodeWhenSelectionEmpty(tr, targetType, nodePos, schema);
|
|
149
|
-
var allowedNodes = [nodes.blockquote, nodes.panel, nodes.codeBlock];
|
|
150
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
151
|
-
allowedNodes.push(nodes.layoutSection);
|
|
152
|
-
}
|
|
149
|
+
var allowedNodes = [nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.layoutSection];
|
|
153
150
|
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
154
151
|
allowedNodes.push(nodes.expand);
|
|
155
152
|
}
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
13
12
|
var _clipboard = require("@atlaskit/editor-common/clipboard");
|
|
14
13
|
var _copyButton = require("@atlaskit/editor-common/copy-button");
|
|
15
14
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
@@ -18,7 +17,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
18
17
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
19
18
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
20
19
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
21
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
20
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
21
|
var _blockMenuProvider = require("./block-menu-provider");
|
|
24
22
|
var _consts = require("./consts");
|
|
@@ -114,7 +112,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
114
112
|
}
|
|
115
113
|
// source sync block (bodiedSyncBlock) is also a special case
|
|
116
114
|
// where we need to copy the content of the bodiedSyncBlock node
|
|
117
|
-
else if (selection.node.type.name === 'bodiedSyncBlock' && (0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true)
|
|
115
|
+
else if (selection.node.type.name === 'bodiedSyncBlock' && (0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true)) {
|
|
118
116
|
var bodiedSyncBlockNode = selection.node;
|
|
119
117
|
var _domNode3 = toDOMFromFragment(bodiedSyncBlockNode.content, schema);
|
|
120
118
|
(0, _copyButton.copyDomNode)(_domNode3, bodiedSyncBlockNode.type, selection);
|
|
@@ -133,12 +131,11 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
133
131
|
onDropdownOpenChanged(false);
|
|
134
132
|
}
|
|
135
133
|
};
|
|
136
|
-
var text = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockMenuMessages.copyContent) : formatMessage(_blockMenu.messages.copyBlock);
|
|
137
134
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
138
135
|
elemBefore: /*#__PURE__*/_react.default.createElement(_copy.default, {
|
|
139
136
|
label: ""
|
|
140
137
|
}),
|
|
141
138
|
onClick: copyHandler
|
|
142
|
-
},
|
|
139
|
+
}, formatMessage(_messages.blockMenuMessages.copyContent));
|
|
143
140
|
};
|
|
144
141
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(CopyBlockMenuItem);
|
package/dist/cjs/ui/copy-link.js
CHANGED
|
@@ -62,12 +62,11 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
62
62
|
if (!(0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') || checkIsNestedNode()) {
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
-
var text = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockMenuMessages.copyLinkToBlock) : formatMessage(_messages.blockMenuMessages.copyLink);
|
|
66
65
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
67
66
|
onClick: handleClick,
|
|
68
67
|
elemBefore: /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
69
68
|
label: ""
|
|
70
69
|
})
|
|
71
|
-
},
|
|
70
|
+
}, formatMessage(_messages.blockMenuMessages.copyLinkToBlock));
|
|
72
71
|
};
|
|
73
72
|
var CopyLinkDropdownItem = exports.CopyLinkDropdownItem = (0, _reactIntlNext.injectIntl)(CopyLinkDropdownItemContent);
|
|
@@ -9,14 +9,12 @@ exports.DeleteDropdownItem = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
13
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
13
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
15
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
15
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
17
16
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
18
17
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
19
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
18
|
var _box = require("@atlaskit/primitives/box");
|
|
21
19
|
var _text = _interopRequireDefault(require("@atlaskit/primitives/text"));
|
|
22
20
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
@@ -103,7 +101,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
103
101
|
onRemoveHoverDecoration();
|
|
104
102
|
};
|
|
105
103
|
}, [onRemoveHoverDecoration]);
|
|
106
|
-
var text = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockMenuMessages.deleteBlock) : formatMessage(_blockMenu.messages.deleteBlock);
|
|
107
104
|
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
108
105
|
onMouseEnter: onShowHoverDecoration,
|
|
109
106
|
onMouseLeave: onRemoveHoverDecoration,
|
|
@@ -118,6 +115,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
118
115
|
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
119
116
|
as: "span",
|
|
120
117
|
color: "color.text.danger"
|
|
121
|
-
},
|
|
118
|
+
}, formatMessage(_messages.blockMenuMessages.deleteBlock))));
|
|
122
119
|
};
|
|
123
120
|
var DeleteDropdownItem = exports.DeleteDropdownItem = (0, _reactIntlNext.injectIntl)(DeleteDropdownItemContent);
|
|
@@ -9,7 +9,6 @@ exports.FormatMenuComponent = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
13
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
14
|
var _changes = _interopRequireDefault(require("@atlaskit/icon/core/changes"));
|
|
@@ -23,7 +22,6 @@ var FormatMenuComponent = exports.FormatMenuComponent = function FormatMenuCompo
|
|
|
23
22
|
children = _ref.children;
|
|
24
23
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
25
24
|
formatMessage = _useIntl.formatMessage;
|
|
26
|
-
var text = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_patch_1') ? formatMessage(_messages.blockMenuMessages.turnInto) : formatMessage(_blockMenu.messages.turnInto);
|
|
27
25
|
var isDisabled = (0, _platformFeatureFlags.fg)('platform_editor_block_menu_for_disabled_nodes') ? (0, _checkIsFormatMenuHidden.checkIsFormatMenuHidden)(api) : false;
|
|
28
26
|
var handleClick = (0, _react.useCallback)(function () {
|
|
29
27
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
@@ -42,7 +40,7 @@ var FormatMenuComponent = exports.FormatMenuComponent = function FormatMenuCompo
|
|
|
42
40
|
});
|
|
43
41
|
}, [api]);
|
|
44
42
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarNestedDropdownMenu, {
|
|
45
|
-
text:
|
|
43
|
+
text: formatMessage(_messages.blockMenuMessages.turnInto),
|
|
46
44
|
elemBefore: /*#__PURE__*/_react.default.createElement(_changes.default, {
|
|
47
45
|
label: ""
|
|
48
46
|
}),
|
|
@@ -22,10 +22,7 @@ var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, me
|
|
|
22
22
|
return !!disabledNode || isNested && !(0, _platformFeatureFlags.fg)('platform_editor_block_menu_transform_nested_node');
|
|
23
23
|
}
|
|
24
24
|
var content;
|
|
25
|
-
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
26
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
27
|
-
allowedNodes.push(nodes.layoutSection);
|
|
28
|
-
}
|
|
25
|
+
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList, nodes.layoutSection];
|
|
29
26
|
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
30
27
|
allowedNodes.push(nodes.expand);
|
|
31
28
|
}
|
|
@@ -59,10 +56,7 @@ var getIsFormatMenuHiddenEmptyLine = function getIsFormatMenuHiddenEmptyLine(sel
|
|
|
59
56
|
return true;
|
|
60
57
|
} else {
|
|
61
58
|
var content;
|
|
62
|
-
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
63
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
64
|
-
allowedNodes.push(nodes.layoutSection);
|
|
65
|
-
}
|
|
59
|
+
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList, nodes.layoutSection];
|
|
66
60
|
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
67
61
|
allowedNodes.push(nodes.expand);
|
|
68
62
|
}
|
|
@@ -151,10 +151,7 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
|
|
|
151
151
|
return newTr;
|
|
152
152
|
} else {
|
|
153
153
|
const newTr = formatNodeWhenSelectionEmpty(tr, targetType, nodePos, schema);
|
|
154
|
-
const allowedNodes = [nodes.blockquote, nodes.panel, nodes.codeBlock];
|
|
155
|
-
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
156
|
-
allowedNodes.push(nodes.layoutSection);
|
|
157
|
-
}
|
|
154
|
+
const allowedNodes = [nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.layoutSection];
|
|
158
155
|
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
159
156
|
allowedNodes.push(nodes.expand);
|
|
160
157
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { injectIntl, useIntl } from 'react-intl-next';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
5
4
|
import { copyHTMLToClipboard } from '@atlaskit/editor-common/clipboard';
|
|
6
5
|
import { toDOM, copyDomNode } from '@atlaskit/editor-common/copy-button';
|
|
7
6
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -10,7 +9,6 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
|
|
|
10
9
|
import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
11
10
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
12
11
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
13
|
import { useBlockMenu } from './block-menu-provider';
|
|
16
14
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
@@ -109,7 +107,7 @@ const CopyBlockMenuItem = ({
|
|
|
109
107
|
}
|
|
110
108
|
// source sync block (bodiedSyncBlock) is also a special case
|
|
111
109
|
// where we need to copy the content of the bodiedSyncBlock node
|
|
112
|
-
else if (selection.node.type.name === 'bodiedSyncBlock' && expValEquals('platform_synced_block', 'isEnabled', true)
|
|
110
|
+
else if (selection.node.type.name === 'bodiedSyncBlock' && expValEquals('platform_synced_block', 'isEnabled', true)) {
|
|
113
111
|
const bodiedSyncBlockNode = selection.node;
|
|
114
112
|
const domNode = toDOMFromFragment(bodiedSyncBlockNode.content, schema);
|
|
115
113
|
copyDomNode(domNode, bodiedSyncBlockNode.type, selection);
|
|
@@ -128,12 +126,11 @@ const CopyBlockMenuItem = ({
|
|
|
128
126
|
onDropdownOpenChanged(false);
|
|
129
127
|
}
|
|
130
128
|
};
|
|
131
|
-
const text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.copyContent) : formatMessage(messages.copyBlock);
|
|
132
129
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
133
130
|
elemBefore: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
134
131
|
label: ""
|
|
135
132
|
}),
|
|
136
133
|
onClick: copyHandler
|
|
137
|
-
},
|
|
134
|
+
}, formatMessage(blockMenuMessages.copyContent));
|
|
138
135
|
};
|
|
139
136
|
export default injectIntl(CopyBlockMenuItem);
|
|
@@ -57,12 +57,11 @@ const CopyLinkDropdownItemContent = ({
|
|
|
57
57
|
if (!fg('platform_editor_adf_with_localid') || checkIsNestedNode()) {
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
|
-
const text = fg('platform_editor_block_menu_patch_1') ? formatMessage(messages.copyLinkToBlock) : formatMessage(messages.copyLink);
|
|
61
60
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
62
61
|
onClick: handleClick,
|
|
63
62
|
elemBefore: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
64
63
|
label: ""
|
|
65
64
|
})
|
|
66
|
-
},
|
|
65
|
+
}, formatMessage(messages.copyLinkToBlock));
|
|
67
66
|
};
|
|
68
67
|
export const CopyLinkDropdownItem = injectIntl(CopyLinkDropdownItemContent);
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useIntl, injectIntl } from 'react-intl-next';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
5
4
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
6
5
|
import { deleteSelectedRange } from '@atlaskit/editor-common/selection';
|
|
7
6
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
7
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
10
|
import { Box } from '@atlaskit/primitives/box';
|
|
13
11
|
import Text from '@atlaskit/primitives/text';
|
|
14
12
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
@@ -99,7 +97,6 @@ const DeleteDropdownItemContent = ({
|
|
|
99
97
|
onRemoveHoverDecoration();
|
|
100
98
|
};
|
|
101
99
|
}, [onRemoveHoverDecoration]);
|
|
102
|
-
const text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.deleteBlock) : formatMessage(messages.deleteBlock);
|
|
103
100
|
return /*#__PURE__*/React.createElement(Box, {
|
|
104
101
|
onMouseEnter: onShowHoverDecoration,
|
|
105
102
|
onMouseLeave: onRemoveHoverDecoration,
|
|
@@ -114,6 +111,6 @@ const DeleteDropdownItemContent = ({
|
|
|
114
111
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
115
112
|
as: "span",
|
|
116
113
|
color: "color.text.danger"
|
|
117
|
-
},
|
|
114
|
+
}, formatMessage(blockMenuMessages.deleteBlock))));
|
|
118
115
|
};
|
|
119
116
|
export const DeleteDropdownItem = injectIntl(DeleteDropdownItemContent);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
5
4
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
6
5
|
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
7
6
|
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
@@ -16,7 +15,6 @@ export const FormatMenuComponent = ({
|
|
|
16
15
|
const {
|
|
17
16
|
formatMessage
|
|
18
17
|
} = useIntl();
|
|
19
|
-
const text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.turnInto) : formatMessage(messages.turnInto);
|
|
20
18
|
const isDisabled = fg('platform_editor_block_menu_for_disabled_nodes') ? checkIsFormatMenuHidden(api) : false;
|
|
21
19
|
const handleClick = useCallback(() => {
|
|
22
20
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
@@ -36,7 +34,7 @@ export const FormatMenuComponent = ({
|
|
|
36
34
|
});
|
|
37
35
|
}, [api]);
|
|
38
36
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
39
|
-
text:
|
|
37
|
+
text: formatMessage(blockMenuMessages.turnInto),
|
|
40
38
|
elemBefore: /*#__PURE__*/React.createElement(ChangesIcon, {
|
|
41
39
|
label: ""
|
|
42
40
|
}),
|
|
@@ -16,10 +16,7 @@ const getIsFormatMenuHidden = (selection, schema, menuTriggerBy) => {
|
|
|
16
16
|
return !!disabledNode || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
17
17
|
}
|
|
18
18
|
let content;
|
|
19
|
-
const allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
20
|
-
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
21
|
-
allowedNodes.push(nodes.layoutSection);
|
|
22
|
-
}
|
|
19
|
+
const allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList, nodes.layoutSection];
|
|
23
20
|
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
24
21
|
allowedNodes.push(nodes.expand);
|
|
25
22
|
}
|
|
@@ -53,10 +50,7 @@ const getIsFormatMenuHiddenEmptyLine = (selection, schema, menuTriggerBy) => {
|
|
|
53
50
|
return true;
|
|
54
51
|
} else {
|
|
55
52
|
let content;
|
|
56
|
-
const allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
57
|
-
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
58
|
-
allowedNodes.push(nodes.layoutSection);
|
|
59
|
-
}
|
|
53
|
+
const allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList, nodes.layoutSection];
|
|
60
54
|
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
61
55
|
allowedNodes.push(nodes.expand);
|
|
62
56
|
}
|
|
@@ -141,10 +141,7 @@ export var formatNode = function formatNode(api) {
|
|
|
141
141
|
return newTr;
|
|
142
142
|
} else {
|
|
143
143
|
var _newTr = formatNodeWhenSelectionEmpty(tr, targetType, nodePos, schema);
|
|
144
|
-
var allowedNodes = [nodes.blockquote, nodes.panel, nodes.codeBlock];
|
|
145
|
-
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
146
|
-
allowedNodes.push(nodes.layoutSection);
|
|
147
|
-
}
|
|
144
|
+
var allowedNodes = [nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.layoutSection];
|
|
148
145
|
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
149
146
|
allowedNodes.push(nodes.expand);
|
|
150
147
|
}
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { injectIntl, useIntl } from 'react-intl-next';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
8
7
|
import { copyHTMLToClipboard } from '@atlaskit/editor-common/clipboard';
|
|
9
8
|
import { toDOM, copyDomNode } from '@atlaskit/editor-common/copy-button';
|
|
10
9
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -13,7 +12,6 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
|
|
|
13
12
|
import { isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
13
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
15
14
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
16
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
15
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
16
|
import { useBlockMenu } from './block-menu-provider';
|
|
19
17
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
@@ -107,7 +105,7 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
107
105
|
}
|
|
108
106
|
// source sync block (bodiedSyncBlock) is also a special case
|
|
109
107
|
// where we need to copy the content of the bodiedSyncBlock node
|
|
110
|
-
else if (selection.node.type.name === 'bodiedSyncBlock' && expValEquals('platform_synced_block', 'isEnabled', true)
|
|
108
|
+
else if (selection.node.type.name === 'bodiedSyncBlock' && expValEquals('platform_synced_block', 'isEnabled', true)) {
|
|
111
109
|
var bodiedSyncBlockNode = selection.node;
|
|
112
110
|
var _domNode3 = toDOMFromFragment(bodiedSyncBlockNode.content, schema);
|
|
113
111
|
copyDomNode(_domNode3, bodiedSyncBlockNode.type, selection);
|
|
@@ -126,12 +124,11 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
|
|
|
126
124
|
onDropdownOpenChanged(false);
|
|
127
125
|
}
|
|
128
126
|
};
|
|
129
|
-
var text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.copyContent) : formatMessage(messages.copyBlock);
|
|
130
127
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
131
128
|
elemBefore: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
132
129
|
label: ""
|
|
133
130
|
}),
|
|
134
131
|
onClick: copyHandler
|
|
135
|
-
},
|
|
132
|
+
}, formatMessage(blockMenuMessages.copyContent));
|
|
136
133
|
};
|
|
137
134
|
export default injectIntl(CopyBlockMenuItem);
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -53,12 +53,11 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
53
53
|
if (!fg('platform_editor_adf_with_localid') || checkIsNestedNode()) {
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
|
-
var text = fg('platform_editor_block_menu_patch_1') ? formatMessage(messages.copyLinkToBlock) : formatMessage(messages.copyLink);
|
|
57
56
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
58
57
|
onClick: handleClick,
|
|
59
58
|
elemBefore: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
60
59
|
label: ""
|
|
61
60
|
})
|
|
62
|
-
},
|
|
61
|
+
}, formatMessage(messages.copyLinkToBlock));
|
|
63
62
|
};
|
|
64
63
|
export var CopyLinkDropdownItem = injectIntl(CopyLinkDropdownItemContent);
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useIntl, injectIntl } from 'react-intl-next';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
5
4
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
6
5
|
import { deleteSelectedRange } from '@atlaskit/editor-common/selection';
|
|
7
6
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
7
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
10
|
import { Box } from '@atlaskit/primitives/box';
|
|
13
11
|
import Text from '@atlaskit/primitives/text';
|
|
14
12
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
@@ -94,7 +92,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
94
92
|
onRemoveHoverDecoration();
|
|
95
93
|
};
|
|
96
94
|
}, [onRemoveHoverDecoration]);
|
|
97
|
-
var text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.deleteBlock) : formatMessage(messages.deleteBlock);
|
|
98
95
|
return /*#__PURE__*/React.createElement(Box, {
|
|
99
96
|
onMouseEnter: onShowHoverDecoration,
|
|
100
97
|
onMouseLeave: onRemoveHoverDecoration,
|
|
@@ -109,6 +106,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
|
|
|
109
106
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
110
107
|
as: "span",
|
|
111
108
|
color: "color.text.danger"
|
|
112
|
-
},
|
|
109
|
+
}, formatMessage(blockMenuMessages.deleteBlock))));
|
|
113
110
|
};
|
|
114
111
|
export var DeleteDropdownItem = injectIntl(DeleteDropdownItemContent);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { messages } from '@atlaskit/editor-common/block-menu';
|
|
5
4
|
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
6
5
|
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
7
6
|
import ChangesIcon from '@atlaskit/icon/core/changes';
|
|
@@ -14,7 +13,6 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
|
|
|
14
13
|
children = _ref.children;
|
|
15
14
|
var _useIntl = useIntl(),
|
|
16
15
|
formatMessage = _useIntl.formatMessage;
|
|
17
|
-
var text = fg('platform_editor_block_menu_patch_1') ? formatMessage(blockMenuMessages.turnInto) : formatMessage(messages.turnInto);
|
|
18
16
|
var isDisabled = fg('platform_editor_block_menu_for_disabled_nodes') ? checkIsFormatMenuHidden(api) : false;
|
|
19
17
|
var handleClick = useCallback(function () {
|
|
20
18
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
@@ -33,7 +31,7 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
|
|
|
33
31
|
});
|
|
34
32
|
}, [api]);
|
|
35
33
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
36
|
-
text:
|
|
34
|
+
text: formatMessage(blockMenuMessages.turnInto),
|
|
37
35
|
elemBefore: /*#__PURE__*/React.createElement(ChangesIcon, {
|
|
38
36
|
label: ""
|
|
39
37
|
}),
|
|
@@ -16,10 +16,7 @@ var getIsFormatMenuHidden = function getIsFormatMenuHidden(selection, schema, me
|
|
|
16
16
|
return !!disabledNode || isNested && !fg('platform_editor_block_menu_transform_nested_node');
|
|
17
17
|
}
|
|
18
18
|
var content;
|
|
19
|
-
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
20
|
-
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
21
|
-
allowedNodes.push(nodes.layoutSection);
|
|
22
|
-
}
|
|
19
|
+
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList, nodes.layoutSection];
|
|
23
20
|
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
24
21
|
allowedNodes.push(nodes.expand);
|
|
25
22
|
}
|
|
@@ -53,10 +50,7 @@ var getIsFormatMenuHiddenEmptyLine = function getIsFormatMenuHiddenEmptyLine(sel
|
|
|
53
50
|
return true;
|
|
54
51
|
} else {
|
|
55
52
|
var content;
|
|
56
|
-
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList];
|
|
57
|
-
if (expValEquals('platform_editor_block_menu_layout_format', 'isEnabled', true)) {
|
|
58
|
-
allowedNodes.push(nodes.layoutSection);
|
|
59
|
-
}
|
|
53
|
+
var allowedNodes = [nodes.paragraph, nodes.heading, nodes.blockquote, nodes.panel, nodes.codeBlock, nodes.bulletList, nodes.orderedList, nodes.taskList, nodes.layoutSection];
|
|
60
54
|
if (expValEquals('platform_editor_block_menu_expand_format', 'isEnabled', true)) {
|
|
61
55
|
allowedNodes.push(nodes.expand);
|
|
62
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.14",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
46
46
|
"@atlaskit/primitives": "^16.2.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
48
|
-
"@atlaskit/tokens": "^8.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^13.41.0",
|
|
48
|
+
"@atlaskit/tokens": "^8.2.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^110.
|
|
52
|
+
"@atlaskit/editor-common": "^110.33.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
55
55
|
},
|
|
@@ -96,9 +96,6 @@
|
|
|
96
96
|
"platform_editor_block_menu_transform_nested_node": {
|
|
97
97
|
"type": "boolean"
|
|
98
98
|
},
|
|
99
|
-
"platform_editor_block_menu_patch_1": {
|
|
100
|
-
"type": "boolean"
|
|
101
|
-
},
|
|
102
99
|
"platform_editor_block_menu_for_disabled_nodes": {
|
|
103
100
|
"type": "boolean"
|
|
104
101
|
},
|