mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-06-25 12:31:45 +02:00
Issue: Hugo page bundle images inserted from local img/ folder use incorrect leading slash path
Fixes #1041
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
### 🐞 Fixes
|
||||
|
||||
- Fix number fields not being saved to front matter when used inside block field groups
|
||||
- [#1041](https://github.com/estruyf/vscode-front-matter/issues/1041): Fix in image page when using page bundles
|
||||
|
||||
## [10.10.1] - 2026-04-23
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
PlusIcon,
|
||||
VideoCameraIcon,
|
||||
} from '@heroicons/react/24/outline';
|
||||
import { basename, parse } from 'path';
|
||||
import { basename } from 'path';
|
||||
import * as React from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
@@ -57,17 +57,8 @@ export const Item: React.FunctionComponent<IItemProps> = ({
|
||||
const [menuOpen, setMenuOpen] = React.useState(false);
|
||||
|
||||
const relPath = useMemo(() => {
|
||||
if (viewData?.data?.pageBundle && viewData?.data?.filePath) {
|
||||
const articlePath = viewData?.data?.filePath;
|
||||
const articleDir = parse(parseWinPath(articlePath)).dir;
|
||||
|
||||
const mediaPath = parseWinPath(media.fsPath);
|
||||
if (mediaPath.startsWith(articleDir)) {
|
||||
return getRelPath(media.fsPath, undefined, articleDir);
|
||||
}
|
||||
}
|
||||
return getRelPath(media.fsPath, settings?.staticFolder, settings?.wsFolder);
|
||||
}, [media.fsPath, settings?.staticFolder, settings?.wsFolder, viewData?.data?.pageBundle, viewData?.data?.filePath]);
|
||||
}, [media.fsPath, settings?.staticFolder, settings?.wsFolder]);
|
||||
|
||||
const hasViewData = useMemo(() => {
|
||||
return viewData?.data?.filePath !== undefined;
|
||||
|
||||
Reference in New Issue
Block a user