feat: Introduce a generic inline rename input component for document editing
This commit is contained in:
@@ -62,11 +62,12 @@ const DesktopDocumentContainer: React.FC<React.ComponentProps<typeof DesktopDocu
|
||||
onDeselect: (ids: string[]) => void;
|
||||
onDocumentActivate?: (id: string, event?: any) => void;
|
||||
selection: string[];
|
||||
requestCanvasFocus?: () => void;
|
||||
}> = React.memo((props) => {
|
||||
const { layoutCard, selected, onSelect, onDeselect, onDocumentActivate, selection } = props;
|
||||
const { layoutCard, selected, onSelect, onDeselect, onDocumentActivate, selection, requestCanvasFocus } = props;
|
||||
|
||||
// We assume layoutCard is always present in this context
|
||||
const cardPointerHandlers = useCardPointer(layoutCard!, !!selected, selection, onSelect, onDeselect, onDocumentActivate);
|
||||
const cardPointerHandlers = useCardPointer(layoutCard!, !!selected, selection, onSelect, onDeselect, onDocumentActivate, requestCanvasFocus);
|
||||
|
||||
return (
|
||||
<DesktopDocumentCard
|
||||
@@ -194,7 +195,11 @@ const DesktopWorkspaceContent: React.FC<DesktopWorkspaceProps> = ({
|
||||
}, [layoutStore.items]);
|
||||
|
||||
const handleShellKeyDown = useCallback(() => { }, []);
|
||||
const focusShell = useCallback(() => { }, []);
|
||||
const focusShell = useCallback(() => {
|
||||
if (containerRef.current) {
|
||||
containerRef.current.focus();
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Tag Interactions
|
||||
const tagInteractions = useDeskTagInteractions({
|
||||
@@ -209,6 +214,11 @@ const DesktopWorkspaceContent: React.FC<DesktopWorkspaceProps> = ({
|
||||
|
||||
useEffect(() => {
|
||||
const handleWindowKeyDown = (e: KeyboardEvent) => {
|
||||
// Only handle events if the container itself is the target (focused)
|
||||
if (e.target !== containerRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Space preview logic
|
||||
if (e.code === 'Space' && selectedDocumentIds.length > 0) {
|
||||
const lastId = selectedDocumentIds[selectedDocumentIds.length - 1];
|
||||
@@ -422,6 +432,7 @@ const DesktopWorkspaceContent: React.FC<DesktopWorkspaceProps> = ({
|
||||
handleSelectionChange(Array.from(newSelection));
|
||||
}}
|
||||
selection={selectedDocumentIds}
|
||||
requestCanvasFocus={focusShell}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user