Skip to content

TagSpaces is an offline, open source, document manager with tagging support

feat: introduction relative links, and fix for updating fulltext indexing

Ilian Sapundshiev3837aa9401db
diff --git a/src/renderer/components/LinksTab.tsx b/src/renderer/components/LinksTab.tsx
index 858220ba8..be4c9b32b 100644
--- a/src/renderer/components/LinksTab.tsx
+++ b/src/renderer/components/LinksTab.tsx
@@ -92,7 +92,7 @@ function LinksTab(props: Props) {
}, [openedEntry, selectedTabName]);
function refreshInboundLinks() {
- createLocationIndex(location).then(() => setInboundLinks());
+ createLocationIndex(location, true, true).then(() => setInboundLinks());
}
function setInboundLinks() {
@@ -108,7 +108,9 @@ function LinksTab(props: Props) {
let url = link.value ? link.value : link.href;
url = url.split('\\').join(''); // tmp fix for milkdown issue
let buttonTitle = '';
- if (link.type === 'url') {
+ if (link.type === 'relative') {
+ buttonTitle = url;
+ } else if (link.type === 'url') {
try {
buttonTitle = new URL(url).hostname;
} catch (e) {
diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsx
index ddd9007f1..76cb14f1e 100644
--- a/src/renderer/hooks/LocationIndexContextProvider.tsx
+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx
@@ -58,6 +58,7 @@ type LocationIndexContextData = {
createLocationIndex: (
location: CommonLocation,
force?: boolean,
+ fullTextIndex?: boolean,
) => Promise<boolean>;
createLocationsIndexes: (
extractText?: boolean,
@@ -479,6 +480,7 @@ export const LocationIndexContextProvider = ({
function createLocationIndex(
location: CommonLocation,
force = false,
+ fullTextIndex?: boolean,
): Promise<boolean> {
walkingRef.current = true;
if (location) {
@@ -489,7 +491,7 @@ export const LocationIndexContextProvider = ({
t('core:indexDisabledConfirm'),
(result) => {
if (result) {
- createLocationIndexInt(location);
+ createLocationIndexInt(location, fullTextIndex);
}
},
'cancelIndexDisabledDialogTID',
@@ -498,13 +500,16 @@ export const LocationIndexContextProvider = ({
);
}
} else {
- return createLocationIndexInt(location);
+ return createLocationIndexInt(location, fullTextIndex);
}
}
return Promise.resolve(false);
}
- function createLocationIndexInt(location: CommonLocation): Promise<boolean> {
+ function createLocationIndexInt(
+ location: CommonLocation,
+ fullTextIndex?: boolean,
+ ): Promise<boolean> {
if (location) {
isIndexing.current = location.uuid;
forceUpdate();
@@ -514,7 +519,7 @@ export const LocationIndexContextProvider = ({
currentLocation && currentLocation.uuid === location.uuid;
return createDirectoryIndexWrapper(
{ path: locationPath, locationID: location.uuid },
- location.fullTextIndex,
+ fullTextIndex ?? location.fullTextIndex,
location.ignorePatternPaths,
enableWS,
)
diff --git a/src/renderer/tagspaces.namespace.d.ts b/src/renderer/tagspaces.namespace.d.ts
index 029f839ce..390c567d3 100644
--- a/src/renderer/tagspaces.namespace.d.ts
+++ b/src/renderer/tagspaces.namespace.d.ts
@@ -216,7 +216,13 @@ export namespace TS {
lon?: number;
}
- type LinkType = 'url' | 'email' | 'tslink' | 'hashtag' | 'mention';
+ type LinkType =
+ | 'url'
+ | 'email'
+ | 'tslink'
+ | 'hashtag'
+ | 'mention'
+ | 'relative';
interface Link {
/**