diff --git a/manifest.json b/manifest.json index 1b89186..c1430db 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/package-lock.json b/package-lock.json index 2b90044..9ab4c17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 277fe96..8c8d5cd 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/fullscreen.ts b/src/fullscreen.ts index 1738872..167a9e7 100644 --- a/src/fullscreen.ts +++ b/src/fullscreen.ts @@ -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; diff --git a/src/galleryBlockGenerate.ts b/src/galleryBlockGenerate.ts index 2edb777..49ba39c 100644 --- a/src/galleryBlockGenerate.ts +++ b/src/galleryBlockGenerate.ts @@ -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 區塊內容 diff --git a/src/main.ts b/src/main.ts index 4bcc8a6..2dc8f99 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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(); diff --git a/tsconfig.json b/tsconfig.json index 5a006cd..ea8d7ea 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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": [ diff --git a/versions.json b/versions.json index 661ffcd..36e08af 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "2.0.10": "1.1.0" + "2.0.11": "1.1.0" } \ No newline at end of file