@atlaskit/editor-plugin-decorations 8.0.28 → 8.0.29

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,26 @@
1
1
  # @atlaskit/editor-plugin-decorations
2
2
 
3
+ ## 8.0.29
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a9fb116e4a8d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a9fb116e4a8d8) -
8
+ fix(editor): fix paragraph nodes not highlighting on hover over block menu delete action
9
+
10
+ Two root causes fixed:
11
+ 1. CSS danger styles were gated behind
12
+ `expValNoExposure('platform_editor_block_menu', 'isEnabled', false)`, meaning they were
13
+ excluded when the new block menu was enabled. Removed the gate so danger styles are always
14
+ injected.
15
+
16
+ 2. `hoverDecorationCommand` used `tr.selection` directly, which for paragraphs is a collapsed
17
+ `TextSelection` (cursor inside text). This caused `getSourceNodesFromSelectionRange` to return
18
+ an empty array, so no decorations were created. Fixed by passing `preservedSelection` (a
19
+ `NodeSelection` pointing at the whole paragraph node) from `blockControls` shared state through
20
+ to `hoverDecoration`.
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 8.0.28
4
25
 
5
26
  ### Patch Changes
@@ -9,16 +9,20 @@ var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _view = require("@atlaskit/editor-prosemirror/view");
10
10
  var _editorTables = require("@atlaskit/editor-tables");
11
11
  var _utils = require("@atlaskit/editor-tables/utils");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
14
  var _main = require("./main");
