Fix title input hotkey scope (#11530)
Before: https://github.com/user-attachments/assets/e0be8247-6d3e-49d0-8595-76f9547bf354 After: https://github.com/user-attachments/assets/ae23b01b-3ad7-4b90-b4ae-ce604d984d73
This commit is contained in:
@ -4,9 +4,9 @@ import { FieldContext } from '@/object-record/record-field/contexts/FieldContext
|
||||
import { FieldInputEvent } from '@/object-record/record-field/types/FieldInputEvent';
|
||||
import { isFieldFullName } from '@/object-record/record-field/types/guards/isFieldFullName';
|
||||
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText';
|
||||
import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
|
||||
import { RecordTitleCellTextFieldInput } from '@/object-record/record-title-cell/components/RecordTitleCellTextFieldInput';
|
||||
import { RecordTitleFullNameFieldInput } from '@/object-record/record-title-cell/components/RecordTitleFullNameFieldInput';
|
||||
import { TitleInputHotkeyScope } from '@/ui/input/types/TitleInputHotkeyScope';
|
||||
|
||||
type RecordTitleCellFieldInputProps = {
|
||||
onClickOutside?: (
|
||||
@ -44,7 +44,7 @@ export const RecordTitleCellFieldInput = ({
|
||||
onTab={onTab}
|
||||
onShiftTab={onShiftTab}
|
||||
sizeVariant={sizeVariant}
|
||||
hotkeyScope={DEFAULT_CELL_SCOPE.scope}
|
||||
hotkeyScope={TitleInputHotkeyScope.TitleInput}
|
||||
/>
|
||||
) : isFieldFullName(fieldDefinition) ? (
|
||||
<RecordTitleFullNameFieldInput
|
||||
@ -54,7 +54,7 @@ export const RecordTitleCellFieldInput = ({
|
||||
onTab={onTab}
|
||||
onShiftTab={onShiftTab}
|
||||
sizeVariant={sizeVariant}
|
||||
hotkeyScope={DEFAULT_CELL_SCOPE.scope}
|
||||
hotkeyScope={TitleInputHotkeyScope.TitleInput}
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
||||
import { INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/object-record/record-inline-cell/constants/InlineCellHotkeyScopeMemoizeKey';
|
||||
import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell';
|
||||
import { useRecordValue } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';
|
||||
import { TitleInputHotkeyScope } from '@/ui/input/types/TitleInputHotkeyScope';
|
||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||
import styled from '@emotion/styled';
|
||||
import { useContext } from 'react';
|
||||
import { OverflowingTextWithTooltip } from 'twenty-ui/display';
|
||||
@ -30,8 +33,19 @@ export const RecordTitleCellSingleTextDisplayMode = () => {
|
||||
|
||||
const { openInlineCell } = useInlineCell();
|
||||
|
||||
const { setHotkeyScopeAndMemorizePreviousScope } = usePreviousHotkeyScope(
|
||||
INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY,
|
||||
);
|
||||
|
||||
return (
|
||||
<StyledDiv onClick={() => openInlineCell()}>
|
||||
<StyledDiv
|
||||
onClick={() => {
|
||||
setHotkeyScopeAndMemorizePreviousScope(
|
||||
TitleInputHotkeyScope.TitleInput,
|
||||
);
|
||||
openInlineCell();
|
||||
}}
|
||||
>
|
||||
<OverflowingTextWithTooltip
|
||||
text={
|
||||
recordValue?.[fieldDefinition.metadata.fieldName] ||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/object-record/record-inline-cell/constants/InlineCellHotkeyScopeMemoizeKey';
|
||||
import { isInlineCellInEditModeScopedState } from '@/object-record/record-inline-cell/states/isInlineCellInEditModeScopedState';
|
||||
import { InlineCellHotkeyScope } from '@/object-record/record-inline-cell/types/InlineCellHotkeyScope';
|
||||
import { getRecordTitleCellId } from '@/object-record/record-title-cell/utils/getRecordTitleCellId';
|
||||
import { TitleInputHotkeyScope } from '@/ui/input/types/TitleInputHotkeyScope';
|
||||
import { useGoBackToPreviousDropdownFocusId } from '@/ui/layout/dropdown/hooks/useGoBackToPreviousDropdownFocusId';
|
||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||
@ -64,7 +64,7 @@ export const useRecordTitleCell = () => {
|
||||
);
|
||||
} else {
|
||||
setHotkeyScopeAndMemorizePreviousScope(
|
||||
InlineCellHotkeyScope.InlineCell,
|
||||
TitleInputHotkeyScope.TitleInput,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
export enum TitleInputHotkeyScope {
|
||||
TitleInput = 'title-input',
|
||||
}
|
||||
Reference in New Issue
Block a user