-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pin screenshot builtin command
- Loading branch information
1 parent
f29fe00
commit 9b6595f
Showing
4 changed files
with
53 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
apps/desktop/src/routes/extension/pin-screenshot/+page.svelte
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,34 @@ | ||
<script lang="ts"> | ||
import { Button } from "@kksh/svelte5" | ||
import { Layouts } from "@kksh/ui" | ||
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow" | ||
import { CircleX } from "lucide-svelte" | ||
import { onMount } from "svelte" | ||
import * as clipboard from "tauri-plugin-clipboard-api" | ||
let image: string | null = null | ||
const appWin = getCurrentWebviewWindow() | ||
onMount(() => { | ||
clipboard.readImageBase64().then((b64) => { | ||
image = b64 | ||
}) | ||
}) | ||
</script> | ||
|
||
<Button size="icon" variant="ghost" class="fixed left-2 top-2" onclick={() => appWin.close()} | ||
><CircleX /></Button | ||
> | ||
<main class="h-screen w-screen overflow-hidden z-50" data-tauri-drag-region> | ||
{#if image} | ||
<img | ||
src={`data:image/png;base64,${image}`} | ||
alt="screenshot" | ||
class="h-full w-full object-contain pointer-events-none" | ||
/> | ||
{:else} | ||
<Layouts.Center> | ||
<p class="text-2xl font-bold">No image found in clipboard</p> | ||
</Layouts.Center> | ||
{/if} | ||
</main> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.