@atlaskit/editor-plugin-block-type 7.0.0 → 7.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 7.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`390ac7cfff929`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/390ac7cfff929) -
8
+ [https://product-fabric.atlassian.net/browse/ED-24010](ED-24010) - Adds numpad support to the
9
+ shortcuts for creating headings (Ctrl+Alt+0 to Ctrl+Alt+9)
10
+
11
+ ## 7.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 7.0.0
4
18
 
5
19
  ### Patch Changes
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.HEADING_KEYS = void 0;
6
+ exports.HEADING_NUMPAD_KEYS = exports.HEADING_KEYS = void 0;
7
7
  var KEY_0 = 48;
8
8
  var KEY_1 = 49;
9
9
  var KEY_2 = 50;
@@ -11,4 +11,12 @@ var KEY_3 = 51;
11
11
  var KEY_4 = 52;
12
12
  var KEY_5 = 53;
13
13
  var KEY_6 = 54;
14
- var HEADING_KEYS = exports.HEADING_KEYS = [KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6];
14
+ var HEADING_KEYS = exports.HEADING_KEYS = [KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6];
15
+ var NUMPAD_KEY_0 = 96;
16
+ var NUMPAD_KEY_1 = 97;
17
+ var NUMPAD_KEY_2 = 98;
18
+ var NUMPAD_KEY_3 = 99;
19
+ var NUMPAD_KEY_4 = 100;
20
+ var NUMPAD_KEY_5 = 101;
21
+ var NUMPAD_KEY_6 = 102;
22
+ var HEADING_NUMPAD_KEYS = exports.HEADING_NUMPAD_KEYS = [NUMPAD_KEY_0, NUMPAD_KEY_1, NUMPAD_KEY_2, NUMPAD_KEY_3, NUMPAD_KEY_4, NUMPAD_KEY_5, NUMPAD_KEY_6];
@@ -10,6 +10,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _browser = require("@atlaskit/editor-common/browser");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _blockTypes = require("./block-types");
14
15
  var _blockType = require("./commands/block-type");
15
16
  var _consts = require("./consts");
@@ -139,6 +140,10 @@ var createPlugin = exports.createPlugin = function createPlugin(editorAPI, dispa
139
140
  */
140
141
  handleKeyDown: function handleKeyDown(view, event) {
141
142
  var headingLevel = _consts.HEADING_KEYS.indexOf(event.keyCode);
143
+ if (headingLevel === -1 && (0, _platformFeatureFlags.fg)('platform_editor_heading_from_numpad')) {
144
+ // Check for numpad keys if not found in digits row
145
+ headingLevel = _consts.HEADING_NUMPAD_KEYS.indexOf(event.keyCode);
146
+ }
142
147
  if (headingLevel > -1 && event.altKey) {
143
148
  if (_browser.browser.mac && event.metaKey) {
144
149
  var _editorAPI$core$actio, _editorAPI$core;
@@ -5,4 +5,12 @@ const KEY_3 = 51;
5
5
  const KEY_4 = 52;
6
6
  const KEY_5 = 53;
7
7
  const KEY_6 = 54;
8
- export const HEADING_KEYS = [KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6];
8
+ export const HEADING_KEYS = [KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6];
9
+ const NUMPAD_KEY_0 = 96;
10
+ const NUMPAD_KEY_1 = 97;
11
+ const NUMPAD_KEY_2 = 98;
12
+ const NUMPAD_KEY_3 = 99;
13
+ const NUMPAD_KEY_4 = 100;
14
+ const NUMPAD_KEY_5 = 101;
15
+ const NUMPAD_KEY_6 = 102;
16
+ export const HEADING_NUMPAD_KEYS = [NUMPAD_KEY_0, NUMPAD_KEY_1, NUMPAD_KEY_2, NUMPAD_KEY_3, NUMPAD_KEY_4, NUMPAD_KEY_5, NUMPAD_KEY_6];
@@ -2,9 +2,10 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { browser } from '@atlaskit/editor-common/browser';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown } from './block-types';
6
7
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands/block-type';
7
- import { HEADING_KEYS } from './consts';
8
+ import { HEADING_KEYS, HEADING_NUMPAD_KEYS } from './consts';
8
9
  import { areBlockTypesDisabled, checkFormattingIsPresent, hasBlockQuoteInOptions } from './utils';
9
10
  const blockTypeForNode = (node, schema) => {
10
11
  if (node.type === schema.nodes.heading) {
@@ -124,7 +125,11 @@ export const createPlugin = (editorAPI, dispatch, lastNodeMustBeParagraph, inclu
124
125
  * Shortcut on Windows: Ctrl-LeftAlt-{heading level}
125
126
  */
126
127
  handleKeyDown: (view, event) => {
127
- const headingLevel = HEADING_KEYS.indexOf(event.keyCode);
128
+ let headingLevel = HEADING_KEYS.indexOf(event.keyCode);
129
+ if (headingLevel === -1 && fg('platform_editor_heading_from_numpad')) {
130
+ // Check for numpad keys if not found in digits row
131
+ headingLevel = HEADING_NUMPAD_KEYS.indexOf(event.keyCode);
132
+ }
128
133
  if (headingLevel > -1 && event.altKey) {
129
134
  if (browser.mac && event.metaKey) {
130
135
  var _editorAPI$core$actio, _editorAPI$core;
@@ -5,4 +5,12 @@ var KEY_3 = 51;
5
5
  var KEY_4 = 52;
6
6
  var KEY_5 = 53;
7
7
  var KEY_6 = 54;
8
- export var HEADING_KEYS = [KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6];
8
+ export var HEADING_KEYS = [KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6];
9
+ var NUMPAD_KEY_0 = 96;
10
+ var NUMPAD_KEY_1 = 97;
11
+ var NUMPAD_KEY_2 = 98;
12
+ var NUMPAD_KEY_3 = 99;
13
+ var NUMPAD_KEY_4 = 100;
14
+ var NUMPAD_KEY_5 = 101;
15
+ var NUMPAD_KEY_6 = 102;
16
+ export var HEADING_NUMPAD_KEYS = [NUMPAD_KEY_0, NUMPAD_KEY_1, NUMPAD_KEY_2, NUMPAD_KEY_3, NUMPAD_KEY_4, NUMPAD_KEY_5, NUMPAD_KEY_6];
@@ -5,9 +5,10 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { browser } from '@atlaskit/editor-common/browser';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { BLOCK_QUOTE, CODE_BLOCK, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, HEADINGS_BY_LEVEL, NORMAL_TEXT, OTHER, PANEL, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, getBlockTypesInDropdown } from './block-types';
9
10
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from './commands/block-type';
10
- import { HEADING_KEYS } from './consts';
11
+ import { HEADING_KEYS, HEADING_NUMPAD_KEYS } from './consts';
11
12
  import { areBlockTypesDisabled, checkFormattingIsPresent, hasBlockQuoteInOptions } from './utils';
12
13
  var blockTypeForNode = function blockTypeForNode(node, schema) {
13
14
  if (node.type === schema.nodes.heading) {
@@ -132,6 +133,10 @@ export var createPlugin = function createPlugin(editorAPI, dispatch, lastNodeMus
132
133
  */
133
134
  handleKeyDown: function handleKeyDown(view, event) {
134
135
  var headingLevel = HEADING_KEYS.indexOf(event.keyCode);
136
+ if (headingLevel === -1 && fg('platform_editor_heading_from_numpad')) {
137
+ // Check for numpad keys if not found in digits row
138
+ headingLevel = HEADING_NUMPAD_KEYS.indexOf(event.keyCode);
139
+ }
135
140
  if (headingLevel > -1 && event.altKey) {
136
141
  if (browser.mac && event.metaKey) {
137
142
  var _editorAPI$core$actio, _editorAPI$core;
@@ -1 +1,2 @@
1
1
  export declare const HEADING_KEYS: number[];
2
+ export declare const HEADING_NUMPAD_KEYS: number[];
@@ -1 +1,2 @@
1
1
  export declare const HEADING_KEYS: number[];
2
+ export declare const HEADING_NUMPAD_KEYS: number[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,11 +37,11 @@
37
37
  "@atlaskit/editor-plugin-primary-toolbar": "^5.0.0",
38
38
  "@atlaskit/editor-plugin-selection": "^4.0.0",
39
39
  "@atlaskit/editor-plugin-selection-toolbar": "^5.0.0",
40
- "@atlaskit/editor-plugin-toolbar": "^1.0.0",
40
+ "@atlaskit/editor-plugin-toolbar": "^1.1.0",
41
41
  "@atlaskit/editor-prosemirror": "7.0.0",
42
42
  "@atlaskit/editor-shared-styles": "^3.6.0",
43
43
  "@atlaskit/editor-tables": "^2.9.0",
44
- "@atlaskit/editor-toolbar": "^0.6.0",
44
+ "@atlaskit/editor-toolbar": "^0.7.0",
45
45
  "@atlaskit/editor-toolbar-model": "^0.2.0",
46
46
  "@atlaskit/icon": "^28.1.0",
47
47
  "@atlaskit/icon-lab": "^5.7.0",
@@ -49,13 +49,13 @@
49
49
  "@atlaskit/primitives": "^14.12.0",
50
50
  "@atlaskit/prosemirror-input-rules": "^3.4.0",
51
51
  "@atlaskit/theme": "^20.0.0",
52
- "@atlaskit/tmp-editor-statsig": "^12.0.0",
52
+ "@atlaskit/tmp-editor-statsig": "^12.3.0",
53
53
  "@atlaskit/tokens": "^6.1.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^108.0.0",
58
+ "@atlaskit/editor-common": "^108.1.0",
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
61
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -118,6 +118,9 @@
118
118
  },
119
119
  "platform_editor_adf_with_localid": {
120
120
  "type": "boolean"
121
+ },
122
+ "platform_editor_heading_from_numpad": {
123
+ "type": "boolean"
121
124
  }
122
125
  }
123
126
  }