@atlaskit/editor-plugin-type-ahead 2.3.2 → 2.3.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 +9 -0
- package/dist/cjs/pm-plugins/decorations.js +0 -6
- package/dist/cjs/ui/InputQuery.js +32 -8
- package/dist/es2019/pm-plugins/decorations.js +0 -6
- package/dist/es2019/ui/InputQuery.js +32 -6
- package/dist/esm/pm-plugins/decorations.js +0 -6
- package/dist/esm/ui/InputQuery.js +30 -6
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 2.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#135872](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/135872)
|
|
8
|
+
[`d50ea6acabdb3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d50ea6acabdb3) -
|
|
9
|
+
[ux] [ED-27142] Enable quick insert input placeholder
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 2.3.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -14,7 +14,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
14
14
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
17
|
var _WrapperTypeAhead = require("../ui/WrapperTypeAhead");
|
|
19
18
|
var _closeTypeAhead = require("./commands/close-type-ahead");
|
|
20
19
|
var _constants = require("./constants");
|
|
@@ -64,11 +63,6 @@ var factoryDecorations = exports.factoryDecorations = function factoryDecoration
|
|
|
64
63
|
typeaheadComponent.dataset.typeAhead = _constants.TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE;
|
|
65
64
|
typeaheadComponent.style.color = "var(--ds-text-accent-blue, ".concat(_colors.B400, ")");
|
|
66
65
|
typeaheadComponent.style.backgroundColor = 'transparent';
|
|
67
|
-
if ((0, _experiments.editorExperiment)('platform_editor_insertion', 'variant1')) {
|
|
68
|
-
// As part of controls work, we add placeholder `Search` to quick insert command
|
|
69
|
-
// This style is to prevent `/Search` being wrapped if it's triggered at the end of the line
|
|
70
|
-
typeaheadComponent.style.whiteSpace = 'nowrap';
|
|
71
|
-
}
|
|
72
66
|
var onUndoRedo = function onUndoRedo(inputType) {
|
|
73
67
|
if (!['historyUndo', 'historyRedo'].includes(inputType)) {
|
|
74
68
|
return false;
|
|
@@ -14,11 +14,12 @@ var _w3cKeyname = require("w3c-keyname");
|
|
|
14
14
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
15
15
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
16
16
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
17
18
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
18
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
20
21
|
var _constants = require("../pm-plugins/constants");
|
|
21
|
-
var
|
|
22
|
+
var _utils2 = require("../pm-plugins/utils");
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
25
|
/**
|
|
@@ -109,9 +110,15 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
|
|
|
109
110
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
110
111
|
query = _useState2[0],
|
|
111
112
|
setQuery = _useState2[1];
|
|
112
|
-
var
|
|
113
|
+
var isEditorInsertionEnabled = (0, _experiments.editorExperiment)('platform_editor_insertion', 'variant1');
|
|
113
114
|
var isEditorControlsPatch2Enabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2');
|
|
114
|
-
var
|
|
115
|
+
var isSearchPlaceholderEnabled = isEditorInsertionEnabled || (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_3');
|
|
116
|
+
var selection = editorView.state.selection;
|
|
117
|
+
var table = editorView.state.schema.nodes.table;
|
|
118
|
+
var _useState3 = (0, _react.useState)(isSearchPlaceholderEnabled && triggerQueryPrefix === '/' &&
|
|
119
|
+
// When triggered in very narrow table column, placeholder becomes ellipsis only
|
|
120
|
+
// hence we disable it for now and revisit this scenario in ED-27480
|
|
121
|
+
!(0, _utils.findParentNodeOfType)(table)(selection)),
|
|
115
122
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
116
123
|
showPlaceholder = _useState4[0],
|
|
117
124
|
setShowPlaceholder = _useState4[1];
|
|
@@ -140,7 +147,7 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
|
|
|
140
147
|
var raw = ((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.textContent) || '';
|
|
141
148
|
var text = cleanedInputContent();
|
|
142
149
|
var stopDefault = false;
|
|
143
|
-
var _ref2 = (0,
|
|
150
|
+
var _ref2 = (0, _utils2.getPluginState)(editorView.state) || {},
|
|
144
151
|
selectedIndex = _ref2.selectedIndex,
|
|
145
152
|
removePrefixTriggerOnCancel = _ref2.removePrefixTriggerOnCancel;
|
|
146
153
|
setInFocus(true);
|
|
@@ -250,7 +257,7 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
|
|
|
250
257
|
return;
|
|
251
258
|
}
|
|
252
259
|
var element = ref.current;
|
|
253
|
-
var _ref3 = (0,
|
|
260
|
+
var _ref3 = (0, _utils2.getPluginState)(editorView.state) || {},
|
|
254
261
|
removePrefixTriggerOnCancel = _ref3.removePrefixTriggerOnCancel;
|
|
255
262
|
var onFocusIn = function onFocusIn(event) {
|
|
256
263
|
onQueryFocus();
|
|
@@ -423,6 +430,20 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
|
|
|
423
430
|
});
|
|
424
431
|
}
|
|
425
432
|
}, [forceFocus, reopenQuery]);
|
|
433
|
+
var classNames = (0, _react.useMemo)(function () {
|
|
434
|
+
var classes = [];
|
|
435
|
+
if (showPlaceholder) {
|
|
436
|
+
// to avoid the placeholder wrapped to next line when triggered at the end of the line
|
|
437
|
+
// see placeholderWrapStyles in editor-core/src/ui/ContentStyles/index.tsx
|
|
438
|
+
classes.push('placeholder-decoration-wrap');
|
|
439
|
+
if (selection.$from.depth > 1) {
|
|
440
|
+
// to hide placeholder overflow as ellipsis
|
|
441
|
+
// see placeholderWrapStyles in editor-core/src/ui/ContentStyles/index.tsx
|
|
442
|
+
classes.push('placeholder-decoration-hide-overflow');
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return classes.join(' ');
|
|
446
|
+
}, [showPlaceholder, selection]);
|
|
426
447
|
var assistiveHintID = _constants.TYPE_AHEAD_DECORATION_ELEMENT_ID + '__assistiveHint';
|
|
427
448
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
428
449
|
|
|
@@ -432,19 +453,22 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
|
|
|
432
453
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
433
454
|
*/
|
|
434
455
|
return (0, _react2.jsx)(_react.Fragment, null, triggerQueryPrefix, (0, _react2.jsx)("span", {
|
|
435
|
-
css: [querySpanStyles,
|
|
456
|
+
css: [querySpanStyles, isSearchPlaceholderEnabled && queryWithoutPlaceholderStyles, showPlaceholder && placeholderStyles],
|
|
436
457
|
contentEditable: true,
|
|
437
458
|
ref: ref,
|
|
438
459
|
onKeyUp: onKeyUp,
|
|
439
460
|
onClick: onClick,
|
|
440
|
-
onInput:
|
|
461
|
+
onInput: isSearchPlaceholderEnabled ? onInput : undefined,
|
|
441
462
|
role: "combobox",
|
|
442
463
|
"aria-controls": _constants.TYPE_AHEAD_DECORATION_ELEMENT_ID,
|
|
443
464
|
"aria-autocomplete": "list",
|
|
444
465
|
"aria-expanded": items.length !== 0,
|
|
445
466
|
"aria-labelledby": assistiveHintID,
|
|
446
467
|
suppressContentEditableWarning: true,
|
|
447
|
-
"data-query-prefix": triggerQueryPrefix
|
|
468
|
+
"data-query-prefix": triggerQueryPrefix
|
|
469
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
470
|
+
,
|
|
471
|
+
className: classNames,
|
|
448
472
|
"data-place-holder": intl.formatMessage(_typeAhead.typeAheadListMessages.quickInsertInputPlaceholderLabel)
|
|
449
473
|
}, query === null ? (0, _react2.jsx)("input", {
|
|
450
474
|
ref: inputRef,
|
|
@@ -7,7 +7,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { B400 } from '@atlaskit/theme/colors';
|
|
10
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
10
|
import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
|
|
12
11
|
import { closeTypeAhead } from './commands/close-type-ahead';
|
|
13
12
|
import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_DECORATION_KEY } from './constants';
|
|
@@ -63,11 +62,6 @@ export const factoryDecorations = ({
|
|
|
63
62
|
typeaheadComponent.dataset.typeAhead = TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE;
|
|
64
63
|
typeaheadComponent.style.color = `var(--ds-text-accent-blue, ${B400})`;
|
|
65
64
|
typeaheadComponent.style.backgroundColor = 'transparent';
|
|
66
|
-
if (editorExperiment('platform_editor_insertion', 'variant1')) {
|
|
67
|
-
// As part of controls work, we add placeholder `Search` to quick insert command
|
|
68
|
-
// This style is to prevent `/Search` being wrapped if it's triggered at the end of the line
|
|
69
|
-
typeaheadComponent.style.whiteSpace = 'nowrap';
|
|
70
|
-
}
|
|
71
65
|
const onUndoRedo = inputType => {
|
|
72
66
|
if (!['historyUndo', 'historyRedo'].includes(inputType)) {
|
|
73
67
|
return false;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React, { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
5
|
+
import React, { Fragment, useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
@@ -11,6 +11,7 @@ import { keyName as keyNameNormalized } from 'w3c-keyname';
|
|
|
11
11
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
12
12
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
13
13
|
import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
14
|
+
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
14
15
|
import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
15
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -95,9 +96,17 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
95
96
|
const ref = useRef(document.createElement('span'));
|
|
96
97
|
const inputRef = useRef(null);
|
|
97
98
|
const [query, setQuery] = useState(null);
|
|
98
|
-
const
|
|
99
|
+
const isEditorInsertionEnabled = editorExperiment('platform_editor_insertion', 'variant1');
|
|
99
100
|
const isEditorControlsPatch2Enabled = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2');
|
|
100
|
-
const
|
|
101
|
+
const isSearchPlaceholderEnabled = isEditorInsertionEnabled || editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_3');
|
|
102
|
+
const selection = editorView.state.selection;
|
|
103
|
+
const {
|
|
104
|
+
table
|
|
105
|
+
} = editorView.state.schema.nodes;
|
|
106
|
+
const [showPlaceholder, setShowPlaceholder] = useState(isSearchPlaceholderEnabled && triggerQueryPrefix === '/' &&
|
|
107
|
+
// When triggered in very narrow table column, placeholder becomes ellipsis only
|
|
108
|
+
// hence we disable it for now and revisit this scenario in ED-27480
|
|
109
|
+
!findParentNodeOfType(table)(selection));
|
|
101
110
|
const cleanedInputContent = useCallback(() => {
|
|
102
111
|
var _ref$current;
|
|
103
112
|
const raw = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.textContent) || '';
|
|
@@ -413,6 +422,20 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
413
422
|
});
|
|
414
423
|
}
|
|
415
424
|
}, [forceFocus, reopenQuery]);
|
|
425
|
+
const classNames = useMemo(() => {
|
|
426
|
+
const classes = [];
|
|
427
|
+
if (showPlaceholder) {
|
|
428
|
+
// to avoid the placeholder wrapped to next line when triggered at the end of the line
|
|
429
|
+
// see placeholderWrapStyles in editor-core/src/ui/ContentStyles/index.tsx
|
|
430
|
+
classes.push('placeholder-decoration-wrap');
|
|
431
|
+
if (selection.$from.depth > 1) {
|
|
432
|
+
// to hide placeholder overflow as ellipsis
|
|
433
|
+
// see placeholderWrapStyles in editor-core/src/ui/ContentStyles/index.tsx
|
|
434
|
+
classes.push('placeholder-decoration-hide-overflow');
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return classes.join(' ');
|
|
438
|
+
}, [showPlaceholder, selection]);
|
|
416
439
|
const assistiveHintID = TYPE_AHEAD_DECORATION_ELEMENT_ID + '__assistiveHint';
|
|
417
440
|
const intl = useIntl();
|
|
418
441
|
|
|
@@ -422,19 +445,22 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
422
445
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
423
446
|
*/
|
|
424
447
|
return jsx(Fragment, null, triggerQueryPrefix, jsx("span", {
|
|
425
|
-
css: [querySpanStyles,
|
|
448
|
+
css: [querySpanStyles, isSearchPlaceholderEnabled && queryWithoutPlaceholderStyles, showPlaceholder && placeholderStyles],
|
|
426
449
|
contentEditable: true,
|
|
427
450
|
ref: ref,
|
|
428
451
|
onKeyUp: onKeyUp,
|
|
429
452
|
onClick: onClick,
|
|
430
|
-
onInput:
|
|
453
|
+
onInput: isSearchPlaceholderEnabled ? onInput : undefined,
|
|
431
454
|
role: "combobox",
|
|
432
455
|
"aria-controls": TYPE_AHEAD_DECORATION_ELEMENT_ID,
|
|
433
456
|
"aria-autocomplete": "list",
|
|
434
457
|
"aria-expanded": items.length !== 0,
|
|
435
458
|
"aria-labelledby": assistiveHintID,
|
|
436
459
|
suppressContentEditableWarning: true,
|
|
437
|
-
"data-query-prefix": triggerQueryPrefix
|
|
460
|
+
"data-query-prefix": triggerQueryPrefix
|
|
461
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
462
|
+
,
|
|
463
|
+
className: classNames,
|
|
438
464
|
"data-place-holder": intl.formatMessage(typeAheadListMessages.quickInsertInputPlaceholderLabel)
|
|
439
465
|
}, query === null ? jsx("input", {
|
|
440
466
|
ref: inputRef,
|
|
@@ -7,7 +7,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { B400 } from '@atlaskit/theme/colors';
|
|
10
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
10
|
import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
|
|
12
11
|
import { closeTypeAhead } from './commands/close-type-ahead';
|
|
13
12
|
import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_DECORATION_KEY } from './constants';
|
|
@@ -57,11 +56,6 @@ export var factoryDecorations = function factoryDecorations(_ref) {
|
|
|
57
56
|
typeaheadComponent.dataset.typeAhead = TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE;
|
|
58
57
|
typeaheadComponent.style.color = "var(--ds-text-accent-blue, ".concat(B400, ")");
|
|
59
58
|
typeaheadComponent.style.backgroundColor = 'transparent';
|
|
60
|
-
if (editorExperiment('platform_editor_insertion', 'variant1')) {
|
|
61
|
-
// As part of controls work, we add placeholder `Search` to quick insert command
|
|
62
|
-
// This style is to prevent `/Search` being wrapped if it's triggered at the end of the line
|
|
63
|
-
typeaheadComponent.style.whiteSpace = 'nowrap';
|
|
64
|
-
}
|
|
65
59
|
var onUndoRedo = function onUndoRedo(inputType) {
|
|
66
60
|
if (!['historyUndo', 'historyRedo'].includes(inputType)) {
|
|
67
61
|
return false;
|
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import React, { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
6
|
+
import React, { Fragment, useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
@@ -12,6 +12,7 @@ import { keyName as keyNameNormalized } from 'w3c-keyname';
|
|
|
12
12
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
13
13
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
14
14
|
import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
15
|
+
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
15
16
|
import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
16
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -98,9 +99,15 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
98
99
|
_useState2 = _slicedToArray(_useState, 2),
|
|
99
100
|
query = _useState2[0],
|
|
100
101
|
setQuery = _useState2[1];
|
|
101
|
-
var
|
|
102
|
+
var isEditorInsertionEnabled = editorExperiment('platform_editor_insertion', 'variant1');
|
|
102
103
|
var isEditorControlsPatch2Enabled = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2');
|
|
103
|
-
var
|
|
104
|
+
var isSearchPlaceholderEnabled = isEditorInsertionEnabled || editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_3');
|
|
105
|
+
var selection = editorView.state.selection;
|
|
106
|
+
var table = editorView.state.schema.nodes.table;
|
|
107
|
+
var _useState3 = useState(isSearchPlaceholderEnabled && triggerQueryPrefix === '/' &&
|
|
108
|
+
// When triggered in very narrow table column, placeholder becomes ellipsis only
|
|
109
|
+
// hence we disable it for now and revisit this scenario in ED-27480
|
|
110
|
+
!findParentNodeOfType(table)(selection)),
|
|
104
111
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
105
112
|
showPlaceholder = _useState4[0],
|
|
106
113
|
setShowPlaceholder = _useState4[1];
|
|
@@ -412,6 +419,20 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
412
419
|
});
|
|
413
420
|
}
|
|
414
421
|
}, [forceFocus, reopenQuery]);
|
|
422
|
+
var classNames = useMemo(function () {
|
|
423
|
+
var classes = [];
|
|
424
|
+
if (showPlaceholder) {
|
|
425
|
+
// to avoid the placeholder wrapped to next line when triggered at the end of the line
|
|
426
|
+
// see placeholderWrapStyles in editor-core/src/ui/ContentStyles/index.tsx
|
|
427
|
+
classes.push('placeholder-decoration-wrap');
|
|
428
|
+
if (selection.$from.depth > 1) {
|
|
429
|
+
// to hide placeholder overflow as ellipsis
|
|
430
|
+
// see placeholderWrapStyles in editor-core/src/ui/ContentStyles/index.tsx
|
|
431
|
+
classes.push('placeholder-decoration-hide-overflow');
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return classes.join(' ');
|
|
435
|
+
}, [showPlaceholder, selection]);
|
|
415
436
|
var assistiveHintID = TYPE_AHEAD_DECORATION_ELEMENT_ID + '__assistiveHint';
|
|
416
437
|
var intl = useIntl();
|
|
417
438
|
|
|
@@ -421,19 +442,22 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
421
442
|
Task added in https://product-fabric.atlassian.net/wiki/spaces/E/pages/3182068181/Potential+improvements#Moderate-changes.
|
|
422
443
|
*/
|
|
423
444
|
return jsx(Fragment, null, triggerQueryPrefix, jsx("span", {
|
|
424
|
-
css: [querySpanStyles,
|
|
445
|
+
css: [querySpanStyles, isSearchPlaceholderEnabled && queryWithoutPlaceholderStyles, showPlaceholder && placeholderStyles],
|
|
425
446
|
contentEditable: true,
|
|
426
447
|
ref: ref,
|
|
427
448
|
onKeyUp: onKeyUp,
|
|
428
449
|
onClick: onClick,
|
|
429
|
-
onInput:
|
|
450
|
+
onInput: isSearchPlaceholderEnabled ? onInput : undefined,
|
|
430
451
|
role: "combobox",
|
|
431
452
|
"aria-controls": TYPE_AHEAD_DECORATION_ELEMENT_ID,
|
|
432
453
|
"aria-autocomplete": "list",
|
|
433
454
|
"aria-expanded": items.length !== 0,
|
|
434
455
|
"aria-labelledby": assistiveHintID,
|
|
435
456
|
suppressContentEditableWarning: true,
|
|
436
|
-
"data-query-prefix": triggerQueryPrefix
|
|
457
|
+
"data-query-prefix": triggerQueryPrefix
|
|
458
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
459
|
+
,
|
|
460
|
+
className: classNames,
|
|
437
461
|
"data-place-holder": intl.formatMessage(typeAheadListMessages.quickInsertInputPlaceholderLabel)
|
|
438
462
|
}, query === null ? jsx("input", {
|
|
439
463
|
ref: inputRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^103.
|
|
37
|
+
"@atlaskit/editor-common": "^103.1.0",
|
|
38
38
|
"@atlaskit/editor-element-browser": "^0.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
40
40
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-context-panel": "^4.0.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
44
|
-
"@atlaskit/heading": "^5.
|
|
44
|
+
"@atlaskit/heading": "^5.2.0",
|
|
45
45
|
"@atlaskit/icon": "^25.5.0",
|
|
46
46
|
"@atlaskit/menu": "^3.2.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/primitives": "^14.
|
|
48
|
+
"@atlaskit/primitives": "^14.4.0",
|
|
49
49
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
50
50
|
"@atlaskit/theme": "^18.0.0",
|
|
51
51
|
"@atlaskit/tmp-editor-statsig": "^4.6.0",
|
|
@@ -112,6 +112,9 @@
|
|
|
112
112
|
},
|
|
113
113
|
"platform_editor_controls_patch_2": {
|
|
114
114
|
"type": "boolean"
|
|
115
|
+
},
|
|
116
|
+
"platform_editor_controls_patch_3": {
|
|
117
|
+
"type": "boolean"
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
120
|
}
|