Merge pull request #158 from PasteBar/fix-for-quick-paste-window-auto-generate-link-preview-option
Fix for quick paste window auto generate link preview option
This commit is contained in:
commit
72fa0b9c61
5
.changeset/sharp-camels-collect.md
Normal file
5
.changeset/sharp-camels-collect.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'pastebar-app-ui': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix: Autogenerate link settings not working in Quick Paste Window
|
@ -3,7 +3,7 @@ import { UniqueIdentifier } from '@dnd-kit/core'
|
|||||||
import { listen } from '@tauri-apps/api/event'
|
import { listen } from '@tauri-apps/api/event'
|
||||||
import { invoke } from '@tauri-apps/api/tauri'
|
import { invoke } from '@tauri-apps/api/tauri'
|
||||||
import { appWindow } from '@tauri-apps/api/window'
|
import { appWindow } from '@tauri-apps/api/window'
|
||||||
import { isKeyAltPressed, isKeyCtrlPressed } from '~/store'
|
import { isKeyAltPressed, isKeyCtrlPressed, settingsStoreAtom } from '~/store'
|
||||||
import { useAtomValue } from 'jotai'
|
import { useAtomValue } from 'jotai'
|
||||||
import { throttle } from 'lodash-es'
|
import { throttle } from 'lodash-es'
|
||||||
import { ArrowDownFromLine, ArrowUpToLine, Search } from 'lucide-react'
|
import { ArrowDownFromLine, ArrowUpToLine, Search } from 'lucide-react'
|
||||||
@ -102,6 +102,9 @@ export default function ClipboardHistoryQuickPastePage() {
|
|||||||
const isShowSearch = useSignal(false)
|
const isShowSearch = useSignal(false)
|
||||||
const { movePinnedClipboardHistoryUpDown } = useMovePinnedClipboardHistoryUpDown()
|
const { movePinnedClipboardHistoryUpDown } = useMovePinnedClipboardHistoryUpDown()
|
||||||
|
|
||||||
|
const { isAutoPreviewLinkCardsEnabled, isAutoGenerateLinkCardsEnabled } =
|
||||||
|
useAtomValue(settingsStoreAtom)
|
||||||
|
|
||||||
const [historyFilters, setHistoryFilters] = useState<string[]>([])
|
const [historyFilters, setHistoryFilters] = useState<string[]>([])
|
||||||
const [codeFilters, setCodeFilters] = useState<string[]>([])
|
const [codeFilters, setCodeFilters] = useState<string[]>([])
|
||||||
const [appFilters, setAppFilters] = useState<string[]>([])
|
const [appFilters, setAppFilters] = useState<string[]>([])
|
||||||
@ -651,6 +654,10 @@ export default function ClipboardHistoryQuickPastePage() {
|
|||||||
addToClipboardHistoryIdsURLErrors={
|
addToClipboardHistoryIdsURLErrors={
|
||||||
addToClipboardHistoryIdsURLErrors
|
addToClipboardHistoryIdsURLErrors
|
||||||
}
|
}
|
||||||
|
isLinkCardPreviewEnabled={isAutoPreviewLinkCardsEnabled}
|
||||||
|
isAutoGenerateLinkCardsEnabled={
|
||||||
|
isAutoGenerateLinkCardsEnabled
|
||||||
|
}
|
||||||
addToGenerateLinkMetaDataInProgress={
|
addToGenerateLinkMetaDataInProgress={
|
||||||
addToGenerateLinkMetaDataInProgress
|
addToGenerateLinkMetaDataInProgress
|
||||||
}
|
}
|
||||||
@ -834,6 +841,10 @@ export default function ClipboardHistoryQuickPastePage() {
|
|||||||
addToGenerateLinkMetaDataInProgress={
|
addToGenerateLinkMetaDataInProgress={
|
||||||
addToGenerateLinkMetaDataInProgress
|
addToGenerateLinkMetaDataInProgress
|
||||||
}
|
}
|
||||||
|
isLinkCardPreviewEnabled={isAutoPreviewLinkCardsEnabled}
|
||||||
|
isAutoGenerateLinkCardsEnabled={
|
||||||
|
isAutoGenerateLinkCardsEnabled
|
||||||
|
}
|
||||||
isScrolling={isScrolling}
|
isScrolling={isScrolling}
|
||||||
removeToGenerateLinkMetaDataInProgress={
|
removeToGenerateLinkMetaDataInProgress={
|
||||||
removeToGenerateLinkMetaDataInProgress
|
removeToGenerateLinkMetaDataInProgress
|
||||||
|
@ -10,7 +10,7 @@ use crate::services::link_metadata_service::{
|
|||||||
delete_link_metadata_by_item_id, insert_or_update_link_metadata, AudioInfo,
|
delete_link_metadata_by_item_id, insert_or_update_link_metadata, AudioInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::services::utils::{decode_html_entities, ensure_url_prefix};
|
use crate::services::utils::{debug_output, decode_html_entities, ensure_url_prefix};
|
||||||
use linkify::{LinkFinder, LinkKind};
|
use linkify::{LinkFinder, LinkKind};
|
||||||
|
|
||||||
use nanoid::nanoid;
|
use nanoid::nanoid;
|
||||||
@ -248,6 +248,9 @@ pub async fn fetch_link_metadata(
|
|||||||
item_id: Option<String>,
|
item_id: Option<String>,
|
||||||
is_preview_only: Option<bool>,
|
is_preview_only: Option<bool>,
|
||||||
) -> Result<LinkMetadata, String> {
|
) -> Result<LinkMetadata, String> {
|
||||||
|
debug_output(|| {
|
||||||
|
println!("Fetching metadata for URL: {}", url);
|
||||||
|
});
|
||||||
if url.is_empty() {
|
if url.is_empty() {
|
||||||
return Err("URL is empty".to_string());
|
return Err("URL is empty".to_string());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user