fix(dnd): validate proposed hover destinations
This commit is contained in:
1 parent
c1f4f42b21
commit
8bc8fe85c3
5 files changed
+42
-3
No files matched your search
@@ -36,7 +36,10 @@ export function createDndManager(options: DndManagerOptions): DndManager {
|
||||
const source = event.operation.source as
|
||||
(typeof event.operation.source & { group?: string | number; index?: number }) | null;
|
||||
if (!source) return;
|
||||
const destination = { group: source.group ?? "default", index: source.index ?? 0 };
|
||||
const target = event.operation.target as
|
||||
(typeof event.operation.target & { group?: string | number; index?: number }) | null;
|
||||
if (!target) return;
|
||||
const destination = { group: target.group ?? "default", index: target.index ?? 0 };
|
||||
if (options.accept && !options.accept(activeIds, destination)) {
|
||||
event.preventDefault();
|
||||
options.announce?.({ type: "invalid", ids: activeIds, location: destination });
|
||||
|
||||
Reference in new issue
Block a user