Zeige die Einfuegelinie beim Ziehen eines Kapitels nach unten an der Stelle, an der das Kapitel ankommt.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1621a7eb2f
commit
94ef46d8eb
1 file changed
+5
-1
@@ -623,10 +623,12 @@ export function ContentBoard({
|
||||
const chapterIndex = chapters.findIndex((chapter) => chapter.id === section.id);
|
||||
const expanded = !onlyChapter || section.id === onlyChapter;
|
||||
const movable = canMoveChapters && section.id !== "loose";
|
||||
const fromIndex = chapters.findIndex((chapter) => chapter.id === draggingId);
|
||||
const classes = ["content-section"];
|
||||
if (draggingId === section.id) classes.push("is-dragging");
|
||||
if (!expanded) classes.push("is-collapsed");
|
||||
if (indicator?.kind === "chapter" && chapterIndex === indicator.index && draggingId !== section.id) classes.push("is-chapter-target");
|
||||
const insertBefore = indicator?.kind === "chapter" && fromIndex > indicator.index && chapterIndex === indicator.index;
|
||||
const insertAfter = indicator?.kind === "chapter" && fromIndex >= 0 && fromIndex < indicator.index && chapterIndex === indicator.index;
|
||||
return (
|
||||
<section
|
||||
key={section.id}
|
||||
@@ -634,6 +636,7 @@ export function ContentBoard({
|
||||
data-section={section.id}
|
||||
data-chapter={section.id === "loose" ? undefined : section.id}
|
||||
>
|
||||
{insertBefore ? <div className="insert-line" aria-hidden="true" /> : null}
|
||||
{section.title ? (
|
||||
<div
|
||||
className={movable ? "chapter-head is-movable" : "chapter-head"}
|
||||
@@ -745,6 +748,7 @@ export function ContentBoard({
|
||||
})}
|
||||
{indicator?.sectionId === section.id && indicator?.kind !== "chapter" && indicator.index === section.items.length ? <li className="insert-line" aria-hidden="true" /> : null}
|
||||
</ol> : null}
|
||||
{insertAfter ? <div className="insert-line" aria-hidden="true" /> : null}
|
||||
</section>
|
||||
);
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user