Update anki connect quick action
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { zoomFitToScreen } from '$lib/panzoom';
|
import { toggleFullScreen, zoomFitToScreen } from '$lib/panzoom';
|
||||||
import { SpeedDial, SpeedDialButton } from 'flowbite-svelte';
|
import { SpeedDial, SpeedDialButton } from 'flowbite-svelte';
|
||||||
import { settings } from '$lib/settings';
|
import { settings } from '$lib/settings';
|
||||||
import {
|
import {
|
||||||
ArrowLeftOutline,
|
ArrowLeftOutline,
|
||||||
ArrowRightOutline,
|
ArrowRightOutline,
|
||||||
|
CompressOutline,
|
||||||
ImageOutline,
|
ImageOutline,
|
||||||
ZoomOutOutline
|
ZoomOutOutline
|
||||||
} from 'flowbite-svelte-icons';
|
} from 'flowbite-svelte-icons';
|
||||||
@@ -13,7 +14,8 @@
|
|||||||
|
|
||||||
export let left: (_e: any, ingoreTimeOut?: boolean) => void;
|
export let left: (_e: any, ingoreTimeOut?: boolean) => void;
|
||||||
export let right: (_e: any, ingoreTimeOut?: boolean) => void;
|
export let right: (_e: any, ingoreTimeOut?: boolean) => void;
|
||||||
export let src: File;
|
export let src1: File;
|
||||||
|
export let src2: File | undefined;
|
||||||
|
|
||||||
let open = false;
|
let open = false;
|
||||||
|
|
||||||
@@ -32,8 +34,8 @@
|
|||||||
open = false;
|
open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onUpdateCard() {
|
async function onUpdateCard(src: File | undefined) {
|
||||||
if ($settings.ankiConnectSettings.enabled) {
|
if ($settings.ankiConnectSettings.enabled && src) {
|
||||||
if ($settings.ankiConnectSettings.cropImage) {
|
if ($settings.ankiConnectSettings.cropImage) {
|
||||||
showCropper(URL.createObjectURL(src));
|
showCropper(URL.createObjectURL(src));
|
||||||
} else {
|
} else {
|
||||||
@@ -52,15 +54,22 @@
|
|||||||
tooltip="none"
|
tooltip="none"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
defaultClass="absolute end-3 bottom-3 z-50"
|
defaultClass="absolute end-3 bottom-3 z-50"
|
||||||
outline
|
color="transparent"
|
||||||
color="dark"
|
|
||||||
bind:open
|
bind:open
|
||||||
>
|
>
|
||||||
{#if $settings.ankiConnectSettings.enabled}
|
{#if $settings.ankiConnectSettings.enabled}
|
||||||
<SpeedDialButton on:click={onUpdateCard}>
|
<SpeedDialButton name={src2 ? '1' : undefined} on:click={() => onUpdateCard(src1)}>
|
||||||
<ImageOutline />
|
<ImageOutline />
|
||||||
</SpeedDialButton>
|
</SpeedDialButton>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if $settings.ankiConnectSettings.enabled && src2}
|
||||||
|
<SpeedDialButton name="2" on:click={() => onUpdateCard(src2)}>
|
||||||
|
<ImageOutline />
|
||||||
|
</SpeedDialButton>
|
||||||
|
{/if}
|
||||||
|
<SpeedDialButton on:click={toggleFullScreen}>
|
||||||
|
<CompressOutline />
|
||||||
|
</SpeedDialButton>
|
||||||
<SpeedDialButton on:click={handleZoom}>
|
<SpeedDialButton on:click={handleZoom}>
|
||||||
<ZoomOutOutline />
|
<ZoomOutOutline />
|
||||||
</SpeedDialButton>
|
</SpeedDialButton>
|
||||||
|
|||||||
@@ -248,7 +248,12 @@
|
|||||||
<title>{volume?.mokuroData.volume || 'Volume'}</title>
|
<title>{volume?.mokuroData.volume || 'Volume'}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
{#if volume && pages}
|
{#if volume && pages}
|
||||||
<QuickActions {left} {right} src={Object.values(volume?.files)[index]} />
|
<QuickActions
|
||||||
|
{left}
|
||||||
|
{right}
|
||||||
|
src1={Object.values(volume?.files)[index]}
|
||||||
|
src2={!volumeSettings.singlePageView ? Object.values(volume?.files)[index + 1] : undefined}
|
||||||
|
/>
|
||||||
<SettingsButton />
|
<SettingsButton />
|
||||||
<Cropper />
|
<Cropper />
|
||||||
<Popover placement="bottom" trigger="click" triggeredBy="#page-num" class="z-20 w-full max-w-xs">
|
<Popover placement="bottom" trigger="click" triggeredBy="#page-num" class="z-20 w-full max-w-xs">
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
const triggerOptions = [
|
const triggerOptions = [
|
||||||
{ value: 'rightClick', name: 'Right click (long press on mobile)' },
|
{ value: 'rightClick', name: 'Right click (long press on mobile)' },
|
||||||
{ value: 'doubleTap', name: 'Double tap' },
|
{ value: 'doubleTap', name: 'Double tap' },
|
||||||
{ value: 'both', name: 'Both' }
|
{ value: 'both', name: 'Both' },
|
||||||
|
{ value: 'neither', name: 'Neither' }
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user