refactor: begin spatial workspace architecture refactor with design document and updated pointer event handling for document activation.

This commit is contained in:
2025-11-27 01:57:38 +01:00
parent 82243b4170
commit 68ed888172
7 changed files with 31 additions and 35 deletions
@@ -1,5 +1,6 @@
import React, { type DragEvent } from 'react';
import { parseTagTransferPayload } from '../tagTransfer';
import { createDocumentEntryKey } from '../../app/entryKey';
import type { Document } from '../../types/documents';
import type { DocumentsViewProps } from '../panel/DocumentsPanel';
import type { DocumentViewLogic } from './useDocumentViewLogic';
@@ -14,7 +15,6 @@ export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
doc,
viewLogic,
draggingDocumentIdsSet,
onDocumentClick,
onDocumentActivate,
onDocumentDragStart,
onDocumentDragEnd,
@@ -37,6 +37,7 @@ export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
savingId: savingDocumentId,
attachInputRef: attachDocumentInputRef,
},
handleEntrySelection,
} = viewLogic;
const isSelected = selectedDocumentIdsSet?.has(doc.id);
@@ -50,7 +51,10 @@ export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
const allowInlineDocumentEdit = onDocumentRename && isSelected && totalSelectionCount === 1;
const handlers = {
onClick: (event: React.MouseEvent) => onDocumentClick?.(doc, event),
onClick: (event: React.MouseEvent) => {
const key = createDocumentEntryKey(doc.id);
handleEntrySelection(key, event);
},
onDoubleClick: (event: React.MouseEvent) => onDocumentActivate?.(doc, event),
onDragStart: (event: DragEvent<HTMLElement>) => onDocumentDragStart?.(event, doc),
onDragEnd: (event: DragEvent<HTMLElement>) => onDocumentDragEnd?.(event),