@atlaskit/editor-plugin-block-menu 25.0.0 → 25.1.0
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 +19 -0
- package/dist/cjs/pm-plugins/keymap.js +2 -3
- package/dist/cjs/pm-plugins/utils/isCopyLinkEnabled.js +23 -0
- package/dist/cjs/ui/copy-link.js +2 -4
- package/dist/es2019/pm-plugins/keymap.js +2 -3
- package/dist/es2019/pm-plugins/utils/isCopyLinkEnabled.js +17 -0
- package/dist/es2019/ui/copy-link.js +2 -4
- package/dist/esm/pm-plugins/keymap.js +2 -3
- package/dist/esm/pm-plugins/utils/isCopyLinkEnabled.js +17 -0
- package/dist/esm/ui/copy-link.js +2 -4
- package/dist/types/blockMenuPluginType.d.ts +9 -0
- package/dist/types/pm-plugins/utils/isCopyLinkEnabled.d.ts +9 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 25.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a4adb021ec6f2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a4adb021ec6f2) -
|
|
8
|
+
Add `enableCopyLinkToSelection` block menu option (default `false`) so the "Copy link" item and
|
|
9
|
+
its keyboard shortcut are opt-in per editor preset, and enable it for Confluence presets. The
|
|
10
|
+
option is only respected behind the `platform_editor_block_menu_copy_link_opt_in` feature gate
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 25.0.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 25.0.0
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -6,16 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.keymapPlugin = keymapPlugin;
|
|
7
7
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
8
8
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
9
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
10
9
|
var _blockMenuPluginType = require("../blockMenuPluginType");
|
|
11
10
|
var _main = require("../pm-plugins/main");
|
|
12
11
|
var _copyLink = require("../ui/utils/copyLink");
|
|
12
|
+
var _isCopyLinkEnabled = require("./utils/isCopyLinkEnabled");
|
|
13
13
|
function keymapPlugin(api, config) {
|
|
14
14
|
var list = {};
|
|
15
15
|
var copyLinkToBlockCommand = function copyLinkToBlockCommand(state, dispatch) {
|
|
16
16
|
var _api$blockControls, _node$attrs;
|
|
17
|
-
|
|
18
|
-
if (!(0, _fg.fg)('platform_editor_adf_with_localid')) {
|
|
17
|
+
if (!(0, _isCopyLinkEnabled.isCopyLinkEnabled)(config)) {
|
|
19
18
|
return false;
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isCopyLinkEnabled = void 0;
|
|
7
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
|
+
/**
|
|
9
|
+
* Whether the "Copy link" block menu item and its keyboard shortcut are available.
|
|
10
|
+
*
|
|
11
|
+
* Copy link only works when blocks have localIds, so it is opt-in per editor preset via
|
|
12
|
+
* `enableCopyLinkToSelection`. While `platform_editor_block_menu_copy_link_opt_in` is off, the previous
|
|
13
|
+
* behaviour is kept and `enableCopyLinkToSelection` is ignored.
|
|
14
|
+
*/
|
|
15
|
+
var isCopyLinkEnabled = exports.isCopyLinkEnabled = function isCopyLinkEnabled(config) {
|
|
16
|
+
if (!(0, _fg.fg)('platform_editor_adf_with_localid')) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if ((0, _fg.fg)('platform_editor_block_menu_copy_link_opt_in')) {
|
|
20
|
+
return Boolean(config === null || config === void 0 ? void 0 : config.enableCopyLinkToSelection);
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
};
|
package/dist/cjs/ui/copy-link.js
CHANGED
|
@@ -15,9 +15,9 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
15
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
16
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
17
17
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
18
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
19
18
|
var _blockMenuPluginType = require("../blockMenuPluginType");
|
|
20
19
|
var _main = require("../pm-plugins/main");
|
|
20
|
+
var _isCopyLinkEnabled = require("../pm-plugins/utils/isCopyLinkEnabled");
|
|
21
21
|
var _blockMenuProvider = require("./block-menu-provider");
|
|
22
22
|
var _consts = require("./consts");
|
|
23
23
|
var _copyLink = require("./utils/copyLink");
|
|
@@ -84,9 +84,7 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}, [api, blockLinkHashPrefix, getLinkPath, onDropdownOpenChanged, selection]);
|
|
87
|
-
|
|
88
|
-
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off
|
|
89
|
-
if (!(0, _fg.fg)('platform_editor_adf_with_localid')) {
|
|
87
|
+
if (!(0, _isCopyLinkEnabled.isCopyLinkEnabled)(config)) {
|
|
90
88
|
return null;
|
|
91
89
|
}
|
|
92
90
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { bindKeymapWithCommand, copyLinkToBlock, keymap } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { expandSelectionToBlockRange } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
3
|
import { FLAG_ID } from '../blockMenuPluginType';
|
|
5
4
|
import { blockMenuPluginKey } from '../pm-plugins/main';
|
|
6
5
|
import { copyLink } from '../ui/utils/copyLink';
|
|
6
|
+
import { isCopyLinkEnabled } from './utils/isCopyLinkEnabled';
|
|
7
7
|
export function keymapPlugin(api, config) {
|
|
8
8
|
const list = {};
|
|
9
9
|
const copyLinkToBlockCommand = (state, dispatch) => {
|
|
10
10
|
var _api$blockControls, _api$blockControls$sh, _node$attrs;
|
|
11
|
-
|
|
12
|
-
if (!fg('platform_editor_adf_with_localid')) {
|
|
11
|
+
if (!isCopyLinkEnabled(config)) {
|
|
13
12
|
return false;
|
|
14
13
|
}
|
|
15
14
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the "Copy link" block menu item and its keyboard shortcut are available.
|
|
4
|
+
*
|
|
5
|
+
* Copy link only works when blocks have localIds, so it is opt-in per editor preset via
|
|
6
|
+
* `enableCopyLinkToSelection`. While `platform_editor_block_menu_copy_link_opt_in` is off, the previous
|
|
7
|
+
* behaviour is kept and `enableCopyLinkToSelection` is ignored.
|
|
8
|
+
*/
|
|
9
|
+
export const isCopyLinkEnabled = config => {
|
|
10
|
+
if (!fg('platform_editor_adf_with_localid')) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (fg('platform_editor_block_menu_copy_link_opt_in')) {
|
|
14
|
+
return Boolean(config === null || config === void 0 ? void 0 : config.enableCopyLinkToSelection);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
};
|
|
@@ -7,9 +7,9 @@ import { copyLinkToBlock, formatShortcut } from '@atlaskit/editor-common/keymaps
|
|
|
7
7
|
import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
9
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
10
|
import { FLAG_ID } from '../blockMenuPluginType';
|
|
12
11
|
import { blockMenuPluginKey } from '../pm-plugins/main';
|
|
12
|
+
import { isCopyLinkEnabled } from '../pm-plugins/utils/isCopyLinkEnabled';
|
|
13
13
|
import { useBlockMenu } from './block-menu-provider';
|
|
14
14
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
15
15
|
import { copyLink } from './utils/copyLink';
|
|
@@ -83,9 +83,7 @@ const CopyLinkDropdownItemContent = ({
|
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
}, [api, blockLinkHashPrefix, getLinkPath, onDropdownOpenChanged, selection]);
|
|
86
|
-
|
|
87
|
-
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off
|
|
88
|
-
if (!fg('platform_editor_adf_with_localid')) {
|
|
86
|
+
if (!isCopyLinkEnabled(config)) {
|
|
89
87
|
return null;
|
|
90
88
|
}
|
|
91
89
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { bindKeymapWithCommand, copyLinkToBlock, keymap } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { expandSelectionToBlockRange } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
3
|
import { FLAG_ID } from '../blockMenuPluginType';
|
|
5
4
|
import { blockMenuPluginKey } from '../pm-plugins/main';
|
|
6
5
|
import { copyLink } from '../ui/utils/copyLink';
|
|
6
|
+
import { isCopyLinkEnabled } from './utils/isCopyLinkEnabled';
|
|
7
7
|
export function keymapPlugin(api, config) {
|
|
8
8
|
var list = {};
|
|
9
9
|
var copyLinkToBlockCommand = function copyLinkToBlockCommand(state, dispatch) {
|
|
10
10
|
var _api$blockControls, _node$attrs;
|
|
11
|
-
|
|
12
|
-
if (!fg('platform_editor_adf_with_localid')) {
|
|
11
|
+
if (!isCopyLinkEnabled(config)) {
|
|
13
12
|
return false;
|
|
14
13
|
}
|
|
15
14
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the "Copy link" block menu item and its keyboard shortcut are available.
|
|
4
|
+
*
|
|
5
|
+
* Copy link only works when blocks have localIds, so it is opt-in per editor preset via
|
|
6
|
+
* `enableCopyLinkToSelection`. While `platform_editor_block_menu_copy_link_opt_in` is off, the previous
|
|
7
|
+
* behaviour is kept and `enableCopyLinkToSelection` is ignored.
|
|
8
|
+
*/
|
|
9
|
+
export var isCopyLinkEnabled = function isCopyLinkEnabled(config) {
|
|
10
|
+
if (!fg('platform_editor_adf_with_localid')) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (fg('platform_editor_block_menu_copy_link_opt_in')) {
|
|
14
|
+
return Boolean(config === null || config === void 0 ? void 0 : config.enableCopyLinkToSelection);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
};
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -7,9 +7,9 @@ import { copyLinkToBlock, formatShortcut } from '@atlaskit/editor-common/keymaps
|
|
|
7
7
|
import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
9
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
10
|
import { FLAG_ID } from '../blockMenuPluginType';
|
|
12
11
|
import { blockMenuPluginKey } from '../pm-plugins/main';
|
|
12
|
+
import { isCopyLinkEnabled } from '../pm-plugins/utils/isCopyLinkEnabled';
|
|
13
13
|
import { useBlockMenu } from './block-menu-provider';
|
|
14
14
|
import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
15
15
|
import { copyLink } from './utils/copyLink';
|
|
@@ -75,9 +75,7 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}, [api, blockLinkHashPrefix, getLinkPath, onDropdownOpenChanged, selection]);
|
|
78
|
-
|
|
79
|
-
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off
|
|
80
|
-
if (!fg('platform_editor_adf_with_localid')) {
|
|
78
|
+
if (!isCopyLinkEnabled(config)) {
|
|
81
79
|
return null;
|
|
82
80
|
}
|
|
83
81
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -39,6 +39,15 @@ export type BlockMenuPluginOptions = {
|
|
|
39
39
|
* Default value from DEFAULT_BLOCK_LINK_HASH_PREFIX in @atlaskit/editor-common/block-menu
|
|
40
40
|
*/
|
|
41
41
|
blockLinkHashPrefix?: string;
|
|
42
|
+
/**
|
|
43
|
+
* When true, shows the "Copy link" block menu item and enables its keyboard shortcut.
|
|
44
|
+
*
|
|
45
|
+
* Copy link requires blocks to have localIds (e.g. via `@atlaskit/editor-plugin-local-id`)
|
|
46
|
+
* and the product to handle block link hashes in the URL, so it is opt-in.
|
|
47
|
+
* Only respected when `platform_editor_block_menu_copy_link_opt_in` is enabled.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
enableCopyLinkToSelection?: boolean;
|
|
42
51
|
/**
|
|
43
52
|
* Optional function to retrieve the current link path for the editor context.
|
|
44
53
|
* @returns The current link path as a string, or null if no path is available
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockMenuPluginOptions } from '../../blockMenuPluginType';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the "Copy link" block menu item and its keyboard shortcut are available.
|
|
4
|
+
*
|
|
5
|
+
* Copy link only works when blocks have localIds, so it is opt-in per editor preset via
|
|
6
|
+
* `enableCopyLinkToSelection`. While `platform_editor_block_menu_copy_link_opt_in` is off, the previous
|
|
7
|
+
* behaviour is kept and `enableCopyLinkToSelection` is ignored.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isCopyLinkEnabled: (config: BlockMenuPluginOptions | undefined) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.1.0",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@atlaskit/editor-plugin-selection": "^26.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-user-intent": "^24.0.0",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
36
|
-
"@atlaskit/editor-shared-styles": "^4.
|
|
36
|
+
"@atlaskit/editor-shared-styles": "^4.4.0",
|
|
37
37
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
38
38
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
39
39
|
"@atlaskit/flag": "^19.0.0",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
43
43
|
"@atlaskit/primitives": "^22.5.0",
|
|
44
44
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^229.0.0",
|
|
46
46
|
"@atlaskit/tokens": "^20.4.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"bind-event-listener": "^3.0.0",
|
|
49
49
|
"memoize-one": "^6.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^130.
|
|
52
|
+
"@atlaskit/editor-common": "^130.3.0",
|
|
53
53
|
"react": "^18.2.0 || ^19.2.0",
|
|
54
54
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
55
55
|
},
|
|
@@ -57,6 +57,9 @@
|
|
|
57
57
|
"platform_editor_adf_with_localid": {
|
|
58
58
|
"type": "boolean"
|
|
59
59
|
},
|
|
60
|
+
"platform_editor_block_menu_copy_link_opt_in": {
|
|
61
|
+
"type": "boolean"
|
|
62
|
+
},
|
|
60
63
|
"cc_blocks_changeboarding": {
|
|
61
64
|
"type": "boolean"
|
|
62
65
|
},
|