14
15
  var hoverDecorationCommand = exports.hoverDecorationCommand = function hoverDecorationCommand(_ref) {
15
16
  var add = _ref.add,
16
17
  _ref$className = _ref.className,
17
- className = _ref$className === void 0 ? 'danger selected' : _ref$className;
18
+ className = _ref$className === void 0 ? 'danger selected' : _ref$className,
19
+ providedSelection = _ref.selection;
18
20
  return function (_ref2) {
19
21
  var tr = _ref2.tr;
20
- // Use the provided selection (e.g., preservedSelection) or fall back to tr.selection
21
- var selection = tr.selection;
22
+ // [FEATURE FLAG: platform_editor_block_menu_jira_patch_1]
23
+ // Use the provided selection (e.g., preservedSelection) or fall back to tr.selection.
24
+ // To clean up: always use providedSelection || tr.selection, remove the feature flag check.
25
+ var selection = ((0, _platformFeatureFlags.fg)('platform_editor_block_menu_jira_patch_1') ? providedSelection : undefined) || tr.selection;
22
26
  var decorations = [];
23
27
  var handleTableSelection = function handleTableSelection() {
24
28
  var pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selection.$from;
@@ -3,16 +3,20 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection, TableMap } from '@atlaskit/editor-tables';
5
5
  import { findTableClosestToPos } from '@atlaskit/editor-tables/utils';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
  import { ACTIONS, decorationStateKey } from './main';
8
9
  export const hoverDecorationCommand = ({
9
10
  add,
10
- className = 'danger selected'
11
+ className = 'danger selected',
12
+ selection: providedSelection
11
13
  }) => ({
12
14
  tr
13
15
  }) => {
14
- // Use the provided selection (e.g., preservedSelection) or fall back to tr.selection
15
- const selection = tr.selection;
16
+ // [FEATURE FLAG: platform_editor_block_menu_jira_patch_1]
17
+ // Use the provided selection (e.g., preservedSelection) or fall back to tr.selection.
18
+ // To clean up: always use providedSelection || tr.selection, remove the feature flag check.
19
+ const selection = (fg('platform_editor_block_menu_jira_patch_1') ? providedSelection : undefined) || tr.selection;
16
20
  const decorations = [];
17
21
  const handleTableSelection = (pos = selection.$from) => {
18
22
  const table = findTableClosestToPos(pos);
@@ -3,16 +3,20 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection, TableMap } from '@atlaskit/editor-tables';
5
5
  import { findTableClosestToPos } from '@atlaskit/editor-tables/utils';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
  import { ACTIONS, decorationStateKey } from './main';
8
9
  export var hoverDecorationCommand = function hoverDecorationCommand(_ref) {
9
10
  var add = _ref.add,
10
11
  _ref$className = _ref.className,
11
- className = _ref$className === void 0 ? 'danger selected' : _ref$className;
12
+ className = _ref$className === void 0 ? 'danger selected' : _ref$className,
13
+ providedSelection = _ref.selection;
12
14
  return function (_ref2) {
13
15
  var tr = _ref2.tr;
14
- // Use the provided selection (e.g., preservedSelection) or fall back to tr.selection
15
- var selection = tr.selection;
16
+ // [FEATURE FLAG: platform_editor_block_menu_jira_patch_1]
17
+ // Use the provided selection (e.g., preservedSelection) or fall back to tr.selection.
18
+ // To clean up: always use providedSelection || tr.selection, remove the feature flag check.
19
+ var selection = (fg('platform_editor_block_menu_jira_patch_1') ? providedSelection : undefined) || tr.selection;
16
20
  var decorations = [];
17
21
  var handleTableSelection = function handleTableSelection() {
18
22
  var pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selection.$from;
@@ -1,10 +1,12 @@
1
1
  import type { NextEditorPlugin, EditorCommand } from '@atlaskit/editor-common/types';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
3
  import type { DecorationState, HoverDecorationHandler, removeDecoration } from './pm-plugins/main';
3
4
  export type HoverDecorationProps = {
4
5
  add: boolean;
5
6
  className?: string;
7
+ selection?: Selection;
6
8
  };
7
- export type HoverDecorationCommand = ({ add, className }: HoverDecorationProps) => EditorCommand;
9
+ export type HoverDecorationCommand = ({ add, className, selection }: HoverDecorationProps) => EditorCommand;
8
10
  export type DecorationsPlugin = NextEditorPlugin<'decorations', {
9
11
  actions: {
10
12
  hoverDecoration: HoverDecorationHandler;
@@ -1,10 +1,12 @@
1
1
  import type { NextEditorPlugin, EditorCommand } from '@atlaskit/editor-common/types';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
3
  import type { DecorationState, HoverDecorationHandler, removeDecoration } from './pm-plugins/main';
3
4
  export type HoverDecorationProps = {
4
5
  add: boolean;
5
6
  className?: string;
7
+ selection?: Selection;
6
8
  };
7
- export type HoverDecorationCommand = ({ add, className }: HoverDecorationProps) => EditorCommand;
9
+ export type HoverDecorationCommand = ({ add, className, selection }: HoverDecorationProps) => EditorCommand;
8
10
  export type DecorationsPlugin = NextEditorPlugin<'decorations', {
9
11
  actions: {
10
12
  hoverDecoration: HoverDecorationHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-decorations",
3
- "version": "8.0.28",
3
+ "version": "8.0.29",
4
4
  "description": "Decorations plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,8 @@
21
21
  "dependencies": {
22
22
  "@atlaskit/editor-prosemirror": "^7.3.0",
23
23
  "@atlaskit/editor-tables": "^2.9.0",
24
- "@atlaskit/tmp-editor-statsig": "^59.1.0",
24
+ "@atlaskit/platform-feature-flags": "^1.1.0",
25
+ "@atlaskit/tmp-editor-statsig": "^60.2.0",
25
26
  "@babel/runtime": "^7.0.0"
26
27
  },
27
28
  "peerDependencies": {
@@ -65,5 +66,10 @@
65
66
  "emotion"
66
67
  ]
67
68
  }
69
+ },
70
+ "platform-feature-flags": {
71
+ "platform_editor_block_menu_jira_patch_1": {
72
+ "type": "boolean"
73
+ }
68
74
  }
69
75
  }