Skip to content

Commit 45b6031

Browse files
committed
perf: 调整打开 siyuan://plugins 链接事件的名称 | Adjust the name of the event to open the siyuan://plugins link.
REF: siyuan-note/siyuan#8927
1 parent ca44743 commit 45b6031

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 2023-08-15
44

55
- 实现 `wakatime` 插件基础功能 | Implement the basic functions of the `wakatime` plugin.
6+
- 调整打开 `siyuan://plugins` 链接事件的名称 | Adjust the name of the event to open the `siyuan://plugins` link.
67

78
## 2023-08-14
89

workspace/packages/types/siyuan/events.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ export interface IOpenSiyuanUrlDetail {
5959
url: string;
6060
}
6161

62-
export interface IOpenSiyuanUrlBlocksDetail extends IOpenSiyuanUrlDetail {
62+
export interface IOpenSiyuanUrlBlockDetail extends IOpenSiyuanUrlDetail {
6363
id: string;
6464
focus: boolean;
6565
exist: boolean;
6666
}
6767

68-
export interface IOpenSiyuanUrlPluginsDetail extends IOpenSiyuanUrlDetail {
68+
export interface IOpenSiyuanUrlPluginDetail extends IOpenSiyuanUrlDetail {
6969
}
7070

7171
export interface ILoadedProtyleDetail extends IProtyle {
@@ -99,12 +99,12 @@ export interface IOpenSiyuanUrlEvent extends CustomEvent<IOpenSiyuanUrlDetail> {
9999
type: "open-siyuan-url";
100100
}
101101

102-
export interface IOpenSiyuanUrlBlocksEvent extends CustomEvent<IOpenSiyuanUrlBlocksDetail> {
103-
type: "open-siyuan-url-blocks";
102+
export interface IOpenSiyuanUrlBlockEvent extends CustomEvent<IOpenSiyuanUrlBlockDetail> {
103+
type: "open-siyuan-url-block";
104104
}
105105

106-
export interface IOpenSiyuanUrlPluginsEvent extends CustomEvent<IOpenSiyuanUrlPluginsDetail> {
107-
type: "open-siyuan-url-plugins";
106+
export interface IOpenSiyuanUrlPluginEvent extends CustomEvent<IOpenSiyuanUrlPluginDetail> {
107+
type: "open-siyuan-url-plugin";
108108
}
109109

110110
export interface ILoadedProtyleEvent extends CustomEvent<ILoadedProtyleDetail> {

workspace/plugins/monaco-editor/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import { EditorWindow } from "./editor/window";
6262
import { HandlerType, type IFacadeOptions } from "./facades/facade";
6363

6464
/* 类型 */
65-
import type { IClickBlockIconEvent, IClickEditorContentEvent, IOpenMenuLinkEvent, IOpenSiyuanUrlPluginsEvent } from "@workspace/types/siyuan/events";
65+
import type { IClickBlockIconEvent, IClickEditorContentEvent, IOpenMenuLinkEvent, IOpenSiyuanUrlPluginEvent } from "@workspace/types/siyuan/events";
6666
import type { BlockID } from "@workspace/types/siyuan";
6767

6868
import type {
@@ -290,7 +290,7 @@ export default class MonacoEditorPlugin extends siyuan.Plugin {
290290
this.eventBus.on("open-menu-link", this.linkMenuEventListener);
291291

292292
/* 思源 URL */
293-
this.eventBus.on("open-siyuan-url-plugins", this.openSiyuanUrlEventListener);
293+
this.eventBus.on("open-siyuan-url-plugin", this.openSiyuanUrlEventListener);
294294

295295
// /* 快捷键/命令 */
296296
// this.addCommand({
@@ -332,7 +332,7 @@ export default class MonacoEditorPlugin extends siyuan.Plugin {
332332
this.eventBus.off("click-editortitleicon", this.blockMenuEventListener);
333333
// this.eventBus.off("open-menu-blockref", this.blockRefMenuEventListener);
334334
this.eventBus.off("open-menu-link", this.linkMenuEventListener);
335-
this.eventBus.off("open-siyuan-url-plugins", this.openSiyuanUrlEventListener);
335+
this.eventBus.off("open-siyuan-url-plugin", this.openSiyuanUrlEventListener);
336336
}
337337

338338
openSetting(): void {
@@ -907,7 +907,7 @@ export default class MonacoEditorPlugin extends siyuan.Plugin {
907907
}
908908

909909
/* 思源 URL 打开事件监听器 */
910-
protected readonly openSiyuanUrlEventListener = async (e: IOpenSiyuanUrlPluginsEvent) => {
910+
protected readonly openSiyuanUrlEventListener = async (e: IOpenSiyuanUrlPluginEvent) => {
911911
// this.logger.debug(e);
912912
const url = new URL(e.detail.url);
913913
if (url.pathname.startsWith(`//plugins/${this.name}/workspace/`)) {

0 commit comments

Comments
 (0)