This commit is contained in:
Devon22 2026-04-26 17:38:45 +08:00
parent 1c42a49573
commit 41a7fb48fa
8 changed files with 18 additions and 21 deletions

View file

@ -1,7 +1,7 @@
{
"id": "mediaviewer",
"name": "Media Viewer",
"version": "2.0.10",
"version": "2.0.11",
"minAppVersion": "1.1.0",
"description": "View and manage media files within your notes.",
"author": "Devon22",

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "mediaviewer",
"version": "2.0.10",
"version": "2.0.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mediaviewer",
"version": "2.0.10",
"version": "2.0.11",
"license": "MIT",
"dependencies": {
"@esbuild/linux-x64": "0.17.3",

View file

@ -1,6 +1,6 @@
{
"name": "mediaviewer",
"version": "2.0.10",
"version": "2.0.11",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {

View file

@ -19,10 +19,10 @@ export class FullScreenModal extends Modal {
isZoomed: boolean;
isImage: boolean;
openType: string;
fullMediaView: HTMLDivElement;
fullImage: HTMLImageElement;
fullVideo: HTMLVideoElement;
galleryCloseButton: HTMLButtonElement;
fullMediaView!: HTMLDivElement;
fullImage!: HTMLImageElement;
fullVideo!: HTMLVideoElement;
galleryCloseButton!: HTMLButtonElement;
handleWheel: ((event: WheelEvent) => void) | null;
autoPlayTimer: number | null;
isAutoPlaying: boolean;

View file

@ -13,13 +13,13 @@ export class GalleryBlockGenerateModal extends Modal {
constructor(app: App, selectedText: string) {
super(app);
this.title = '';
this.size = 'medium';
this.addButton = false;
this.pagination = 0;
this.selectedText = this.parseExistingContent(selectedText);
this.replaceRange = null;
this.onConfirm = null;
if (this.title === undefined) this.title = '';
if (this.size === undefined) this.size = 'medium';
if (this.addButton === undefined) this.addButton = false;
if (this.pagination === undefined) this.pagination = 0;
}
// 解析現有的 gallery 區塊內容

View file

@ -6,7 +6,7 @@ import { GalleryBlockGenerateModal } from './galleryBlockGenerate';
import { t } from './translations';
export default class MediaViewPlugin extends Plugin {
settings: MediaViewSettings;
settings!: MediaViewSettings;
async onload() {
await this.loadSettings();
@ -29,7 +29,7 @@ export default class MediaViewPlugin extends Plugin {
name: t('generate_gallery'),
checkCallback: (checking) => {
// 檢查是否有開啟的筆記
const activeView = this.app.workspace.getActiveViewOfType(require('obsidian').MarkdownView);
const activeView = this.app.workspace.getActiveViewOfType(MarkdownView);
if (activeView) {
if (!checking) {
this.generateGallery();
@ -114,7 +114,7 @@ export default class MediaViewPlugin extends Plugin {
}
generateGallery() {
const activeView = this.app.workspace.getActiveViewOfType(require('obsidian').MarkdownView) as MarkdownView;
const activeView = this.app.workspace.getActiveViewOfType(MarkdownView);
if (activeView) {
const editor = activeView.editor;
const selectedText = editor.getSelection();

View file

@ -3,7 +3,7 @@
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES6",
"target": "ES2020",
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "bundler",
@ -12,10 +12,7 @@
"strictNullChecks": true,
"lib": [
"DOM",
"ES5",
"ES6",
"ES7",
"es2018"
"ES2020"
]
},
"include": [

View file

@ -1,3 +1,3 @@
{
"2.0.10": "1.1.0"
"2.0.11": "1.1.0"
}