differentiate shift click and ctrl click on tabs
This commit is contained in:
parent
a261193267
commit
281b20249d
2 changed files with 18 additions and 4 deletions
|
@ -63,13 +63,16 @@
|
||||||
sortable = Sortable.create(container, {
|
sortable = Sortable.create(container, {
|
||||||
forceAutoScrollFallback: true,
|
forceAutoScrollFallback: true,
|
||||||
multiDrag: true,
|
multiDrag: true,
|
||||||
multiDragKey: 'shift',
|
multiDragKey: 'Meta',
|
||||||
selectedClass: 'sortable-selected',
|
selectedClass: 'sortable-selected',
|
||||||
avoidImplicitDeselect: true,
|
avoidImplicitDeselect: true,
|
||||||
onSelect: (e) => {
|
onSelect: (e) => {
|
||||||
let selectedId = e.item.getAttribute('data-id');
|
let selectedId = e.item.getAttribute('data-id');
|
||||||
addSelectFile(selectedId);
|
addSelectFile(selectedId);
|
||||||
if (!e.originalEvent.shiftKey && $selectedFiles.size > 1) {
|
if (
|
||||||
|
!(e.originalEvent.shiftKey || e.originalEvent.ctrlKey || e.originalEvent.metaKey) &&
|
||||||
|
$selectedFiles.size > 1
|
||||||
|
) {
|
||||||
$selectedFiles.forEach((fileId) => {
|
$selectedFiles.forEach((fileId) => {
|
||||||
if (fileId !== selectedId) {
|
if (fileId !== selectedId) {
|
||||||
deselectFile(fileId);
|
deselectFile(fileId);
|
||||||
|
|
|
@ -27,9 +27,20 @@
|
||||||
<ContextMenu.Trigger>
|
<ContextMenu.Trigger>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
class="h-9 px-1.5 py-1 border-none shadow-md focus-visible:ring-0 focus-visible:ring-offset-0"
|
class="h-9 p-0 border-none shadow-md focus-visible:ring-0 focus-visible:ring-offset-0"
|
||||||
>
|
>
|
||||||
{$file.metadata.name}
|
<span
|
||||||
|
class="w-full h-full px-1.5 py-2"
|
||||||
|
on:contextmenu={(e) => {
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
get(selectFiles).addSelect($file._data.id);
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{$file.metadata.name}
|
||||||
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
</ContextMenu.Trigger>
|
</ContextMenu.Trigger>
|
||||||
<ContextMenu.Content>
|
<ContextMenu.Content>
|
||||||
|
|
Loading…
Reference in a new issue