generated from xhofe/solid-lib
-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: optional open item on checkbox (#151)
* fix: typescript error while using native events * feat: diff cursor on folders while pressing alt key with checkbox opened * feat: optional open item on checkbox --------- close AlistGo/alist#6113 close AlistGo/alist#6108 close AlistGo/alist#6096 --------- Co-authored-by: Andy Hsu <i@nn.ci>
- Loading branch information
Showing
7 changed files
with
67 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { createKeyHold } from "@solid-primitives/keyboard" | ||
import { createEffect, createSignal } from "solid-js" | ||
import { local } from "~/store" | ||
|
||
export function useOpenItemWithCheckbox() { | ||
const [shouldOpen, setShouldOpen] = createSignal( | ||
local["open_item_on_checkbox"] === "direct", | ||
) | ||
const isAltKeyPressed = createKeyHold("Alt") | ||
const isControlKeyPressed = createKeyHold("Control") | ||
createEffect(() => { | ||
switch (local["open_item_on_checkbox"]) { | ||
case "direct": { | ||
setShouldOpen(true) | ||
break | ||
} | ||
case "with_ctrl": { | ||
setShouldOpen(isControlKeyPressed()) | ||
break | ||
} | ||
case "with_alt": { | ||
setShouldOpen(isAltKeyPressed()) | ||
} | ||
} | ||
}) | ||
return shouldOpen | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters