update at 2025-10-08 17:06:31

This commit is contained in:
douboer
2025-10-08 17:06:31 +08:00
parent cbf32b3f0b
commit 1c8449b04a
11 changed files with 113 additions and 901 deletions

View File

@@ -1,17 +1,15 @@
/* 文件xiaohongshu/xhs-preview.ts — 小红书预览视图组件:顶部工具栏、分页导航、底部切图按钮。 */
/* 文件xiaohongshu/preview-view.ts — 小红书预览视图组件:顶部工具栏、分页导航、底部切图按钮。 */
import { Notice, TFile } from 'obsidian';
import { NMPSettings } from '../settings';
import AssetsManager from '../assets';
import { paginateArticle, renderPage, PageInfo } from './paginator';
import { sliceCurrentPage, sliceAllPages } from './slice';
import { PlatformChooser } from '../platform-chooser';
import { Platform, IPlatformPreview } from '../types';
/**
*
*/
export class XiaohongshuPreviewView implements IPlatformPreview {
export class XiaohongshuPreviewView {
container: HTMLElement;
settings: NMPSettings;
assetsManager: AssetsManager;
@@ -39,7 +37,7 @@ export class XiaohongshuPreviewView implements IPlatformPreview {
// 回调函数
onRefreshCallback?: () => Promise<void>;
onPublishCallback?: () => Promise<void>;
onPlatformChangeCallback?: (platform: Platform) => Promise<void>;
onPlatformChangeCallback?: (platform: string) => Promise<void>;
constructor(container: HTMLElement, app: any) {
this.container = container;
@@ -414,37 +412,4 @@ export class XiaohongshuPreviewView implements IPlatformPreview {
new Notice('❌ 批量切图失败: ' + error.message);
}
}
/**
* IPlatformPreview
*/
public show(): void {
if (this.container) {
this.container.style.display = 'flex';
}
}
/**
* IPlatformPreview
*/
public hide(): void {
if (this.container) {
this.container.style.display = 'none';
}
}
/**
* IPlatformPreview
*/
public cleanup(): void {
// 清理回调
this.onRefreshCallback = undefined;
this.onPublishCallback = undefined;
this.onPlatformChangeCallback = undefined;
// 清理数据
this.pages = [];
this.currentFile = null;
this.articleHTML = '';
}
}