Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IEditorProxy

Editor related APIs

Hierarchy

  • Record<string, any>
    • IEditorProxy

Index

Properties

onInputSelectionEnd: IUserHook<{ caret: any; end: number; point: { x: number; y: number }; start: number; text: string }, IUserOffHook>

Methods

  • checkEditing(): Promise<string | boolean>
  • createPage(pageName: string, properties?: {}, opts?: Partial<{ createFirstBlock: boolean; format: "markdown" | "org"; journal: boolean; redirect: boolean }>): Promise<PageEntity>
  • Parameters

    • pageName: string
    • Optional properties: {}
      • Optional opts: Partial<{ createFirstBlock: boolean; format: "markdown" | "org"; journal: boolean; redirect: boolean }>

      Returns Promise<PageEntity>

    • deletePage(pageName: string): Promise<void>
    • editBlock(srcBlock: BlockIdentity, opts?: { pos: number }): Promise<void>
    • exitEditingMode(selectBlock?: boolean): Promise<void>
    • getAllPages(repo?: string): Promise<any>
    • getBlockProperty(block: BlockIdentity, key: string): Promise<any>
    • get all blocks of the current page as a tree structure

      example
      const blocks = await logseq.Editor.getCurrentPageBlocksTree()
      initMindMap(blocks)

      Returns Promise<BlockEntity[]>

    • getEditingBlockContent(): Promise<string>
    • getPagesFromNamespace(namespace: string): Promise<PageEntity[]>
    • getPagesTreeFromNamespace(namespace: string): Promise<PageEntity[]>
    • insertAtEditingCursor(content: string): Promise<void>
    • insertBlock(srcBlock: BlockIdentity, content: string, opts?: Partial<{ before: boolean; isPageBlock: boolean; properties: {}; sibling: boolean }>): Promise<BlockEntity>
    • moveBlock(srcBlock: BlockIdentity, targetBlock: BlockIdentity, opts?: Partial<{ before: boolean; children: boolean }>): Promise<void>
    • openInRightSidebar(uuid: string): void
    • register a custom command in the block context menu (triggered by right clicking the block dot)

      Parameters

      • tag: string

        displayed name of command

      • action: BlockCommandCallback

        can be a single callback function to run when the command is called

      Returns unknown

    • removeBlockProperty(block: BlockIdentity, key: string): Promise<void>
    • renamePage(oldName: string, newName: string): Promise<void>
    • restoreEditingCursor(): Promise<void>
    • scrollToBlockInPage(pageName: string, blockId: BlockIdentity, opts?: { replaceState: boolean }): void
    • setBlockCollapsed(uuid: string, opts: boolean | "toggle" | { flag: boolean | "toggle" }): Promise<void>
    • example
       logseq.Editor.setBlockCollapsed('uuid', true)
      logseq.Editor.setBlockCollapsed('uuid', 'toggle')

      Parameters

      • uuid: string
      • opts: boolean | "toggle" | { flag: boolean | "toggle" }

      Returns Promise<void>

    • updateBlock(srcBlock: BlockIdentity, content: string, opts?: Partial<{ properties: {} }>): Promise<void>
    • upsertBlockProperty(block: BlockIdentity, key: string, value: any): Promise<void>

    Generated using TypeDoc