interface BookmarkPanelType {
    addBookmark: (
        doc: DocType,
        title: string,
    ) => Promise<null | BookmarkType>;
    deleteBookmark: (doc: DocType, bookmark: BookmarkType) => Promise<boolean>;
    insertBookmark: (
        doc: DocType,
        title: string,
        left: null | BookmarkType,
        parent: null | BookmarkType,
    ) => Promise<null | BookmarkType>;
    moveBookmark: (
        doc: DocType,
        node: BookmarkType,
        left: null | BookmarkType,
        parent: null | BookmarkType,
    ) => Promise<boolean>;
    options: Options;
}

Implemented by

Properties

addBookmark: (doc: DocType, title: string) => Promise<null | BookmarkType>

添加一个书签节点。

Type declaration

deleteBookmark: (doc: DocType, bookmark: BookmarkType) => Promise<boolean>

删除书签节点。

Type declaration

insertBookmark: (
    doc: DocType,
    title: string,
    left: null | BookmarkType,
    parent: null | BookmarkType,
) => Promise<null | BookmarkType>

插入一个书签节点。left 和 parent 为可选参数。

  • 如果 left 为空且父节点不为空,则书签将被插入到父节点的第一个子节点中。
  • 如果 parent 为空且 left 不为空,则书签将被插入到 left 节点之前。
  • 如果 left 和 parent 都为空,则书签将被插入到根节点下的第一个子节点中。
  • 如果 left 和 parent 都不为空,则以 left 为最高优先级,parent 无效,书签将被插入到 left 节点之前。

Type declaration

moveBookmark: (
    doc: DocType,
    node: BookmarkType,
    left: null | BookmarkType,
    parent: null | BookmarkType,
) => Promise<boolean>

移动一个书签节点。

  • 如果 left 为空且父节点不为空,则书签会移动到父节点的第一个子节点位置。
  • 如果 parent 为空且 left 不为空,则书签会移动到 left 节点之前。 -- 如果 left 和 parent 都为空,则书签会移动到根节点下的第一个子节点位置。
  • 如果 left 和 parent 都不为空,则以 left 为最高优先级,忽略 parent,书签会移动到 left 节点之前。

Type declaration

options: Options