@atlaskit/editor-plugin-block-controls 2.0.2 → 2.0.3

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,16 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#141841](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141841)
8
+ [`2d44681e217b4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2d44681e217b4) -
9
+ ED-24896 disable drag list item into list
10
+ - [#141841](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141841)
11
+ [`b1bb0f6a6bfe5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b1bb0f6a6bfe5) -
12
+ ED-24394 hide top level empty line drag handle
13
+
3
14
  ## 2.0.2
4
15
 
5
16
  ### Patch Changes
@@ -23,6 +23,7 @@ var _validation = require("../utils/validation");
23
23
  var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
24
24
  var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
25
25
  var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
26
+ var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
26
27
  var getNestedDepth = function getNestedDepth() {
27
28
  return (0, _experiments.editorExperiment)('nested-dnd', true) ? 100 : 0;
28
29
  };
@@ -50,7 +51,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
50
51
  var endPos;
51
52
  if ((0, _experiments.editorExperiment)('nested-dnd', true)) {
52
53
  depth = newState.doc.resolve(pos).depth;
53
- if (node.isInline || !parent) {
54
+ if (node.isInline || !parent || DISABLE_CHILD_DROP_TARGET.includes(parent.type.name)) {
54
55
  prevNode = node;
55
56
  return false;
56
57
  }
@@ -105,21 +105,23 @@ var extendedHoverZoneNested = (0, _react.css)({
105
105
  display: 'none'
106
106
  }
107
107
  });
108
- var paragraphWithTrailingBreakAsOnlyChild = '+ p > .ProseMirror-trailingBreak:only-child';
108
+ var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
109
+ var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
109
110
  var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
110
111
  var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
111
112
  var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
112
- var withInlineNodeStyle = (0, _react.css)((0, _defineProperty2.default)({}, ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithTrailingBreakAsOnlyChild, "), .ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(").concat(paragraphWithPlaceholder, ")"), {
113
+ var withInlineNodeStyleSelectors = [".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithPlaceholder, ")")].join(', ');
114
+ var withInlineNodeStyle = (0, _react.css)((0, _defineProperty2.default)({}, withInlineNodeStyleSelectors, {
113
115
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
114
116
  display: 'none !important'
115
117
  }));
116
-
118
+ var withInlineNodeStyleWithChromeFixSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
117
119
  /**
118
120
  * Please do not change change transform to display:none, or visibility:hidden
119
121
  * Otherwise it might break composition input for Chrome
120
122
  * https://product-fabric.atlassian.net/browse/ED-24136
121
123
  */
122
- var withInlineNodeStyleWithChromeFix = (0, _react.css)((0, _defineProperty2.default)({}, "".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector, ",\n\t ").concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector), {
124
+ var withInlineNodeStyleWithChromeFix = (0, _react.css)((0, _defineProperty2.default)({}, withInlineNodeStyleWithChromeFixSelectors, {
123
125
  transform: 'scale(0)'
124
126
  }));
125
127
  var globalStyles = (0, _experiments.editorExperiment)('nested-dnd', true) ? (0, _react.css)({
@@ -14,6 +14,7 @@ import { canMoveNodeToIndex } from '../utils/validation';
14
14
  const IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
15
15
  const IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
16
16
  const PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
17
+ const DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
17
18
  const getNestedDepth = () => editorExperiment('nested-dnd', true) ? 100 : 0;
18
19
  const createDropTargetDecoration = (pos, dropTargetDec) => {
19
20
  return Decoration.widget(pos, (_, getPos) => {
@@ -39,7 +40,7 @@ export const dropTargetDecorations = (newState, api, formatMessage, activeNode)
39
40
  let endPos;
40
41
  if (editorExperiment('nested-dnd', true)) {
41
42
  depth = newState.doc.resolve(pos).depth;
42
- if (node.isInline || !parent) {
43
+ if (node.isInline || !parent || DISABLE_CHILD_DROP_TARGET.includes(parent.type.name)) {
43
44
  prevNode = node;
44
45
  return false;
45
46
  }
@@ -96,18 +96,20 @@ const extendedHoverZoneNested = css({
96
96
  display: 'none'
97
97
  }
98
98
  });
99
- const paragraphWithTrailingBreakAsOnlyChild = '+ p > .ProseMirror-trailingBreak:only-child';
99
+ const paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
100
+ const indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
100
101
  const paragraphWithPlaceholder = '+ p > .placeholder-decoration';
101
102
  const dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
102
103
  const dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
104
+ const withInlineNodeStyleSelectors = [`.ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${paragraphWithTrailingBreakAsOnlyChild})`, `.ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${indentatedParagraphWithTrailingBreakAsOnlyChild})`, `.ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${paragraphWithPlaceholder})`].join(', ');
103
105
  const withInlineNodeStyle = css({
104
106
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
105
- [`.ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${paragraphWithTrailingBreakAsOnlyChild}), .ProseMirror-widget[data-blocks-drag-handle-container="true"]:has(${paragraphWithPlaceholder})`]: {
107
+ [withInlineNodeStyleSelectors]: {
106
108
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
107
109
  display: 'none !important'
108
110
  }
109
111
  });
110
-
112
+ const withInlineNodeStyleWithChromeFixSelectors = [`${dragHandleContainer}:has(${paragraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${indentatedParagraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector}`, `${dragHandleContainer}:has(${paragraphWithPlaceholder}) ${dragHandleSelector}`].join(', ');
111
113
  /**
112
114
  * Please do not change change transform to display:none, or visibility:hidden
113
115
  * Otherwise it might break composition input for Chrome
@@ -115,8 +117,7 @@ const withInlineNodeStyle = css({
115
117
  */
116
118
  const withInlineNodeStyleWithChromeFix = css({
117
119
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
118
- [`${dragHandleContainer}:has(${paragraphWithTrailingBreakAsOnlyChild}) ${dragHandleSelector},
119
- ${dragHandleContainer}:has(${paragraphWithPlaceholder}) ${dragHandleSelector}`]: {
120
+ [withInlineNodeStyleWithChromeFixSelectors]: {
120
121
  transform: 'scale(0)'
121
122
  }
122
123
  });
@@ -16,6 +16,7 @@ import { canMoveNodeToIndex } from '../utils/validation';
16
16
  var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
17
17
  var IGNORE_NODE_DESCENDANTS = ['listItem', 'taskList', 'decisionList', 'mediaSingle'];
18
18
  var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
19
+ var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
19
20
  var getNestedDepth = function getNestedDepth() {
20
21
  return editorExperiment('nested-dnd', true) ? 100 : 0;
21
22
  };
@@ -43,7 +44,7 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
43
44
  var endPos;
44
45
  if (editorExperiment('nested-dnd', true)) {
45
46
  depth = newState.doc.resolve(pos).depth;
46
- if (node.isInline || !parent) {
47
+ if (node.isInline || !parent || DISABLE_CHILD_DROP_TARGET.includes(parent.type.name)) {
47
48
  prevNode = node;
48
49
  return false;
49
50
  }
@@ -97,21 +97,23 @@ var extendedHoverZoneNested = css({
97
97
  display: 'none'
98
98
  }
99
99
  });
100
- var paragraphWithTrailingBreakAsOnlyChild = '+ p > .ProseMirror-trailingBreak:only-child';
100
+ var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
101
+ var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
101
102
  var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
102
103
  var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
103
104
  var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
104
- var withInlineNodeStyle = css(_defineProperty({}, ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithTrailingBreakAsOnlyChild, "), .ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(").concat(paragraphWithPlaceholder, ")"), {
105
+ var withInlineNodeStyleSelectors = [".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ")"), ".ProseMirror-widget[data-blocks-drag-handle-container=\"true\"]:has(".concat(paragraphWithPlaceholder, ")")].join(', ');
106
+ var withInlineNodeStyle = css(_defineProperty({}, withInlineNodeStyleSelectors, {
105
107
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
106
108
  display: 'none !important'
107
109
  }));
108
-
110
+ var withInlineNodeStyleWithChromeFixSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
109
111
  /**
110
112
  * Please do not change change transform to display:none, or visibility:hidden
111
113
  * Otherwise it might break composition input for Chrome
112
114
  * https://product-fabric.atlassian.net/browse/ED-24136
113
115
  */
114
- var withInlineNodeStyleWithChromeFix = css(_defineProperty({}, "".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector, ",\n\t ").concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector), {
116
+ var withInlineNodeStyleWithChromeFix = css(_defineProperty({}, withInlineNodeStyleWithChromeFixSelectors, {
115
117
  transform: 'scale(0)'
116
118
  }));
117
119
  var globalStyles = editorExperiment('nested-dnd', true) ? css({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",