siyuan 0.8.9 → 0.9.1

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,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
- ## 0.9.0 2023-12
3
+ ## 0.9.2 2024-01
4
+
5
+
6
+ ## 0.9.1 2023-12-26
7
+
8
+ * [Set `plugin.name` to read-only](https://github.com/siyuan-note/siyuan/issues/9943)
9
+ * [Support `Dock Plugin` and `Command Palette` on mobile](https://github.com/siyuan-note/siyuan/issues/9926)
10
+
11
+ ## 0.9.0 2023-12-05
12
+
13
+ * [Add plugin eventbus `sync-start`, `sync-end`, and `sync-fail`](https://github.com/siyuan-note/siyuan/issues/9798)
14
+ * [Add plugin event bus `mobile-keyboard-show` and `mobile-keyboard-hide`](https://github.com/siyuan-note/siyuan/issues/9773)
15
+ * [Add some `Protyle` methods to the plugin API](https://github.com/siyuan-note/petal/issues/21)
4
16
 
5
17
  ## 0.8.9 2023-11-28
6
18
 
@@ -78,49 +90,62 @@
78
90
  * [Add ICommand.langText and change the type of i18n](https://github.com/siyuan-note/petal/pull/11)
79
91
 
80
92
  ## v0.7.4 2023-06-13
93
+
81
94
  1. [Add `beforeDestroy`](https://github.com/siyuan-note/siyuan/issues/8467)
82
95
 
83
96
  ## v0.7.2
97
+
84
98
  1. 更换为 SiYuan 官方 API
85
99
 
86
100
  ## v0.7.0
101
+
87
102
  1. 添加版本自动判断
88
103
  2. 添加插件系统内置配置页面支持插件注入
89
104
  3. 修复export classes
90
105
 
91
106
  ## v0.5.0
107
+
92
108
  1. 插件系统国际化
93
109
  2. 插件支持卸载
94
110
  3. 插件商店预览功能
95
111
 
96
112
  ## v0.4.0
113
+
97
114
  1. 插件系统已支持浏览器使用,需思源2.8.1及以上版本。 **注意:大量插件目前对web的支持并不好,需要等待插件开发者进行适配。建议还是在桌面端使用。**
98
115
  2. 升级过程中将原版代码挂件loader迁移到挂件版路径,但不会下载挂件。
99
116
  3. 挂件版用户记得更新到最新版本挂件
100
117
 
101
118
  ## v0.3.21
119
+
102
120
  + 挂件版本不进行自动升级,即使勾选了自动升级功能
103
121
 
104
122
  ## v0.3.20
123
+
105
124
  + 新增功能:命令面板
106
125
  + 重构:修改vite构建脚本,移除dist
107
126
 
108
127
  ## v0.3.19
128
+
109
129
  + 修改图标
110
130
  + eslint重构代码
111
131
 
112
132
  ## v0.3.13
133
+
113
134
  + 增加插件商店,并可配置插件商店地址
114
135
  + 暴露PluginSystem及Ioc容器到window对象
115
136
 
116
137
  ## v0.3.12
138
+
117
139
  + 重构API接口,支持自动化导出api类型声明
118
140
 
119
141
  ## v0.3.11
142
+
120
143
  + 增加通过Plugin继承调用registerCommand,实现插件快捷键注册。未来将通过此方式开发命令面板。
121
144
 
122
145
  ## v0.3.10
146
+
123
147
  + 修复没有plugins时初次安装遇到的问题
124
148
 
125
149
  ## v0.3.9
150
+
126
151
  + 适配思源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.9",
15
+ "version": "0.9.1",
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,7 +429,7 @@ export function openWindow(options: {
418
429
  },
419
430
  }): void;
420
431
 
421
- export function openMobileFileById(app: App, id: string, action: string[]): void;
432
+ export function openMobileFileById(app: App, id: string, action?: string[]): void;
422
433
 
423
434
  export function openTab(options: {
424
435
  app: App,
@@ -477,7 +488,7 @@ export abstract class Plugin {
477
488
  i18n: I18N;
478
489
  data: any;
479
490
  displayName: string;
480
- name: string;
491
+ readonly name: string;
481
492
  app: App;
482
493
  commands: ICommandOption[];
483
494
  setting: Setting;
@@ -555,7 +566,7 @@ export abstract class Plugin {
555
566
  destroy?: (this: IDockModel) => void,
556
567
  resize?: (this: IDockModel) => void,
557
568
  update?: (this: IDockModel) => void,
558
- init: (this: IDockModel) => void,
569
+ init: (this: IDockModel, dock: IDockModel) => void,
559
570
  }): { config: IPluginDockTab, model: IDockModel };
560
571
 
561
572
  addCommand(options: ICommandOption): void;
@@ -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 {