siyuan 0.8.8 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## 0.8.9 2023-11
3
+ ## 0.9.1 2023-12
4
4
 
5
+ ## 0.9.0 2023-12-05
6
+
7
+ * [Add plugin eventbus `sync-start`, `sync-end`, and `sync-fail`](https://github.com/siyuan-note/siyuan/issues/9798)
8
+ * [Add plugin event bus `mobile-keyboard-show` and `mobile-keyboard-hide`](https://github.com/siyuan-note/siyuan/issues/9773)
9
+ * [Add some `Protyle` methods to the plugin API](https://github.com/siyuan-note/petal/issues/21)
10
+
11
+ ## 0.8.9 2023-11-28
12
+
13
+ * [Add plugin method `openMobileFileById`](https://github.com/siyuan-note/siyuan/issues/9738)
14
+ * [Update openTab return value](https://github.com/siyuan-note/petal/pull/20/files)
5
15
 
6
16
  ## 0.8.8 2023-10-31
7
17
 
@@ -74,49 +84,62 @@
74
84
  * [Add ICommand.langText and change the type of i18n](https://github.com/siyuan-note/petal/pull/11)
75
85
 
76
86
  ## v0.7.4 2023-06-13
87
+
77
88
  1. [Add `beforeDestroy`](https://github.com/siyuan-note/siyuan/issues/8467)
78
89
 
79
90
  ## v0.7.2
91
+
80
92
  1. 更换为 SiYuan 官方 API
81
93
 
82
94
  ## v0.7.0
95
+
83
96
  1. 添加版本自动判断
84
97
  2. 添加插件系统内置配置页面支持插件注入
85
98
  3. 修复export classes
86
99
 
87
100
  ## v0.5.0
101
+
88
102
  1. 插件系统国际化
89
103
  2. 插件支持卸载
90
104
  3. 插件商店预览功能
91
105
 
92
106
  ## v0.4.0
107
+
93
108
  1. 插件系统已支持浏览器使用,需思源2.8.1及以上版本。 **注意:大量插件目前对web的支持并不好,需要等待插件开发者进行适配。建议还是在桌面端使用。**
94
109
  2. 升级过程中将原版代码挂件loader迁移到挂件版路径,但不会下载挂件。
95
110
  3. 挂件版用户记得更新到最新版本挂件
96
111
 
97
112
  ## v0.3.21
113
+
98
114
  + 挂件版本不进行自动升级,即使勾选了自动升级功能
99
115
 
100
116
  ## v0.3.20
117
+
101
118
  + 新增功能:命令面板
102
119
  + 重构:修改vite构建脚本,移除dist
103
120
 
104
121
  ## v0.3.19
122
+
105
123
  + 修改图标
106
124
  + eslint重构代码
107
125
 
108
126
  ## v0.3.13
127
+
109
128
  + 增加插件商店,并可配置插件商店地址
110
129
  + 暴露PluginSystem及Ioc容器到window对象
111
130
 
112
131
  ## v0.3.12
132
+
113
133
  + 重构API接口,支持自动化导出api类型声明
114
134
 
115
135
  ## v0.3.11
136
+
116
137
  + 增加通过Plugin继承调用registerCommand,实现插件快捷键注册。未来将通过此方式开发命令面板。
117
138
 
118
139
  ## v0.3.10
140
+
119
141
  + 修复没有plugins时初次安装遇到的问题
120
142
 
121
143
  ## v0.3.9
144
+
122
145
  + 适配思源2.7.7,调整配置界面布局
package/package.json CHANGED
@@ -12,6 +12,6 @@
12
12
  "README.md",
13
13
  "siyuan.d.ts"
14
14
  ],
15
- "version": "0.8.8",
15
+ "version": "0.9.0",
16
16
  "repository": "https://github.com/siyuan-note/petal"
17
17
  }
package/siyuan.d.ts CHANGED
@@ -11,6 +11,12 @@ declare global {
11
11
 
12
12
  export type TEventBus = keyof IEventBusMap
13
13
 
14
+ export type TTurnIntoOne = "BlocksMergeSuperBlock" | "Blocks2ULs" | "Blocks2OLs" | "Blocks2TLs" | "Blocks2Blockquote"
15
+
16
+ export type TTurnIntoOneSub = "row" | "col"
17
+
18
+ export type TTurnInto = "Blocks2Ps" | "Blocks2Hs"
19
+
14
20
  export type TCardType = "doc" | "notebook" | "all"
15
21
 
16
22
  export type TProtyleAction = "cb-get-append" | // 向下滚动加载
@@ -185,6 +191,11 @@ export interface IEventBusMap {
185
191
  files: FileList | DataTransferItemList;
186
192
  }
187
193
  "ws-main": IWebSocketData;
194
+ "sync-start": IWebSocketData;
195
+ "sync-end": IWebSocketData;
196
+ "sync-fail": IWebSocketData;
197
+ "mobile-keyboard-show": void;
198
+ "mobile-keyboard-hide": void;
188
199
  }
189
200
 
190
201
  export interface IPosition {
@@ -418,6 +429,8 @@ export function openWindow(options: {
418
429
  },
419
430
  }): void;
420
431
 
432
+ export function openMobileFileById(app: App, id: string, action?: string[]): void;
433
+
421
434
  export function openTab(options: {
422
435
  app: App,
423
436
  doc?: {
@@ -449,7 +462,7 @@ export function openTab(options: {
449
462
  keepCursor?: boolean; // 是否跳转到新 tab 上
450
463
  removeCurrentTab?: boolean; // 在当前页签打开时需移除原有页签
451
464
  afterOpen?: () => void; // 打开后回调
452
- }): ITab
465
+ }): Promise<ITab>
453
466
 
454
467
  export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
455
468
 
@@ -1,4 +1,13 @@
1
- import {App, ILuteNode, IObject, IOperation, IPosition, IProtyleOption} from "./../siyuan";
1
+ import {
2
+ App,
3
+ ILuteNode,
4
+ IObject,
5
+ IOperation,
6
+ IPosition,
7
+ IProtyleOption, TTurnInto,
8
+ TTurnIntoOne,
9
+ TTurnIntoOneSub
10
+ } from "./../siyuan";
2
11
 
3
12
  // REF: https://github.com/siyuan-note/siyuan/blob/dev/app/src/types/protyle.d.ts
4
13
  export interface IProtyle {
@@ -74,6 +83,33 @@ export class Protyle {
74
83
  insert(html: string, isBlock?: boolean, useProtyleRange?: boolean): void
75
84
 
76
85
  transaction(doOperations: IOperation[], undoOperations?: IOperation[]): void;
86
+
87
+ /**
88
+ * 多个块转换为一个块
89
+ * @param {TTurnIntoOneSub} [subType] type 为 "BlocksMergeSuperBlock" 时必传
90
+ */
91
+ public turnIntoOneTransaction(selectsElement: Element[], type: TTurnIntoOne, subType?: TTurnIntoOneSub): void
92
+
93
+ /**
94
+ * 多个块转换
95
+ * @param {Element} [nodeElement] 优先使用包含 protyle-wysiwyg--select 的块,否则使用 nodeElement 单块
96
+ * @param type
97
+ * @param {number} [subType] type 为 "Blocks2Hs" 时必传
98
+ */
99
+ public turnIntoTransaction(nodeElement: Element, type: TTurnInto, subType?: number): void
100
+
101
+ public updateTransaction(id: string, newHTML: string, html: string): void
102
+
103
+ public updateBatchTransaction(nodeElements: Element[], cb: (e: HTMLElement) => void): void
104
+
105
+ public getRange(element: Element): Range
106
+
107
+ public hasClosestBlock(element: Node): false | HTMLElement
108
+
109
+ /**
110
+ * @param {boolean} [toStart=true]
111
+ */
112
+ public focusBlock(element: Element, toStart?: boolean): false | Range
77
113
  }
78
114
 
79
115
  export class Toolbar {