@atlaskit/editor-plugin-paste-options-toolbar 9.1.1 → 9.1.2
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 +10 -0
- package/dist/cjs/pm-plugins/main.js +12 -1
- package/dist/es2019/pm-plugins/main.js +12 -1
- package/dist/esm/pm-plugins/main.js +12 -1
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste-options-toolbar
|
|
2
2
|
|
|
3
|
+
## 9.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0386f83e8c2b8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0386f83e8c2b8) -
|
|
8
|
+
Fix paste actions menu dismissing when pressing modifier keys (Ctrl, Shift, Alt, Meta/Cmd).
|
|
9
|
+
Modifier-only key presses no longer hide the toolbar, gated behind
|
|
10
|
+
platform_editor_paste_actions_keypress_fix feature flag.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 9.1.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -7,10 +7,17 @@ exports.createPlugin = createPlugin;
|
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
9
|
var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _commands = require("../editor-commands/commands");
|
|
11
12
|
var _types = require("../types/types");
|
|
12
13
|
var _constants = require("./constants");
|
|
13
14
|
var _pluginFactory = require("./plugin-factory");
|
|
15
|
+
var MODIFIER_KEYS = new Set(['Shift', 'Control', 'Alt', 'Meta',
|
|
16
|
+
// Cmd on Mac, Win on Windows
|
|
17
|
+
'CapsLock', 'NumLock', 'ScrollLock', 'Fn', 'FnLock']);
|
|
18
|
+
function isModifierKey(event) {
|
|
19
|
+
return MODIFIER_KEYS.has(event.key);
|
|
20
|
+
}
|
|
14
21
|
function createPlugin(dispatch, options) {
|
|
15
22
|
return new _safePlugin.SafePlugin({
|
|
16
23
|
key: _types.pasteOptionsPluginKey,
|
|
@@ -46,7 +53,11 @@ function createPlugin(dispatch, options) {
|
|
|
46
53
|
// Hide toolbar when clicked anywhere within the editor, tr.getMeta('pointer') does not work if clicked on the same line after pasting so relying on mousedown event
|
|
47
54
|
mousedown: _commands.checkAndHideToolbar
|
|
48
55
|
},
|
|
49
|
-
handleKeyDown: function handleKeyDown(view) {
|
|
56
|
+
handleKeyDown: function handleKeyDown(view, event) {
|
|
57
|
+
// Don't hide toolbar when pressing modifier keys alone (Ctrl, Shift, Alt, Meta/Cmd)
|
|
58
|
+
if (isModifierKey(event) && (0, _platformFeatureFlags.fg)('platform_editor_paste_actions_keypress_fix')) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
50
61
|
(0, _commands.checkAndHideToolbar)(view);
|
|
51
62
|
return false;
|
|
52
63
|
},
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { checkAndHideToolbar } from '../editor-commands/commands';
|
|
5
6
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
6
7
|
import { PASTE_HIGHLIGHT_DECORATION_KEY, TEXT_HIGHLIGHT_CLASS } from './constants';
|
|
7
8
|
import { createPluginState } from './plugin-factory';
|
|
9
|
+
const MODIFIER_KEYS = new Set(['Shift', 'Control', 'Alt', 'Meta',
|
|
10
|
+
// Cmd on Mac, Win on Windows
|
|
11
|
+
'CapsLock', 'NumLock', 'ScrollLock', 'Fn', 'FnLock']);
|
|
12
|
+
function isModifierKey(event) {
|
|
13
|
+
return MODIFIER_KEYS.has(event.key);
|
|
14
|
+
}
|
|
8
15
|
export function createPlugin(dispatch, options) {
|
|
9
16
|
return new SafePlugin({
|
|
10
17
|
key: pasteOptionsPluginKey,
|
|
@@ -40,7 +47,11 @@ export function createPlugin(dispatch, options) {
|
|
|
40
47
|
// Hide toolbar when clicked anywhere within the editor, tr.getMeta('pointer') does not work if clicked on the same line after pasting so relying on mousedown event
|
|
41
48
|
mousedown: checkAndHideToolbar
|
|
42
49
|
},
|
|
43
|
-
handleKeyDown: view => {
|
|
50
|
+
handleKeyDown: (view, event) => {
|
|
51
|
+
// Don't hide toolbar when pressing modifier keys alone (Ctrl, Shift, Alt, Meta/Cmd)
|
|
52
|
+
if (isModifierKey(event) && fg('platform_editor_paste_actions_keypress_fix')) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
44
55
|
checkAndHideToolbar(view);
|
|
45
56
|
return false;
|
|
46
57
|
},
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { checkAndHideToolbar } from '../editor-commands/commands';
|
|
5
6
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
6
7
|
import { PASTE_HIGHLIGHT_DECORATION_KEY, TEXT_HIGHLIGHT_CLASS } from './constants';
|
|
7
8
|
import { createPluginState } from './plugin-factory';
|
|
9
|
+
var MODIFIER_KEYS = new Set(['Shift', 'Control', 'Alt', 'Meta',
|
|
10
|
+
// Cmd on Mac, Win on Windows
|
|
11
|
+
'CapsLock', 'NumLock', 'ScrollLock', 'Fn', 'FnLock']);
|
|
12
|
+
function isModifierKey(event) {
|
|
13
|
+
return MODIFIER_KEYS.has(event.key);
|
|
14
|
+
}
|
|
8
15
|
export function createPlugin(dispatch, options) {
|
|
9
16
|
return new SafePlugin({
|
|
10
17
|
key: pasteOptionsPluginKey,
|
|
@@ -40,7 +47,11 @@ export function createPlugin(dispatch, options) {
|
|
|
40
47
|
// Hide toolbar when clicked anywhere within the editor, tr.getMeta('pointer') does not work if clicked on the same line after pasting so relying on mousedown event
|
|
41
48
|
mousedown: checkAndHideToolbar
|
|
42
49
|
},
|
|
43
|
-
handleKeyDown: function handleKeyDown(view) {
|
|
50
|
+
handleKeyDown: function handleKeyDown(view, event) {
|
|
51
|
+
// Don't hide toolbar when pressing modifier keys alone (Ctrl, Shift, Alt, Meta/Cmd)
|
|
52
|
+
if (isModifierKey(event) && fg('platform_editor_paste_actions_keypress_fix')) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
44
55
|
checkAndHideToolbar(view);
|
|
45
56
|
return false;
|
|
46
57
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.2",
|
|
4
4
|
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,6 +56,11 @@
|
|
|
56
56
|
"@testing-library/react": "^16.3.0",
|
|
57
57
|
"wait-for-expect": "^1.2.0"
|
|
58
58
|
},
|
|
59
|
+
"platform-feature-flags": {
|
|
60
|
+
"platform_editor_paste_actions_keypress_fix": {
|
|
61
|
+
"type": "boolean"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
59
64
|
"techstack": {
|
|
60
65
|
"@atlassian/frontend": {
|
|
61
66
|
"code-structure": [
|