siyuan 0.7.4 → 0.7.5

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,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.7.5
4
+
5
+ * [Add protyleSlash to the plugin](https://github.com/siyuan-note/siyuan/issues/8599)
6
+ * [Add plugin API protyle ](https://github.com/siyuan-note/siyuan/issues/8445)
7
+ * [Add ICommand.langText and change the type of i18n](https://github.com/siyuan-note/petal/pull/11)
8
+
3
9
  ## v0.7.4 2023-06-13
4
10
  1. [Add `beforeDestroy`](https://github.com/siyuan-note/siyuan/issues/8467)
5
11
 
package/package.json CHANGED
@@ -2,6 +2,6 @@
2
2
  "name": "siyuan",
3
3
  "contributors": ["zuoez02", "Vanessa"],
4
4
  "types": "siyuan.d.ts",
5
- "version": "0.7.4",
5
+ "version": "0.7.5",
6
6
  "repository": "https://github.com/siyuan-note/petal"
7
7
  }
package/siyuan.d.ts CHANGED
@@ -35,6 +35,10 @@ interface IObject {
35
35
  [key: string]: string;
36
36
  }
37
37
 
38
+ interface I18N {
39
+ [key: string]: any;
40
+ }
41
+
38
42
  interface ILuteNode {
39
43
  TokensStr: () => string;
40
44
  __internal_object__: {
@@ -107,7 +111,8 @@ interface IMenuItemOption {
107
111
  }
108
112
 
109
113
  interface ICommandOption {
110
- langKey: string, // 多语言 key
114
+ langKey: string, // 用于区分不同快捷键的 key
115
+ langText?: string, // 快捷键功能描述文本
111
116
  /**
112
117
  * 目前需使用 MacOS 符号标识,顺序按照 ⌥⇧⌘,入 ⌥⇧⌘A
113
118
  * "Ctrl": "⌘",
@@ -126,6 +131,35 @@ interface ICommandOption {
126
131
  dockCallback?: (element: HTMLElement) => void
127
132
  }
128
133
 
134
+ interface IProtyleOption {
135
+ action?: string[],
136
+ mode?: "preview" | "wysiwyg",
137
+ blockId: string
138
+ key?: string
139
+ scrollAttr?: {
140
+ rootId: string,
141
+ startId: string,
142
+ endId: string
143
+ scrollTop: number,
144
+ focusId?: string,
145
+ focusStart?: number
146
+ focusEnd?: number
147
+ zoomInId?: string
148
+ }
149
+ defId?: string
150
+ render?: {
151
+ background?: boolean
152
+ title?: boolean
153
+ gutter?: boolean
154
+ scroll?: boolean
155
+ breadcrumb?: boolean
156
+ breadcrumbDocName?: boolean
157
+ }
158
+ typewriterMode?: boolean;
159
+
160
+ after?(protyle: Protyle): void;
161
+ }
162
+
129
163
  export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
130
164
 
131
165
  export function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;
@@ -185,17 +219,23 @@ export class App {
185
219
 
186
220
  export abstract class Plugin {
187
221
  eventBus: EventBus;
188
- i18n: IObject;
222
+ i18n: I18N;
189
223
  data: any;
190
224
  name: string;
191
225
  app: App;
192
226
  commands: ICommandOption[];
193
227
  setting: Setting;
228
+ protyleSlash: {
229
+ filter: string[],
230
+ html: string,
231
+ id: string
232
+ callback(protyle: Protyle): void
233
+ }[];
194
234
 
195
235
  constructor(options: {
196
236
  app: App,
197
237
  name: string,
198
- i18n: IObject
238
+ i18n: I18N
199
239
  })
200
240
 
201
241
  onload(): void;
@@ -271,6 +311,24 @@ export abstract class Plugin {
271
311
  }): void
272
312
  }
273
313
 
314
+ export class Protyle {
315
+ constructor(app: App, element: HTMLElement, options?: IProtyleOption)
316
+
317
+ isUploading(): boolean
318
+
319
+ destroy(): void
320
+
321
+ resize(): void
322
+
323
+ reload(focus: boolean): void
324
+
325
+ /**
326
+ * @param {boolean} [isBlock=false]
327
+ * @param {boolean} [useProtyleRange=false]
328
+ */
329
+ insert(html: string, isBlock?: boolean, useProtyleRange?: boolean): void
330
+ }
331
+
274
332
  export class Setting {
275
333
  constructor(options: {
276
334
  height?: string,