From 5d93b16e8d75ca4b176430acf941c098b9cb6b3e Mon Sep 17 00:00:00 2001 From: Devon22 Date: Tue, 21 Jul 2026 21:36:38 +0800 Subject: [PATCH] 3.4.19 --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/GridView.ts | 1 + src/utils/mediaUtils.ts | 12 ++++++++---- styles.css | 19 ++++++++++++++++++- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/manifest.json b/manifest.json index 2e058b3..84a39c5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "gridexplorer", "name": "GridExplorer", - "version": "3.4.18", + "version": "3.4.19", "minAppVersion": "1.8.7", "description": "Browse and organize note files visually in a flexible grid layout.", "author": "Devon22", diff --git a/package-lock.json b/package-lock.json index 7ab0ba3..b3909e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gridexplorer", - "version": "3.4.18", + "version": "3.4.19", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gridexplorer", - "version": "3.4.18", + "version": "3.4.19", "license": "MIT", "dependencies": { "jszip": "^3.10.1" diff --git a/package.json b/package.json index 742c5bf..3796537 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gridexplorer", - "version": "3.4.18", + "version": "3.4.19", "description": "Browse and organize note files visually in a flexible grid layout.", "main": "main.js", "scripts": { diff --git a/src/GridView.ts b/src/GridView.ts index e0637ad..acefa0f 100644 --- a/src/GridView.ts +++ b/src/GridView.ts @@ -1541,6 +1541,7 @@ export class GridView extends ItemView { // Markdown 檔案尋找內部圖片 if (imageUrl) { const img = imageArea.createEl('img'); + img.referrerPolicy = 'no-referrer'; img.src = imageUrl; img.draggable = false; imageArea.setAttribute('data-loaded', 'true'); diff --git a/src/utils/mediaUtils.ts b/src/utils/mediaUtils.ts index 308bdb0..c3ac3f6 100644 --- a/src/utils/mediaUtils.ts +++ b/src/utils/mediaUtils.ts @@ -186,21 +186,24 @@ async function resolveUrl(app: App, url: string): Promise { } async function validateRemoteImage(url: string): Promise { + const headers = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36' + }; try { - const headResponse = await requestUrl({ url, method: 'HEAD' }); + const headResponse = await requestUrl({ url, method: 'HEAD', headers }); if (isSuccessfulStatus(headResponse)) { return url; } if (headResponse.status === 405 || headResponse.status === 501) { - const getResponse = await requestUrl({ url }); + const getResponse = await requestUrl({ url, headers }); if (isSuccessfulStatus(getResponse)) { return url; } } } catch { try { - const getResponse = await requestUrl({ url }); + const getResponse = await requestUrl({ url, headers }); if (isSuccessfulStatus(getResponse)) { return url; } @@ -209,7 +212,8 @@ async function validateRemoteImage(url: string): Promise { } } - return null; + // 即使驗證失敗,只要 URL 格式符合圖片規格,仍傳回原網址讓瀏覽器嘗試載入 + return url; } function isSuccessfulStatus(response: RequestUrlResponse): boolean { diff --git a/styles.css b/styles.css index 73474a3..cc38d3c 100644 --- a/styles.css +++ b/styles.css @@ -2323,6 +2323,7 @@ a.ge-current-folder:hover { z-index: 100; display: flex; flex-direction: column; + container-type: inline-size; } /* 筆記頂部按鈕列 */ @@ -2354,7 +2355,8 @@ a.ge-current-folder:hover { /* 捲動區域 */ .ge-note-scroll-container { flex: 1 1 auto; - overflow: auto; + overflow-y: auto; + overflow-x: hidden; background-color: var(--background-primary); font-size: var(--font-text-size); } @@ -2457,6 +2459,21 @@ a.ge-current-folder:hover { pointer-events: auto; } +/* 讓圖片延展到包含卷軸的介面寬度 (僅限行動裝置,且排除程式碼區塊、表格、清單等特殊容器內的圖片) */ +.is-mobile .ge-note-content img:not(pre *, code *, [class*="block-language-"] *, .callout *, table *, ul *, ol *, blockquote *), +.is-mobile .ge-note-content .internal-embed:has(img):not(pre *, code *, [class*="block-language-"] *, .callout *, table *, ul *, ol *, blockquote *) { + width: 100cqw; + max-width: 100cqw; + margin-left: calc(50% - 50cqw); + display: block; +} + +.is-mobile .ge-note-content .internal-embed:has(img):not(pre *, code *, [class*="block-language-"] *, .callout *, table *, ul *, ol *, blockquote *) img { + width: 100%; + max-width: 100%; + margin-left: 0; +} + .ge-note-content h1, .ge-note-content h2, .ge-note-content h3,