@atlaskit/editor-plugin-block-controls 2.1.3 → 2.1.5

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,25 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 2.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#144914](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144914)
8
+ [`5c53f0507a346`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c53f0507a346) -
9
+ ED-25125 Add patch 2 Fg
10
+ - [#142749](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142749)
11
+ [`273fc31422520`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/273fc31422520) -
12
+ ED-25019 fix wrapped image z index issue
13
+ - Updated dependencies
14
+
15
+ ## 2.1.4
16
+
17
+ ### Patch Changes
18
+
19
+ - [#144925](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144925)
20
+ [`9faf9ff89ad37`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9faf9ff89ad37) -
21
+ ED-24822 - Add padding to panels with no icon and unhide drag handle in first bodied node
22
+
3
23
  ## 2.1.3
4
24
 
5
25
  ### Patch Changes
@@ -15,6 +15,7 @@ var _reactIntlNext = require("react-intl-next");
15
15
  var _uuid = _interopRequireDefault(require("uuid"));
16
16
  var _utils = require("@atlaskit/editor-common/utils");
17
17
  var _view = require("@atlaskit/editor-prosemirror/view");
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
19
20
  var _dragHandle = require("../ui/drag-handle");
20
21
  var _dropTarget = require("../ui/drop-target");
@@ -137,6 +138,14 @@ var ObjHash = /*#__PURE__*/function () {
137
138
  return ObjHash;
138
139
  }();
139
140
  (0, _defineProperty2.default)(ObjHash, "caching", new WeakMap());
141
+ var shouldIgnoreNode = function shouldIgnoreNode(node) {
142
+ if ('mediaSingle' === node.type.name && (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1')) {
143
+ if (['wrap-right', 'wrap-left'].includes(node.attrs.layout)) {
144
+ return true;
145
+ }
146
+ }
147
+ return IGNORE_NODES.includes(node.type.name);
148
+ };
140
149
  var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newState) {
141
150
  var decs = [];
142
151
  newState.doc.descendants(function (node, pos, _parent, index) {
@@ -156,7 +165,7 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
156
165
  if (node.isInline) {
157
166
  return false;
158
167
  }
159
- if (IGNORE_NODES.includes(node.type.name)) {
168
+ if (shouldIgnoreNode(node)) {
160
169
  return shouldDescend; //skip over, don't consider it a valid depth
161
170
  }
162
171
  depth = newState.doc.resolve(pos).depth;
@@ -52,6 +52,8 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
52
52
  }
53
53
 
54
54
  // We want to exlude handles from showing for wrapped nodes
55
+ // TODO We should be able remove these check if we decided to
56
+ // go we not decoration for wrapped image solution.
55
57
  if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '') && (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24227')) {
56
58
  return false;
57
59
  }
@@ -67,7 +69,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
67
69
 
68
70
  // We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
69
71
  var firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 || (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
70
- if (parentElement && parentElementType === 'panel' && (index === 0 || firstChildIsWidget && index === 1)) {
72
+ if (parentElement && parentElementType === 'panel' && ((0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1') ? !parentElement.classList.contains('ak-editor-panel__no-icon') : true) && (index === 0 || firstChildIsWidget && index === 1)) {
71
73
  return false;
72
74
  }
73
75
  } else {
@@ -99,6 +99,9 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
99
99
  var isNestedEnabled = (0, _experiments.editorExperiment)('nested-dnd', true, {
100
100
  exposure: true
101
101
  });
102
+ if ((0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2')) {
103
+ // TODO: Remove this once FG is used in code
104
+ }
102
105
  return new _safePlugin.SafePlugin({
103
106
  key: key,
104
107
  state: {
@@ -111,6 +111,7 @@ var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
111
111
  var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
112
112
  var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
113
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 dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
114
115
  var withInlineNodeStyle = (0, _react.css)((0, _defineProperty2.default)({}, withInlineNodeStyleSelectors, {
115
116
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
116
117
  display: 'none !important'
@@ -137,6 +138,10 @@ var globalStyles = (0, _experiments.editorExperiment)('nested-dnd', true) ? (0,
137
138
  marginTop: '0 !important'
138
139
  }
139
140
  });
141
+ var withDividerInPanelStyleFix = (0, _react.css)((0, _defineProperty2.default)({}, "".concat(dividerBodiedInCustomPanelWithNoIconSelector), {
142
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
143
+ marginTop: '0 !important'
144
+ }));
140
145
  var withDeleteLinesStyleFix = (0, _react.css)((0, _defineProperty2.default)({}, "p[data-drag-handler-anchor-name] ".concat(dragHandleContainer), {
141
146
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
142
147
  display: 'none !important'
@@ -155,6 +160,6 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
155
160
  return (0, _react.jsx)(_react.Global, {
156
161
  styles: [globalStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested : extendedHoverZone, getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, (0, _experiments.editorExperiment)('platform_editor_empty_line_prompt', true, {
157
162
  exposure: false
158
- }) ? _globalStyles.emptyBlockExperimentGlobalStyles : undefined]
163
+ }) ? _globalStyles.emptyBlockExperimentGlobalStyles : undefined, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined]
159
164
  });
160
165
  };
@@ -6,6 +6,7 @@ import { RawIntlProvider } from 'react-intl-next';
6
6
  import uuid from 'uuid';
7
7
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
8
8
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
11
  import { DragHandle } from '../ui/drag-handle';
11
12
  import { DropTarget } from '../ui/drop-target';
@@ -116,6 +117,14 @@ class ObjHash {
116
117
  }
117
118
  }
118
119
  _defineProperty(ObjHash, "caching", new WeakMap());
120
+ const shouldIgnoreNode = node => {
121
+ if ('mediaSingle' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_1')) {
122
+ if (['wrap-right', 'wrap-left'].includes(node.attrs.layout)) {
123
+ return true;
124
+ }
125
+ }
126
+ return IGNORE_NODES.includes(node.type.name);
127
+ };
119
128
  export const nodeDecorations = newState => {
120
129
  const decs = [];
121
130
  newState.doc.descendants((node, pos, _parent, index) => {
@@ -134,7 +143,7 @@ export const nodeDecorations = newState => {
134
143
  if (node.isInline) {
135
144
  return false;
136
145
  }
137
- if (IGNORE_NODES.includes(node.type.name)) {
146
+ if (shouldIgnoreNode(node)) {
138
147
  return shouldDescend; //skip over, don't consider it a valid depth
139
148
  }
140
149
  depth = newState.doc.resolve(pos).depth;
@@ -47,6 +47,8 @@ export const handleMouseOver = (view, event, api) => {
47
47
  }
48
48
 
49
49
  // We want to exlude handles from showing for wrapped nodes
50
+ // TODO We should be able remove these check if we decided to
51
+ // go we not decoration for wrapped image solution.
50
52
  if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '') && fg('platform_editor_element_drag_and_drop_ed_24227')) {
51
53
  return false;
52
54
  }
@@ -62,7 +64,7 @@ export const handleMouseOver = (view, event, api) => {
62
64
 
63
65
  // We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
64
66
  const firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 ? void 0 : (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
65
- if (parentElement && parentElementType === 'panel' && (index === 0 || firstChildIsWidget && index === 1)) {
67
+ if (parentElement && parentElementType === 'panel' && (fg('platform_editor_element_dnd_nested_fix_patch_1') ? !parentElement.classList.contains('ak-editor-panel__no-icon') : true) && (index === 0 || firstChildIsWidget && index === 1)) {
66
68
  return false;
67
69
  }
68
70
  } else {
@@ -94,6 +94,9 @@ export const createPlugin = (api, getIntl) => {
94
94
  const isNestedEnabled = editorExperiment('nested-dnd', true, {
95
95
  exposure: true
96
96
  });
97
+ if (fg('platform_editor_element_dnd_nested_fix_patch_2')) {
98
+ // TODO: Remove this once FG is used in code
99
+ }
97
100
  return new SafePlugin({
98
101
  key,
99
102
  state: {
@@ -102,6 +102,7 @@ const paragraphWithPlaceholder = '+ p > .placeholder-decoration';
102
102
  const dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
103
103
  const dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
104
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(', ');
105
+ const dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
105
106
  const withInlineNodeStyle = css({
106
107
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
107
108
  [withInlineNodeStyleSelectors]: {
@@ -134,6 +135,13 @@ const globalStyles = editorExperiment('nested-dnd', true) ? css({
134
135
  marginTop: '0 !important'
135
136
  }
136
137
  });
138
+ const withDividerInPanelStyleFix = css({
139
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
140
+ [`${dividerBodiedInCustomPanelWithNoIconSelector}`]: {
141
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
142
+ marginTop: '0 !important'
143
+ }
144
+ });
137
145
  const withDeleteLinesStyleFix = css({
138
146
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
139
147
  [`p[data-drag-handler-anchor-name] ${dragHandleContainer}`]: {
@@ -158,6 +166,6 @@ export const GlobalStylesWrapper = () => {
158
166
  return jsx(Global, {
159
167
  styles: [globalStyles, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested : extendedHoverZone, getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, editorExperiment('platform_editor_empty_line_prompt', true, {
160
168
  exposure: false
161
- }) ? emptyBlockExperimentGlobalStyles : undefined]
169
+ }) ? emptyBlockExperimentGlobalStyles : undefined, fg('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined]
162
170
  });
163
171
  };
@@ -8,6 +8,7 @@ import { RawIntlProvider } from 'react-intl-next';
8
8
  import uuid from 'uuid';
9
9
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
10
10
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
13
  import { DragHandle } from '../ui/drag-handle';
13
14
  import { DropTarget } from '../ui/drop-target';
@@ -130,6 +131,14 @@ var ObjHash = /*#__PURE__*/function () {
130
131
  return ObjHash;
131
132
  }();
132
133
  _defineProperty(ObjHash, "caching", new WeakMap());
134
+ var shouldIgnoreNode = function shouldIgnoreNode(node) {
135
+ if ('mediaSingle' === node.type.name && fg('platform_editor_element_dnd_nested_fix_patch_1')) {
136
+ if (['wrap-right', 'wrap-left'].includes(node.attrs.layout)) {
137
+ return true;
138
+ }
139
+ }
140
+ return IGNORE_NODES.includes(node.type.name);
141
+ };
133
142
  export var nodeDecorations = function nodeDecorations(newState) {
134
143
  var decs = [];
135
144
  newState.doc.descendants(function (node, pos, _parent, index) {
@@ -149,7 +158,7 @@ export var nodeDecorations = function nodeDecorations(newState) {
149
158
  if (node.isInline) {
150
159
  return false;
151
160
  }
152
- if (IGNORE_NODES.includes(node.type.name)) {
161
+ if (shouldIgnoreNode(node)) {
153
162
  return shouldDescend; //skip over, don't consider it a valid depth
154
163
  }
155
164
  depth = newState.doc.resolve(pos).depth;
@@ -46,6 +46,8 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
46
46
  }
47
47
 
48
48
  // We want to exlude handles from showing for wrapped nodes
49
+ // TODO We should be able remove these check if we decided to
50
+ // go we not decoration for wrapped image solution.
49
51
  if (['wrap-right', 'wrap-left'].includes(rootElement.getAttribute('layout') || '') && fg('platform_editor_element_drag_and_drop_ed_24227')) {
50
52
  return false;
51
53
  }
@@ -61,7 +63,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
61
63
 
62
64
  // We want to exlude handles showing for first element in a Panel, ignoring widgets like gapcursor
63
65
  var firstChildIsWidget = parentRootElement === null || parentRootElement === void 0 || (_parentRootElement$ch = parentRootElement.children[0]) === null || _parentRootElement$ch === void 0 ? void 0 : _parentRootElement$ch.classList.contains('ProseMirror-widget');
64
- if (parentElement && parentElementType === 'panel' && (index === 0 || firstChildIsWidget && index === 1)) {
66
+ if (parentElement && parentElementType === 'panel' && (fg('platform_editor_element_dnd_nested_fix_patch_1') ? !parentElement.classList.contains('ak-editor-panel__no-icon') : true) && (index === 0 || firstChildIsWidget && index === 1)) {
65
67
  return false;
66
68
  }
67
69
  } else {
@@ -92,6 +92,9 @@ export var createPlugin = function createPlugin(api, getIntl) {
92
92
  var isNestedEnabled = editorExperiment('nested-dnd', true, {
93
93
  exposure: true
94
94
  });
95
+ if (fg('platform_editor_element_dnd_nested_fix_patch_2')) {
96
+ // TODO: Remove this once FG is used in code
97
+ }
95
98
  return new SafePlugin({
96
99
  key: key,
97
100
  state: {
@@ -103,6 +103,7 @@ var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
103
103
  var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
104
104
  var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
105
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 dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
106
107
  var withInlineNodeStyle = css(_defineProperty({}, withInlineNodeStyleSelectors, {
107
108
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
108
109
  display: 'none !important'
@@ -129,6 +130,10 @@ var globalStyles = editorExperiment('nested-dnd', true) ? css({
129
130
  marginTop: '0 !important'
130
131
  }
131
132
  });
133
+ var withDividerInPanelStyleFix = css(_defineProperty({}, "".concat(dividerBodiedInCustomPanelWithNoIconSelector), {
134
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
135
+ marginTop: '0 !important'
136
+ }));
132
137
  var withDeleteLinesStyleFix = css(_defineProperty({}, "p[data-drag-handler-anchor-name] ".concat(dragHandleContainer), {
133
138
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
134
139
  display: 'none !important'
@@ -147,6 +152,6 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper() {
147
152
  return jsx(Global, {
148
153
  styles: [globalStyles, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested : extendedHoverZone, getTextNodeStyle(), withDeleteLinesStyleFix, withMediaSingleStyleFix, editorExperiment('platform_editor_empty_line_prompt', true, {
149
154
  exposure: false
150
- }) ? emptyBlockExperimentGlobalStyles : undefined]
155
+ }) ? emptyBlockExperimentGlobalStyles : undefined, fg('platform_editor_element_dnd_nested_fix_patch_1') ? withDividerInPanelStyleFix : undefined]
151
156
  });
152
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@atlaskit/adf-schema": "^40.9.0",
34
- "@atlaskit/editor-common": "^91.0.0",
34
+ "@atlaskit/editor-common": "^91.1.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-plugin-quick-insert": "^1.4.0",
40
40
  "@atlaskit/editor-plugin-width": "^1.3.0",
41
41
  "@atlaskit/editor-prosemirror": "6.0.0",
42
- "@atlaskit/editor-shared-styles": "^2.13.0",
42
+ "@atlaskit/editor-shared-styles": "^3.0.0",
43
43
  "@atlaskit/editor-tables": "^2.8.0",
44
44
  "@atlaskit/icon": "^22.18.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
@@ -135,6 +135,12 @@
135
135
  },
136
136
  "platform_editor_empty_line_prompt_delay": {
137
137
  "type": "boolean"
138
+ },
139
+ "platform_editor_element_dnd_nested_fix_patch_1": {
140
+ "type": "boolean"
141
+ },
142
+ "platform_editor_element_dnd_nested_fix_patch_2": {
143
+ "type": "boolean"
138
144
  }
139
145
  }
140
146
  }