@atlaskit/editor-plugin-block-controls 3.3.18 → 3.4.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,24 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 3.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128772](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128772)
8
+ [`b2f35f81186a9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2f35f81186a9) -
9
+ Add typeAheadPlugin as an optional dependency, close typeahead when quickinsert is clicked if it's
10
+ open
11
+
12
+ ## 3.3.19
13
+
14
+ ### Patch Changes
15
+
16
+ - [#128787](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128787)
17
+ [`8d3d8163602e9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8d3d8163602e9) -
18
+ use color.icon.subtle pallette for both block control widgets, which includes drag handle and
19
+ quick insert
20
+ - Updated dependencies
21
+
3
22
  ## 3.3.18
4
23
 
5
24
  ### 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,
@@ -43,6 +43,11 @@ var iconWrapperStyles = (0, _primitives.xcss)({
43
43
  justifyContent: 'center',
44
44
  alignItems: 'center'
45
45
  });
46
+
47
+ // update color to match quick insert button for new editor controls
48
+ var dragHandleColor = (0, _react2.css)({
49
+ color: "var(--ds-icon-subtle, #626F86)"
50
+ });
46
51
  var dragHandleButtonStyles = (0, _react2.css)({
47
52
  position: 'absolute',
48
53
  padding: "var(--ds-space-025, 2px)".concat(" 0"),
@@ -59,6 +64,7 @@ var dragHandleButtonStyles = (0, _react2.css)({
59
64
  background: 'transparent',
60
65
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
61
66
  borderRadius: _consts.DRAG_HANDLE_BORDER_RADIUS,
67
+ // when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
62
68
  color: "var(--ds-icon, #44546F)",
63
69
  cursor: 'grab',
64
70
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -632,7 +638,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
632
638
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
633
639
  (0, _react2.jsx)("button", {
634
640
  type: "button",
635
- css: [dragHandleButtonStyles,
641
+ css: [dragHandleButtonStyles, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
636
642
  // ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
637
643
  // See https://product-fabric.atlassian.net/browse/ED-26266
638
644
  _browser.browser.gecko && (0, _platformFeatureFlags.fg)('platform_editor_dnd_handle_highlight_fix_firefox') && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
@@ -37,10 +37,10 @@ var buttonStyles = (0, _primitives.xcss)({
37
37
  zIndex: 'card',
38
38
  outline: 'none',
39
39
  ':hover': {
40
- backgroundColor: 'color.background.neutral.hovered'
40
+ backgroundColor: 'color.background.neutral.subtle.hovered'
41
41
  },
42
42
  ':active': {
43
- backgroundColor: 'color.background.neutral.pressed'
43
+ backgroundColor: 'color.background.neutral.subtle.pressed'
44
44
  },
45
45
  ':focus': {
46
46
  outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
@@ -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,10 +185,11 @@ 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
- color: "var(--ds-icon, #44546F)"
192
+ color: "var(--ds-icon-subtle, #626F86)"
183
193
  }))))
184
194
  );
185
195
  };
@@ -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,
@@ -35,6 +35,11 @@ const iconWrapperStyles = xcss({
35
35
  justifyContent: 'center',
36
36
  alignItems: 'center'
37
37
  });
38
+
39
+ // update color to match quick insert button for new editor controls
40
+ const dragHandleColor = css({
41
+ color: "var(--ds-icon-subtle, #626F86)"
42
+ });
38
43
  const dragHandleButtonStyles = css({
39
44
  position: 'absolute',
40
45
  padding: `${"var(--ds-space-025, 2px)"} 0`,
@@ -51,6 +56,7 @@ const dragHandleButtonStyles = css({
51
56
  background: 'transparent',
52
57
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
53
58
  borderRadius: DRAG_HANDLE_BORDER_RADIUS,
59
+ // when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
54
60
  color: "var(--ds-icon, #44546F)",
55
61
  cursor: 'grab',
56
62
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -617,7 +623,7 @@ export const DragHandle = ({
617
623
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
618
624
  jsx("button", {
619
625
  type: "button",
620
- css: [dragHandleButtonStyles,
626
+ css: [dragHandleButtonStyles, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
621
627
  // ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
622
628
  // See https://product-fabric.atlassian.net/browse/ED-26266
623
629
  browser.gecko && fg('platform_editor_dnd_handle_highlight_fix_firefox') && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
@@ -26,10 +26,10 @@ const buttonStyles = xcss({
26
26
  zIndex: 'card',
27
27
  outline: 'none',
28
28
  ':hover': {
29
- backgroundColor: 'color.background.neutral.hovered'
29
+ backgroundColor: 'color.background.neutral.subtle.hovered'
30
30
  },
31
31
  ':active': {
32
- backgroundColor: 'color.background.neutral.pressed'
32
+ backgroundColor: 'color.background.neutral.subtle.pressed'
33
33
  },
34
34
  ':focus': {
35
35
  outline: `2px solid ${"var(--ds-border-focused, #388BFF)"}`
@@ -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,10 +173,11 @@ 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
- color: "var(--ds-icon, #44546F)"
180
+ color: "var(--ds-icon-subtle, #626F86)"
171
181
  }))))
172
182
  );
173
183
  };
@@ -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,
@@ -40,6 +40,11 @@ var iconWrapperStyles = xcss({
40
40
  justifyContent: 'center',
41
41
  alignItems: 'center'
42
42
  });
43
+
44
+ // update color to match quick insert button for new editor controls
45
+ var dragHandleColor = css({
46
+ color: "var(--ds-icon-subtle, #626F86)"
47
+ });
43
48
  var dragHandleButtonStyles = css({
44
49
  position: 'absolute',
45
50
  padding: "var(--ds-space-025, 2px)".concat(" 0"),
@@ -56,6 +61,7 @@ var dragHandleButtonStyles = css({
56
61
  background: 'transparent',
57
62
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
58
63
  borderRadius: DRAG_HANDLE_BORDER_RADIUS,
64
+ // when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
59
65
  color: "var(--ds-icon, #44546F)",
60
66
  cursor: 'grab',
61
67
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -629,7 +635,7 @@ export var DragHandle = function DragHandle(_ref) {
629
635
  // eslint-disable-next-line @atlaskit/design-system/no-html-button
630
636
  jsx("button", {
631
637
  type: "button",
632
- css: [dragHandleButtonStyles,
638
+ css: [dragHandleButtonStyles, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
633
639
  // ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
634
640
  // See https://product-fabric.atlassian.net/browse/ED-26266
635
641
  browser.gecko && fg('platform_editor_dnd_handle_highlight_fix_firefox') && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
@@ -27,10 +27,10 @@ var buttonStyles = xcss({
27
27
  zIndex: 'card',
28
28
  outline: 'none',
29
29
  ':hover': {
30
- backgroundColor: 'color.background.neutral.hovered'
30
+ backgroundColor: 'color.background.neutral.subtle.hovered'
31
31
  },
32
32
  ':active': {
33
- backgroundColor: 'color.background.neutral.pressed'
33
+ backgroundColor: 'color.background.neutral.subtle.pressed'
34
34
  },
35
35
  ':focus': {
36
36
  outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
@@ -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,10 +175,11 @@ 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
- color: "var(--ds-icon, #44546F)"
182
+ color: "var(--ds-icon-subtle, #626F86)"
173
183
  }))))
174
184
  );
175
185
  };
@@ -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.18",
3
+ "version": "3.4.0",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^47.6.0",
36
- "@atlaskit/editor-common": "^102.10.0",
36
+ "@atlaskit/editor-common": "^102.11.0",
37
37
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
39
39
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.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",