update at 2025-10-08 17:06:31
This commit is contained in:
@@ -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 = '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user