@atlaskit/editor-plugin-decorations 5.0.0 → 6.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,22 @@
1
1
  # @atlaskit/editor-plugin-decorations
2
2
 
3
+ ## 6.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`f4c0936dc05fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f4c0936dc05fe) -
8
+ ED-29391 Add keyboard support for block menu
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 6.0.0
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 5.0.0
4
21
 
5
22
  ### Patch Changes
@@ -9,6 +9,7 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
9
9
  var _view = require("@atlaskit/editor-prosemirror/view");
10
10
  var _editorTables = require("@atlaskit/editor-tables");
11
11
  var _utils2 = require("@atlaskit/editor-tables/utils");
12
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
12
13
  var _main = require("./main");
13
14
  var hoverDecorationCommand = exports.hoverDecorationCommand = function hoverDecorationCommand(_ref) {
14
15
  var nodeType = _ref.nodeType,
@@ -90,7 +91,8 @@ var hoverDecorationCommand = exports.hoverDecorationCommand = function hoverDeco
90
91
  }
91
92
  tr.setMeta(_main.decorationStateKey, {
92
93
  action: add ? _main.ACTIONS.DECORATION_ADD : _main.ACTIONS.DECORATION_REMOVE,
93
- data: decoration
94
+ data: decoration,
95
+ hasDangerDecorations: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? className === 'danger' : undefined
94
96
  }).setMeta('addToHistory', false);
95
97
  return tr;
96
98
  };
@@ -100,11 +100,13 @@ var _default = exports.default = function _default() {
100
100
  switch (meta.action) {
101
101
  case ACTIONS.DECORATION_ADD:
102
102
  return {
103
- decoration: meta.data
103
+ decoration: meta.data,
104
+ hasDangerDecorations: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? meta.hasDangerDecorations : undefined
104
105
  };
105
106
  case ACTIONS.DECORATION_REMOVE:
106
107
  return {
107
- decoration: undefined
108
+ decoration: undefined,
109
+ hasDangerDecorations: undefined
108
110
  };
109
111
  default:
110
112
  return pluginState;
@@ -3,6 +3,7 @@ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection, findTable, TableMap } from '@atlaskit/editor-tables';
5
5
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
6
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
7
  import { ACTIONS, decorationStateKey } from './main';
7
8
  export const hoverDecorationCommand = ({
8
9
  nodeType,
@@ -80,7 +81,8 @@ export const hoverDecorationCommand = ({
80
81
  }
81
82
  tr.setMeta(decorationStateKey, {
82
83
  action: add ? ACTIONS.DECORATION_ADD : ACTIONS.DECORATION_REMOVE,
83
- data: decoration
84
+ data: decoration,
85
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? className === 'danger' : undefined
84
86
  }).setMeta('addToHistory', false);
85
87
  return tr;
86
88
  };
@@ -92,11 +92,13 @@ export default (() => {
92
92
  switch (meta.action) {
93
93
  case ACTIONS.DECORATION_ADD:
94
94
  return {
95
- decoration: meta.data
95
+ decoration: meta.data,
96
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? meta.hasDangerDecorations : undefined
96
97
  };
97
98
  case ACTIONS.DECORATION_REMOVE:
98
99
  return {
99
- decoration: undefined
100
+ decoration: undefined,
101
+ hasDangerDecorations: undefined
100
102
  };
101
103
  default:
102
104
  return pluginState;
@@ -3,6 +3,7 @@ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection, findTable, TableMap } from '@atlaskit/editor-tables';
5
5
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
6
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
7
  import { ACTIONS, decorationStateKey } from './main';
7
8
  export var hoverDecorationCommand = function hoverDecorationCommand(_ref) {
8
9
  var nodeType = _ref.nodeType,
@@ -84,7 +85,8 @@ export var hoverDecorationCommand = function hoverDecorationCommand(_ref) {
84
85
  }
85
86
  tr.setMeta(decorationStateKey, {
86
87
  action: add ? ACTIONS.DECORATION_ADD : ACTIONS.DECORATION_REMOVE,
87
- data: decoration
88
+ data: decoration,
89
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? className === 'danger' : undefined
88
90
  }).setMeta('addToHistory', false);
89
91
  return tr;
90
92
  };
@@ -94,11 +94,13 @@ export default (function () {
94
94
  switch (meta.action) {
95
95
  case ACTIONS.DECORATION_ADD:
96
96
  return {
97
- decoration: meta.data
97
+ decoration: meta.data,
98
+ hasDangerDecorations: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) && expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? meta.hasDangerDecorations : undefined
98
99
  };
99
100
  case ACTIONS.DECORATION_REMOVE:
100
101
  return {
101
- decoration: undefined
102
+ decoration: undefined,
103
+ hasDangerDecorations: undefined
102
104
  };
103
105
  default:
104
106
  return pluginState;
@@ -12,6 +12,7 @@ export declare const removeDecoration: Command;
12
12
  export declare const hoverDecoration: (nodeType: NodeType | Array<NodeType>, add: boolean, className?: string) => Command;
13
13
  export type DecorationState = {
14
14
  decoration?: Decoration | DecorationSet;
15
+ hasDangerDecorations?: boolean;
15
16
  };
16
17
  type HoverDecorationHandler = typeof hoverDecoration;
17
18
  export type { HoverDecorationHandler };
@@ -12,6 +12,7 @@ export declare const removeDecoration: Command;
12
12
  export declare const hoverDecoration: (nodeType: NodeType | Array<NodeType>, add: boolean, className?: string) => Command;
13
13
  export type DecorationState = {
14
14
  decoration?: Decoration | DecorationSet;
15
+ hasDangerDecorations?: boolean;
15
16
  };
16
17
  type HoverDecorationHandler = typeof hoverDecoration;
17
18
  export type { HoverDecorationHandler };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-decorations",
3
- "version": "5.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Decorations plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -22,17 +22,17 @@
22
22
  "@atlaskit/editor-prosemirror": "7.0.0",
23
23
  "@atlaskit/editor-tables": "^2.9.0",
24
24
  "@atlaskit/platform-feature-flags": "^1.1.0",
25
- "@atlaskit/tmp-editor-statsig": "^12.9.0",
25
+ "@atlaskit/tmp-editor-statsig": "^12.32.0",
26
26
  "@atlaskit/tokens": "^6.3.0",
27
27
  "@babel/runtime": "^7.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@atlaskit/editor-common": "^109.0.0",
30
+ "@atlaskit/editor-common": "^110.1.0",
31
31
  "react": "^18.2.0",
32
32
  "react-dom": "^18.2.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@atlaskit/editor-plugin-mentions": "^7.0.0",
35
+ "@atlaskit/editor-plugin-mentions": "^8.0.0",
36
36
  "@testing-library/react": "^13.4.0",
37
37
  "wait-for-expect": "^1.2.0"
38
38
  },