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>

Add a bookmark node.

Type declaration

    • (doc: DocType, title: string): Promise<null | BookmarkType>
    • Parameters

      • doc: DocType

        The document.

      • title: string

        The title of the bookmark.

      Returns Promise<null | BookmarkType>

      • The bookmark node.
deleteBookmark: (doc: DocType, bookmark: BookmarkType) => Promise<boolean>

Delete a bookmark node.

Type declaration

    • (doc: DocType, bookmark: BookmarkType): Promise<boolean>
    • Parameters

      Returns Promise<boolean>

      • Whether the operation is successful.
insertBookmark: (
    doc: DocType,
    title: string,
    left: null | BookmarkType,
    parent: null | BookmarkType,
) => Promise<null | BookmarkType>

Insert a bookmark node. left and parent are optional.

  • If left is empty and the parent node is not empty, the bookmark will be inserted into the first child node of the parent node.
  • If parent is empty and left is not empty, the bookmark is inserted before the left node.
  • If left and parent are both empty, the bookmark is inserted into the first child node under the root node.
  • If both left and parent are not empty, then left has the highest priority, parent is invalid, and the bookmark is inserted before the left node.

Type declaration

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

move a bookmark node.

  • If left is empty and the parent node is not empty, the bookmark will move to the first child node of the parent node.
  • If parent is empty and left is not empty, the bookmark moves to the front of the left node. -- If both left and parent are empty, the bookmark moves to the first child node under the root node.
  • If both left and parent are not empty, then left has the highest priority, parent is invalid, and the bookmark is moved to the front of the left node.

Type declaration

options: Options