refactor(web): disable shortcut when writting (#4057)

* Revert "fix: disable shortcut when writting text (#4053)"

This reverts commit fd6ade2b5d.

* refactor: disable shortcut when writting

* pr feedback

* pr feedback
This commit is contained in:
martin
2023-09-12 16:26:53 +02:00
committed by GitHub
parent bd226e9e2c
commit a678590ccd
9 changed files with 32 additions and 37 deletions

View File

@@ -45,7 +45,6 @@
import ShareVariantOutline from 'svelte-material-icons/ShareVariantOutline.svelte';
import type { PageData } from './$types';
import { clickOutside } from '$lib/utils/click-outside';
import { disableShortcut } from '$lib/stores/shortcut.store';
export let data: PageData;
@@ -277,7 +276,6 @@
album.description = description;
isEditingDescription = false;
$disableShortcut = false;
} catch (error) {
handleError(error, 'Error updating album description');
}
@@ -474,10 +472,7 @@
{#if isOwned || album.description}
<button
class="mb-12 mt-6 w-full border-b-2 border-transparent pb-2 text-left text-lg font-medium transition-colors hover:border-b-2 dark:text-gray-300"
on:click={() => {
isEditingDescription = true;
$disableShortcut = true;
}}
on:click={() => (isEditingDescription = true)}
class:hover:border-gray-400={isOwned}
disabled={!isOwned}
title="Edit description"
@@ -544,10 +539,7 @@
{#if isEditingDescription}
<EditDescriptionModal
{album}
on:close={() => {
isEditingDescription = false;
$disableShortcut = false;
}}
on:close={() => (isEditingDescription = false)}
on:updated={({ detail: description }) => handleUpdateDescription(description)}
/>
{/if}

View File

@@ -21,6 +21,7 @@
import { browser } from '$app/environment';
import MergeSuggestionModal from '$lib/components/faces-page/merge-suggestion-modal.svelte';
import SetBirthDateModal from '$lib/components/faces-page/set-birth-date-modal.svelte';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
export let data: PageData;
let selectHidden = false;
@@ -60,6 +61,9 @@
});
const handleKeyboardPress = (event: KeyboardEvent) => {
if (shouldIgnoreShortcut(event)) {
return;
}
switch (event.key) {
case 'Escape':
handleCloseClick();

View File

@@ -27,6 +27,7 @@
import { browser } from '$app/environment';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import { preventRaceConditionSearchBar } from '$lib/stores/search.store';
import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
export let data: PageData;
@@ -51,6 +52,9 @@
});
const handleKeyboardPress = (event: KeyboardEvent) => {
if (shouldIgnoreShortcut(event)) {
return;
}
if (!$showAssetViewer) {
switch (event.key) {
case 'Escape':