update at 2025-10-08 09:18:20

This commit is contained in:
douboer
2025-10-08 09:18:20 +08:00
parent a49e389fe2
commit 584d4151fc
67 changed files with 5363 additions and 892 deletions

View File

@@ -1,23 +1,6 @@
/*
* Copyright (c) 2024-2025 Sun Booshi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
/**
* 文件article-render.ts
* 作用:文章渲染与转换辅助。
*/
import { App, ItemView, Workspace, Notice, sanitizeHTMLToDom, apiVersion, TFile, MarkdownRenderer, FrontMatterCache } from 'obsidian';
@@ -522,7 +505,9 @@ export class ArticleRender implements MDRendererCallback {
if (filename.toLowerCase().endsWith('.webp')) {
await PrepareImageLib();
if (IsImageLibReady()) {
data = new Blob([WebpToJPG(await data.arrayBuffer())]);
const jpgUint8 = WebpToJPG(await data.arrayBuffer());
// 使用底层 ArrayBuffer 构造 Blob避免 TypeScript 在某些配置下对 ArrayBufferLike 的严格类型检查报错
data = new Blob([jpgUint8.buffer as ArrayBuffer], { type: 'image/jpeg' });
filename = filename.toLowerCase().replace('.webp', '.jpg');
}
}