@atlaskit/editor-plugin-text-formatting 2.2.6 → 2.2.7

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,13 @@
1
1
  # @atlaskit/editor-plugin-text-formatting
2
2
 
3
+ ## 2.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#155215](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/155215)
8
+ [`7e8680d1d66be`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7e8680d1d66be) -
9
+ Disallow default cmd+u shortcut behaviour when text formating is not allowed in editor
10
+
3
11
  ## 2.2.6
4
12
 
5
13
  ### Patch Changes
@@ -11,6 +11,8 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
11
  var _utils = require("@atlaskit/editor-common/utils");
12
12
  var _commands = require("@atlaskit/editor-prosemirror/commands");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
14
16
  var _textFormatting = _interopRequireWildcard(require("../editor-commands/text-formatting"));
15
17
  var commands = _textFormatting;
16
18
  var _pluginKey = require("./plugin-key");
@@ -103,12 +105,16 @@ var plugin = exports.plugin = function plugin(dispatch, editorAnalyticsAPI) {
103
105
  key: _pluginKey.pluginKey,
104
106
  props: {
105
107
  handleKeyDown: function handleKeyDown(view, event) {
108
+ var _pluginKey$getState;
106
109
  var state = view.state,
107
110
  dispatch = view.dispatch;
108
111
  if (event.key === _keymaps.moveRight.common && !event.metaKey) {
109
112
  return commands.moveRight()(state, dispatch);
110
113
  } else if (event.key === _keymaps.moveLeft.common && !event.metaKey) {
111
114
  return commands.moveLeft()(state, dispatch);
115
+ } else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = _pluginKey.pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9')) {
116
+ // This is a workaround for browser behaviour with cmd+u (in Chrome only) where the underline mark being applied around the selection
117
+ event.preventDefault();
112
118
  }
113
119
  return false;
114
120
  },
@@ -7,6 +7,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { shallowEqual } from '@atlaskit/editor-common/utils';
8
8
  import { toggleMark } from '@atlaskit/editor-prosemirror/commands';
9
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
12
  import { createInlineCodeFromTextInputWithAnalytics } from '../editor-commands/text-formatting';
11
13
  // Ignored via go/ees005
12
14
  // eslint-disable-next-line import/no-namespace
@@ -93,6 +95,7 @@ export const plugin = (dispatch, editorAnalyticsAPI) => new SafePlugin({
93
95
  key: pluginKey,
94
96
  props: {
95
97
  handleKeyDown(view, event) {
98
+ var _pluginKey$getState;
96
99
  const {
97
100
  state,
98
101
  dispatch
@@ -101,6 +104,9 @@ export const plugin = (dispatch, editorAnalyticsAPI) => new SafePlugin({
101
104
  return commands.moveRight()(state, dispatch);
102
105
  } else if (event.key === keymapMoveLeft.common && !event.metaKey) {
103
106
  return commands.moveLeft()(state, dispatch);
107
+ } else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_9')) {
108
+ // This is a workaround for browser behaviour with cmd+u (in Chrome only) where the underline mark being applied around the selection
109
+ event.preventDefault();
104
110
  }
105
111
  return false;
106
112
  },
@@ -7,6 +7,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { shallowEqual } from '@atlaskit/editor-common/utils';
8
8
  import { toggleMark } from '@atlaskit/editor-prosemirror/commands';
9
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
12
  import { createInlineCodeFromTextInputWithAnalytics } from '../editor-commands/text-formatting';
11
13
  // Ignored via go/ees005
12
14
  // eslint-disable-next-line import/no-namespace
@@ -93,12 +95,16 @@ export var plugin = function plugin(dispatch, editorAnalyticsAPI) {
93
95
  key: pluginKey,
94
96
  props: {
95
97
  handleKeyDown: function handleKeyDown(view, event) {
98
+ var _pluginKey$getState;
96
99
  var state = view.state,
97
100
  dispatch = view.dispatch;
98
101
  if (event.key === keymapMoveRight.common && !event.metaKey) {
99
102
  return commands.moveRight()(state, dispatch);
100
103
  } else if (event.key === keymapMoveLeft.common && !event.metaKey) {
101
104
  return commands.moveLeft()(state, dispatch);
105
+ } else if (event.key === 'u' && event.metaKey && (_pluginKey$getState = pluginKey.getState(state)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.underlineDisabled && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_9')) {
106
+ // This is a workaround for browser behaviour with cmd+u (in Chrome only) where the underline mark being applied around the selection
107
+ event.preventDefault();
102
108
  }
103
109
  return false;
104
110
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
- "@atlaskit/editor-common": "^105.2.0",
37
+ "@atlaskit/editor-common": "^105.3.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
39
39
  "@atlaskit/editor-plugin-base": "^3.0.0",
40
40
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/icon": "^26.0.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
47
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
48
- "@atlaskit/tmp-editor-statsig": "^4.21.0",
48
+ "@atlaskit/tmp-editor-statsig": "^4.22.0",
49
49
  "@atlaskit/tokens": "^4.8.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",
@@ -110,6 +110,9 @@
110
110
  "platform_editor_controls_patch_8": {
111
111
  "type": "boolean"
112
112
  },
113
+ "platform_editor_controls_patch_9": {
114
+ "type": "boolean"
115
+ },
113
116
  "editor_inline_comments_on_inline_nodes": {
114
117
  "type": "boolean"
115
118
  },