feat: table row/column drag and drop (#1467)

* chore: add dev container

* feat: add drag handle when hovering cell

* feat: add column drag and drop

* feat: add support for row drag and drop

* refactor: extract preview controllers

* fix: hover issue

* refactor: add handle controller

* chore: f

* chore: remove log

* chore: remove dev files

* feat: hide other drop indicators when table dnd working

* feat: add auto scroll and bug fix

* chore: f

* fix: firefox
This commit is contained in:
Mirone
2025-09-01 02:53:27 +09:00
committed by GitHub
parent aa58e272d6
commit 7d1e5bce0d
30 changed files with 1652 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import {
Embed,
SearchAndReplace,
Mention,
TableDndExtension,
} from "@docmost/editor-ext";
import {
randomElement,
@ -168,6 +169,7 @@ export const mainExtensions = [
TableRow,
TableCell,
TableHeader,
TableDndExtension,
MathInline.configure({
view: MathInlineView,
}),

View File

@ -375,7 +375,7 @@ export default function PageEditor({
}
return (
<div style={{ position: "relative" }}>
<div className="editor-container" style={{ position: "relative" }}>
<div ref={menuContainerRef}>
<EditorContent editor={editor} />

View File

@ -45,6 +45,10 @@
display: none;
pointer-events: none;
}
&[data-direction='horizontal'] {
rotate: 90deg;
}
}
.dark .drag-handle {

View File

@ -8,6 +8,16 @@
}
}
.table-dnd-preview {
padding: 0;
background-color: rgba(255, 255, 255, 0.3);
backdrop-filter: blur(2px);
}
.table-dnd-drop-indicator {
background-color: #adf;
}
.ProseMirror {
table {
border-collapse: collapse;
@ -118,3 +128,13 @@
}
}
}
.editor-container:has(.table-dnd-drop-indicator[data-dragging="true"]) {
.prosemirror-dropcursor-block {
display: none;
}
.prosemirror-dropcursor-inline {
display: none;
}
}