disable dragging for locked files

This commit is contained in:
Pavel Laptev 2024-03-29 02:33:45 +01:00 committed by Mattias Granlund
parent 19cbb91961
commit 6c8544acd8
2 changed files with 4 additions and 2 deletions

View File

@ -51,6 +51,8 @@
$: popupMenu = updateContextMenu();
$: isLocked = file.hunks.some((h) => h.locked);
onDestroy(() => {
if (popupMenu) {
popupMenu.$destroy();
@ -89,7 +91,7 @@
}}
use:draggable={{
data: new DraggableFile($branch?.id || '', file, selectedFiles),
disabled: readonly || isUnapplied,
disabled: readonly || isUnapplied || isLocked,
viewportId: 'board-viewport',
selector: '.selected-draggable'
}}

View File

@ -101,7 +101,7 @@ export function draggable(node: HTMLElement, opts: DraggableConfig) {
// elements, falling back to the single node executing the drag.
if (opts.selector) {
selectedElements = Array.from(
document.querySelectorAll(opts.selector || '').values() as Iterable<HTMLElement>
document.querySelectorAll(opts.selector).values() as Iterable<HTMLElement>
);
if (selectedElements.length > 0) {