Vanessa 2024-10-22 18:13:21 +08:00
parent 20e8b81b8f
commit 5760f7fe4c
11 changed files with 53 additions and 32 deletions

View file

@ -1,7 +1,6 @@
type TPluginDockPosition = "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight"
type TDockPosition = "Left" | "Right" | "Bottom"
type TWS = "main" | "filetree" | "protyle"
type TEditorMode = "preview" | "wysiwyg"
type TOperation =
"insert"
| "update"
@ -428,17 +427,6 @@ interface ISiyuan {
viewer?: Viewer
}
interface IScrollAttr {
rootId: string,
startId: string,
endId: string
scrollTop: number,
focusId?: string,
focusStart?: number
focusEnd?: number
zoomInId?: string
}
interface IOperation {
action: TOperation, // move delete 不需要传 data
id?: string,

View file

@ -16,8 +16,27 @@ type TTurnIntoOneSub = "row" | "col"
type TTurnInto = "Blocks2Ps" | "Blocks2Hs"
type TEditorMode = "preview" | "wysiwyg"
type ILuteRenderCallback = (node: ILuteNode, entering: boolean) => [string, number];
type TProtyleAction = "cb-get-append" | // 向下滚动加载
"cb-get-before" | // 向上滚动加载
"cb-get-unchangeid" | // 上下滚动,定位时不修改 blockid
"cb-get-hl" | // 高亮
"cb-get-focus" | // 光标定位
"cb-get-focusfirst" | // 动态定位到第一个块
"cb-get-setid" | // 重置 blockid
"cb-get-all" | // 获取所有块
"cb-get-backlink" | // 悬浮窗为传递型需展示上下文
"cb-get-unundo" | // 不需要记录历史
"cb-get-scroll" | // 滚动到指定位置,用于直接打开文档,必有 rootID
"cb-get-context" | // 包含上下文
"cb-get-rootscroll" | // 如果为 rootID 就滚动到指定位置,必有 rootID
"cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo否则搜索表格无法定位
"cb-get-history" | // 历史渲染
"cb-get-opennew" // 编辑器只读后新建文件需为临时解锁状态 & https://github.com/siyuan-note/siyuan/issues/12197
/** @link https://ld246.com/article/1588412297062 */
interface ILuteRender {
renderDocument?: ILuteRenderCallback;
@ -313,6 +332,17 @@ interface IUpload {
linkToImgCallback?(responseText: string): void;
}
interface IScrollAttr {
rootId: string,
startId: string,
endId: string
scrollTop: number,
focusId?: string,
focusStart?: number
focusEnd?: number
zoomInId?: string
}
/** @link https://ld246.com/article/1549638745630#options-toolbar */
interface IMenuItem {
/** 唯一标示 */
@ -398,7 +428,7 @@ interface IHint {
}
/** @link https://ld246.com/article/1549638745630#options */
interface IOptions {
interface IProtyleOptions {
history?: {
created?: string
snapshot?: string
@ -408,7 +438,7 @@ interface IOptions {
dom: string
expand: boolean
}[],
action?: string[],
action?: TProtyleAction[],
mode?: TEditorMode,
blockId: string
rootId?: string
@ -484,7 +514,7 @@ interface IProtyle {
title?: import("../protyle/header/Title").Title,
background?: import("../protyle/header/background").Background,
contentElement?: HTMLElement,
options: IOptions;
options: IProtyleOptions;
lute?: Lute;
toolbar?: import("../protyle/toolbar").Toolbar,
preview?: import("../protyle/preview").Preview;