Compare commits

...

1 Commits

Author SHA1 Message Date
alihamuh
dbca7aba46 web: added functionality for dragging tabs with data. 2024-07-06 20:20:05 +05:00
2 changed files with 16 additions and 1 deletions

View File

@@ -275,6 +275,11 @@ function TabStrip() {
}}
renderItem={({ item: session, index: i }) => (
<Tab
onDragStart={(e) => {
// e.dataTransfer.setData("note-id", "here is item");
// e.dataTransfer.dropEffect = "copy";
// console.log("ondragStart", e);
}}
id={session.id}
key={session.id}
title={
@@ -379,6 +384,7 @@ type TabProps = {
onCloseAll: () => void;
onRevealInList: () => void;
onPin: () => void;
onDragStart?: React.DragEventHandler<HTMLDivElement> | undefined;
};
function Tab(props: TabProps) {
const {
@@ -397,7 +403,8 @@ function Tab(props: TabProps) {
onCloseToTheRight,
onCloseToTheLeft,
onRevealInList,
onPin
onPin,
onDragStart
} = props;
const Icon = isLocked
? type === "locked"
@@ -506,6 +513,11 @@ function Tab(props: TabProps) {
}}
{...listeners}
{...attributes}
draggable
onDragStart={(e) => {
//listeners?.onDragStart?.(e);
//onDragStart?.(e);
}}
>
<Flex mr={1}>
<Icon size={16} color={isActive ? "accent-selected" : "icon"} />

View File

@@ -182,6 +182,9 @@ function TipTap(props: TipTapProps) {
onAttachFiles(Array.from(event.clipboardData.files));
return true;
}
},
handleDrop: (e: DragEvent) => {
console.log("handleDrop...", e.dataTransfer?.getData("note-id"));
}
},
enableInputRules: markdownShortcuts,