@atlaskit/editor-plugin-block-controls 3.3.19 → 3.5.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-block-controls
2
2
 
3
+ ## 3.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128788](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128788)
8
+ [`83a4d1ba203b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/83a4d1ba203b0) -
9
+ [ux] update icons
10
+
11
+ ## 3.4.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#128772](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128772)
16
+ [`b2f35f81186a9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2f35f81186a9) -
17
+ Add typeAheadPlugin as an optional dependency, close typeahead when quickinsert is clicked if it's
18
+ open
19
+
3
20
  ## 3.3.19
4
21
 
5
22
  ### Patch Changes
@@ -21,6 +21,7 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
21
21
  var element = document.createElement('span');
22
22
  element.contentEditable = 'false';
23
23
  element.setAttribute('data-blocks-quick-insert-container', 'true');
24
+ element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
24
25
  nodeViewPortalProviderAPI.render(function () {
25
26
  return /*#__PURE__*/(0, _react.createElement)(_quickInsertButton.TypeAheadControl, {
26
27
  api: api,
@@ -20,6 +20,7 @@ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-
20
20
  var _state = require("@atlaskit/editor-prosemirror/state");
21
21
  var _utils = require("@atlaskit/editor-prosemirror/utils");
22
22
  var _dragHandler = _interopRequireDefault(require("@atlaskit/icon/glyph/drag-handler"));
23
+ var _dragHandleVertical = _interopRequireDefault(require("@atlaskit/icon/utility/drag-handle-vertical"));
23
24
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
25
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
25
26
  var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
@@ -661,9 +662,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
661
662
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
662
663
  ,
663
664
  onDragStart: handleIconDragStart
664
- }, (0, _react2.jsx)(_dragHandler.default, {
665
+ }, (0, _react2.jsx)(_dragHandleVertical.default, {
666
+ spacing: "spacious",
665
667
  label: "",
666
- size: "medium"
668
+ LEGACY_fallbackIcon: _dragHandler.default,
669
+ LEGACY_size: "medium"
667
670
  })))
668
671
  );
669
672
  };
@@ -161,6 +161,15 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
161
161
  }
162
162
  (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 || _api$quickInsert.actions.openTypeAhead('blockControl');
163
163
  }, [api, getPos, view]);
