@atlaskit/editor-plugin-decorations 6.1.0 → 6.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-decorations
2
2
 
3
+ ## 6.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4141e6d6c0258`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4141e6d6c0258) -
8
+ [ux] ED-29125 Add danger styles for media group, tables with numbered columns and nested panels
9
+ - Updated dependencies
10
+
11
+ ## 6.1.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 6.1.0
4
18
 
5
19
  ### Minor Changes
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.removeDecorationCommand = exports.hoverDecorationCommand = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
7
9
  var _state = require("@atlaskit/editor-prosemirror/state");
8
10
  var _utils = require("@atlaskit/editor-prosemirror/utils");
9
11
  var _view = require("@atlaskit/editor-prosemirror/view");
@@ -39,7 +41,8 @@ var hoverDecorationCommand = exports.hoverDecorationCommand = function hoverDeco
39
41
  // be added, e.g. if a decision item is selected inside a layout and the
40
42
  // user hovers over the layout's delete button.
41
43
  var foundParentNode = (0, _utils.findParentNodeOfType)(nodeType)(tr.selection);
42
- if (from === undefined && foundParentNode) {
44
+ // Override from and parentNode values if foundParentNode is a mediaGroup
45
+ if (foundParentNode && (from === undefined || foundParentNode.node.type.name === 'mediaGroup')) {
43
46
  from = foundParentNode.pos;
44
47
  parentNode = foundParentNode.node;
45
48
  }
@@ -71,6 +74,11 @@ var hoverDecorationCommand = exports.hoverDecorationCommand = function hoverDeco
71
74
  if (!map || !rect) {
72
75
  return tr;
73
76
  }
77
+ var tableNodeDec = _view.Decoration.node(table.pos, table.pos + table.node.nodeSize, {
78
+ class: className
79
+ }, {
80
+ key: 'decorationNode'
81
+ });
74
82
  var updatedCells = map.cellsInRect(rect).map(function (x) {
75
83
  return x + table.start;
76
84
  });
@@ -87,7 +95,7 @@ var hoverDecorationCommand = exports.hoverDecorationCommand = function hoverDeco
87
95
  }).filter(function (decoration) {
88
96
  return !!decoration;
89
97
  });
90
- decoration = _view.DecorationSet.create(tr.doc, tableCellDecorations);
98
+ decoration = _view.DecorationSet.create(tr.doc, [tableNodeDec].concat((0, _toConsumableArray2.default)(tableCellDecorations)));
91
99
  }
92
100
  tr.setMeta(_main.decorationStateKey, {
93
101
  action: add ? _main.ACTIONS.DECORATION_ADD : _main.ACTIONS.DECORATION_REMOVE,
@@ -33,7 +33,8 @@ export const hoverDecorationCommand = ({
33
33
  // be added, e.g. if a decision item is selected inside a layout and the
34
34
  // user hovers over the layout's delete button.
35
35
  const foundParentNode = findParentNodeOfType(nodeType)(tr.selection);
36
- if (from === undefined && foundParentNode) {
36
+ // Override from and parentNode values if foundParentNode is a mediaGroup
37
+ if (foundParentNode && (from === undefined || foundParentNode.node.type.name === 'mediaGroup')) {
37
38
  from = foundParentNode.pos;
38
39
  parentNode = foundParentNode.node;
39
40
  }
@@ -65,6 +66,11 @@ export const hoverDecorationCommand = ({
65
66
  if (!map || !rect) {
66
67
  return tr;
67
68
  }
69
+ const tableNodeDec = Decoration.node(table.pos, table.pos + table.node.nodeSize, {
70
+ class: className
71
+ }, {
72
+ key: 'decorationNode'
73
+ });
68
74
  const updatedCells = map.cellsInRect(rect).map(x => x + table.start);
69
75
  const tableCellDecorations = updatedCells.map(pos => {
70
76
  const cell = tr.doc.nodeAt(pos);
@@ -77,7 +83,7 @@ export const hoverDecorationCommand = ({
77
83
  key: 'decorationNode'
78
84
  });
79
85
  }).filter(decoration => !!decoration);
80
- decoration = DecorationSet.create(tr.doc, tableCellDecorations);
86
+ decoration = DecorationSet.create(tr.doc, [tableNodeDec, ...tableCellDecorations]);
81
87
  }
82
88
  tr.setMeta(decorationStateKey, {
83
89
  action: add ? ACTIONS.DECORATION_ADD : ACTIONS.DECORATION_REMOVE,
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
3
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
4
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -33,7 +34,8 @@ export var hoverDecorationCommand = function hoverDecorationCommand(_ref) {
33
34
  // be added, e.g. if a decision item is selected inside a layout and the
34
35
  // user hovers over the layout's delete button.
35
36
  var foundParentNode = findParentNodeOfType(nodeType)(tr.selection);
36
- if (from === undefined && foundParentNode) {
37
+ // Override from and parentNode values if foundParentNode is a mediaGroup
38
+ if (foundParentNode && (from === undefined || foundParentNode.node.type.name === 'mediaGroup')) {
37
39
  from = foundParentNode.pos;
38
40
  parentNode = foundParentNode.node;
39
41
  }
@@ -65,6 +67,11 @@ export var hoverDecorationCommand = function hoverDecorationCommand(_ref) {
65
67
  if (!map || !rect) {
66
68
  return tr;
67
69
  }
70
+ var tableNodeDec = Decoration.node(table.pos, table.pos + table.node.nodeSize, {
71
+ class: className
72
+ }, {
73
+ key: 'decorationNode'
74
+ });
68
75
  var updatedCells = map.cellsInRect(rect).map(function (x) {
69
76
  return x + table.start;
70
77
  });
@@ -81,7 +88,7 @@ export var hoverDecorationCommand = function hoverDecorationCommand(_ref) {
81
88
  }).filter(function (decoration) {
82
89
  return !!decoration;
83
90
  });
84
- decoration = DecorationSet.create(tr.doc, tableCellDecorations);
91
+ decoration = DecorationSet.create(tr.doc, [tableNodeDec].concat(_toConsumableArray(tableCellDecorations)));
85
92
  }
86
93
  tr.setMeta(decorationStateKey, {
87
94
  action: add ? ACTIONS.DECORATION_ADD : ACTIONS.DECORATION_REMOVE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-decorations",
3
- "version": "6.1.0",
3
+ "version": "6.1.2",
4
4
  "description": "Decorations plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -22,12 +22,12 @@
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.32.0",
26
- "@atlaskit/tokens": "^6.3.0",
25
+ "@atlaskit/tmp-editor-statsig": "^13.2.0",
26
+ "@atlaskit/tokens": "^6.4.0",
27
27
  "@babel/runtime": "^7.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@atlaskit/editor-common": "^110.1.0",
30
+ "@atlaskit/editor-common": "^110.5.0",
31
31
  "react": "^18.2.0",
32
32
  "react-dom": "^18.2.0"
33
33
  },