Skip to content

Commit d4dd082

Browse files
committed
彻底解决右键菜单重复的问题
1 parent 3b8eeac commit d4dd082

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "custom-image-auto-uploader",
33
"name": "Custom Image Auto Uploader",
4-
"version": "2.9.4",
4+
"version": "2.9.5",
55
"minAppVersion": "1.6.5",
66
"description": "You can batch download images from your notes on desktop, iOS, and Android platforms, and batch upload and save them to a remote server, home NAS, or cloud storage (such as Alibaba Cloud OSS, Amazon S3, Cloudflare R2, MinIO). Additionally, you can stretch, crop, and resize the images.",
77
"author": "HaierKeys",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Custom Image Auto Uploader",
3-
"version": "2.9.4",
3+
"version": "2.9.5",
44
"description": "You can upload and save images from your notes to your remote server, home NAS, or sync them to your cloud storage (Alibaba Cloud OSS, Amazon S3, Cloudflare R2).",
55
"main": "main.js",
66
"scripts": {

src/lib/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ export function statusCheck(plugin: CustomImageAutoUploader): void {
482482
}
483483

484484
export function setMenu(menu: Menu, plugin: CustomImageAutoUploader, isShowAuto: boolean = false, isNoteMenu: boolean = false) {
485+
if ((menu as any)._hasImageUploaderMenu) return
486+
(menu as any)._hasImageUploaderMenu = true
487+
485488
if (isShowAuto) {
486489

487490
//ddddd

src/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ export default class CustomImageAutoUploader extends Plugin {
120120
setMenu(menu, this, true, true)
121121
})
122122
)
123-
// this.registerEvent(
124-
// this.app.workspace.on("editor-menu", (menu: Menu) => {
125-
// setMenu(menu, this)
126-
// })
127-
// )
123+
this.registerEvent(
124+
this.app.workspace.on("editor-menu", (menu: Menu) => {
125+
setMenu(menu, this, true, true)
126+
})
127+
)
128128

129129
this.addRibbonIcon("image", "Custom Image Auto Uploader", (event) => {
130130
const menu = new Menu()

0 commit comments

Comments
 (0)