164
+ var handleMouseDown = (0, _react.useCallback)(function () {
165
+ var _api$typeAhead;
166
+ // close typeahead if it is open, must happen in mouseDown otherwise typeAhead popup will be dismissed and text is left
167
+ if ((_api$typeAhead = api.typeAhead) !== null && _api$typeAhead !== void 0 && _api$typeAhead.actions.isOpen(view.state)) {
168
+ api.typeAhead.actions.close({
169
+ insertCurrentQueryAsRawText: false
170
+ });
171
+ }
172
+ }, [api, view.state]);
164
173
  return (
165
174
  /*#__PURE__*/
166
175
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
@@ -176,7 +185,8 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
176
185
  type: "button",
177
186
  "aria-label": formatMessage(_messages.blockControlsMessages.insert),
178
187
  xcss: [buttonStyles],
179
- onClick: handleQuickInsert
188
+ onClick: handleQuickInsert,
189
+ onMouseDown: handleMouseDown
180
190
  }, /*#__PURE__*/_react.default.createElement(_add.default, {
181
191
  label: "add",
182
192
  color: "var(--ds-icon-subtle, #626F86)"
@@ -12,6 +12,7 @@ export const quickInsertButtonDecoration = (api, formatMessage, rootPos, anchorN
12
12
  const element = document.createElement('span');
13
13
  element.contentEditable = 'false';
14
14
  element.setAttribute('data-blocks-quick-insert-container', 'true');
15
+ element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
15
16
  nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(TypeAheadControl, {
16
17
  api,
17
18
  getPos,
@@ -17,6 +17,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
17
17
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
18
18
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
19
19
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
20
+ import DragHandleVerticalIcon from '@atlaskit/icon/utility/drag-handle-vertical';
20
21
  import { fg } from '@atlaskit/platform-feature-flags';
21
22
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
22
23
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
@@ -646,9 +647,11 @@ export const DragHandle = ({
646
647
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
647
648
  ,
648
649
  onDragStart: handleIconDragStart
649
- }, jsx(DragHandlerIcon, {
650
+ }, jsx(DragHandleVerticalIcon, {
651
+ spacing: "spacious",
650
652
  label: "",
651
- size: "medium"
653
+ LEGACY_fallbackIcon: DragHandlerIcon,
654
+ LEGACY_size: "medium"
652
655
  })));
653
656
  return !dragHandleDisabled && fg('platform_editor_element_drag_and_drop_ed_23873') ? jsx(Tooltip, {
654
657
  content: jsx(TooltipContentWithMultipleShortcuts, {
@@ -149,6 +149,15 @@ export const TypeAheadControl = ({
149
149
  }
150
150
  (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.actions.openTypeAhead('blockControl');
151
151
  }, [api, getPos, view]);
152
+ const handleMouseDown = useCallback(() => {
153
+ var _api$typeAhead;
154
+ // close typeahead if it is open, must happen in mouseDown otherwise typeAhead popup will be dismissed and text is left
155
+ if ((_api$typeAhead = api.typeAhead) !== null && _api$typeAhead !== void 0 && _api$typeAhead.actions.isOpen(view.state)) {
156
+ api.typeAhead.actions.close({
157
+ insertCurrentQueryAsRawText: false
158
+ });
159
+ }
160
+ }, [api, view.state]);
152
161
  return (
153
162
  /*#__PURE__*/
154
163
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
@@ -164,7 +173,8 @@ export const TypeAheadControl = ({
164
173
  type: "button",
165
174
  "aria-label": formatMessage(messages.insert),
166
175
  xcss: [buttonStyles],
167
- onClick: handleQuickInsert
176
+ onClick: handleQuickInsert,
177
+ onMouseDown: handleMouseDown
168
178
  }, /*#__PURE__*/React.createElement(AddIcon, {
169
179
  label: "add",
170
180
  color: "var(--ds-icon-subtle, #626F86)"
@@ -14,6 +14,7 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(ap
14
14
  var element = document.createElement('span');
15
15
  element.contentEditable = 'false';
16
16
  element.setAttribute('data-blocks-quick-insert-container', 'true');
17
+ element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
17
18
  nodeViewPortalProviderAPI.render(function () {
18
19
  return /*#__PURE__*/createElement(TypeAheadControl, {
19
20
  api: api,
@@ -22,6 +22,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
22
22
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
23
23
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
24
24
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
25
+ import DragHandleVerticalIcon from '@atlaskit/icon/utility/drag-handle-vertical';
25
26
  import { fg } from '@atlaskit/platform-feature-flags';
26
27
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
27
28
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
@@ -658,9 +659,11 @@ export var DragHandle = function DragHandle(_ref) {
658
659
  // eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
659
660
  ,
660
661
  onDragStart: handleIconDragStart
661
- }, jsx(DragHandlerIcon, {
662
+ }, jsx(DragHandleVerticalIcon, {
663
+ spacing: "spacious",
662
664
  label: "",
663
- size: "medium"
665
+ LEGACY_fallbackIcon: DragHandlerIcon,
666
+ LEGACY_size: "medium"
664
667
  })))
665
668
  );
666
669
  };
@@ -151,6 +151,15 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
151
151
  }
152
152
  (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 || _api$quickInsert.actions.openTypeAhead('blockControl');
153
153
  }, [api, getPos, view]);
154
+ var handleMouseDown = useCallback(function () {
155
+ var _api$typeAhead;
156
+ // close typeahead if it is open, must happen in mouseDown otherwise typeAhead popup will be dismissed and text is left
157
+ if ((_api$typeAhead = api.typeAhead) !== null && _api$typeAhead !== void 0 && _api$typeAhead.actions.isOpen(view.state)) {
158
+ api.typeAhead.actions.close({
159
+ insertCurrentQueryAsRawText: false
160
+ });
161
+ }
162
+ }, [api, view.state]);
154
163
  return (
155
164
  /*#__PURE__*/
156
165
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
@@ -166,7 +175,8 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
166
175
  type: "button",
167
176
  "aria-label": formatMessage(messages.insert),
168
177
  xcss: [buttonStyles],
169
- onClick: handleQuickInsert
178
+ onClick: handleQuickInsert,
179
+ onMouseDown: handleMouseDown
170
180
  }, /*#__PURE__*/React.createElement(AddIcon, {
171
181
  label: "add",
172
182
  color: "var(--ds-icon-subtle, #626F86)"
@@ -8,6 +8,7 @@ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
8
  import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
9
9
  import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
10
10
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
11
+ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
11
12
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
12
13
  import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
13
14
  export type ActiveNode = {
@@ -70,11 +71,8 @@ export type BlockControlsPluginDependencies = [
70
71
  OptionalPlugin<FeatureFlagsPlugin>,
71
72
  OptionalPlugin<AnalyticsPlugin>,
72
73
  OptionalPlugin<AccessibilityUtilsPlugin>,
73
- /**
74
- * For Typeahead - Empty line prompt experiment
75
- * Clean up ticket ED-24824
76
- */
77
74
  OptionalPlugin<QuickInsertPlugin>,
75
+ OptionalPlugin<TypeAheadPlugin>,
78
76
  OptionalPlugin<SelectionPlugin>,
79
77
  OptionalPlugin<MetricsPlugin>
80
78
  ];
@@ -8,6 +8,7 @@ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
8
  import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
9
9
  import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
10
10
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
11
+ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
11
12
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
12
13
  import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
13
14
  export type ActiveNode = {
@@ -70,11 +71,8 @@ export type BlockControlsPluginDependencies = [
70
71
  OptionalPlugin<FeatureFlagsPlugin>,
71
72
  OptionalPlugin<AnalyticsPlugin>,
72
73
  OptionalPlugin<AccessibilityUtilsPlugin>,
73
- /**
74
- * For Typeahead - Empty line prompt experiment
75
- * Clean up ticket ED-24824
76
- */
77
74
  OptionalPlugin<QuickInsertPlugin>,
75
+ OptionalPlugin<TypeAheadPlugin>,
78
76
  OptionalPlugin<SelectionPlugin>,
79
77
  OptionalPlugin<MetricsPlugin>
80
78
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.3.19",
3
+ "version": "3.5.0",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,6 +41,7 @@
41
41
  "@atlaskit/editor-plugin-metrics": "^3.4.0",
42
42
  "@atlaskit/editor-plugin-quick-insert": "^2.1.0",
43
43
  "@atlaskit/editor-plugin-selection": "^2.1.0",
44
+ "@atlaskit/editor-plugin-type-ahead": "^2.1.0",
44
45
  "@atlaskit/editor-plugin-width": "^3.0.0",
45
46
  "@atlaskit/editor-prosemirror": "7.0.0",
46
47
  "@atlaskit/editor-shared-styles": "^3.4.0",
@@ -50,7 +51,7 @@
50
51
  "@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
51
52
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
52
53
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.0.0",
53
- "@atlaskit/primitives": "^14.1.0",
54
+ "@atlaskit/primitives": "^14.2.0",
54
55
  "@atlaskit/theme": "^18.0.0",
55
56
  "@atlaskit/tmp-editor-statsig": "^4.1.0",
56
57
  "@atlaskit/tokens": "^4.5.0",