1
1
import type * as types from "./types" ;
2
+ import { IProtyle } from "./types/protyle" ;
2
3
3
4
declare global {
4
- interface Window extends Global { }
5
+ interface Window extends Global {
6
+ }
5
7
}
6
8
7
9
type TEventBus = keyof IEventBusMap
@@ -23,6 +25,51 @@ type TProtyleAction = "cb-get-append" | // 向下滚动加载
23
25
"cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
24
26
"cb-get-history" // 历史渲染
25
27
28
+ type TOperation =
29
+ "insert"
30
+ | "update"
31
+ | "delete"
32
+ | "move"
33
+ | "foldHeading"
34
+ | "unfoldHeading"
35
+ | "setAttrs"
36
+ | "updateAttrs"
37
+ | "append"
38
+ | "insertAttrViewBlock"
39
+ | "removeAttrViewBlock"
40
+ | "addAttrViewCol"
41
+ | "removeAttrViewCol"
42
+ | "addFlashcards"
43
+ | "removeFlashcards"
44
+ | "updateAttrViewCell"
45
+ | "updateAttrViewCol"
46
+ | "sortAttrViewRow"
47
+ | "sortAttrViewCol"
48
+ | "setAttrViewColHidden"
49
+ | "setAttrViewColWrap"
50
+ | "setAttrViewColWidth"
51
+ | "updateAttrViewColOptions"
52
+ | "removeAttrViewColOption"
53
+ | "updateAttrViewColOption"
54
+ | "setAttrViewName"
55
+ | "setAttrViewFilters"
56
+ | "setAttrViewSorts"
57
+ | "setAttrViewColCalc"
58
+ | "updateAttrViewColNumberFormat"
59
+
60
+ type TAVCol =
61
+ "text"
62
+ | "date"
63
+ | "number"
64
+ | "relation"
65
+ | "rollup"
66
+ | "select"
67
+ | "block"
68
+ | "mSelect"
69
+ | "url"
70
+ | "email"
71
+ | "phone"
72
+
26
73
interface Global {
27
74
Lute : Lute ;
28
75
}
@@ -227,6 +274,25 @@ interface IProtyleOption {
227
274
after ?( protyle : Protyle ) : void ;
228
275
}
229
276
277
+ interface IOperation {
278
+ action : TOperation , // move, delete 不需要传 data
279
+ id ?: string ,
280
+ avID ?: string , // av
281
+ format ?: string // updateAttrViewColNumberFormat 专享
282
+ keyID ?: string // updateAttrViewCell 专享
283
+ rowID ?: string // updateAttrViewCell 专享
284
+ data ?: any , // updateAttr 时为 { old: IObject, new: IObject }, updateAttrViewCell 时为 {TAVCol: {content: string}}
285
+ parentID ?: string
286
+ previousID ?: string
287
+ retData ?: any
288
+ nextID ?: string // insert 专享
289
+ srcIDs ?: string [ ] // insertAttrViewBlock 专享
290
+ name ?: string // addAttrViewCol 专享
291
+ type ?: TAVCol // addAttrViewCol 专享
292
+ deckID ?: string // add/removeFlashcards 专享
293
+ blockIDs ?: string [ ] // add/removeFlashcards 专享
294
+ }
295
+
230
296
export function fetchPost ( url : string , data ?: any , callback ?: ( response : IWebSocketData ) => void , headers ?: IObject ) : void ;
231
297
232
298
export function fetchSyncPost ( url : string , data ?: any ) : Promise < IWebSocketData > ;
@@ -293,6 +359,8 @@ export function confirm(title: string, text: string, confirmCallback?: (dialog:
293
359
*/
294
360
export function showMessage ( text : string , timeout ?: number , type ?: "info" | "error" , id ?: string ) : void ;
295
361
362
+ export function transaction ( protyle : IProtyle , doOperations : IOperation [ ] , undoOperations : IOperation [ ] ) : void ;
363
+
296
364
export class App {
297
365
plugins : Plugin [ ] ;
298
366
}
0 commit comments