queryContext

An app state of query context which represents currently used query for showing the content of the note list. You can obtain the queryContext state and integrate it with React components.


Data Structure

  • Name
    mode
    Type
    string
    Description

    The query mode which takes one of "all", "book", "tag", "status", "trash", and "search".

    Following sections describe data structure for each mode.

    "all": All Notes

    • Name
      filterKeyword
      Type
      string
      Description

      A filter keyword to filter note list items.

    "book": Show notes in a notebook

    • Name
      bookId
      Type
      string
      Description

      A notebook ID to query.

    • Name
      tagId
      Type
      string
      Description

      A tag ID to filter.

    • Name
      status
      Type
      string
      Description

      A status to filter.

    • Name
      filterKeyword
      Type
      string
      Description

      A filter keyword to filter note list items.

    • Name
      includeChildren
      Type
      boolean
      Description

      Whether to include notes in child notebooks.

    "tag": Show notes with a tag

    • Name
      tagId
      Type
      string
      Description

      A tag ID to query.

    • Name
      filterKeyword
      Type
      string
      Description

      A filter keyword to filter note list items.

    "status": Show notes with a status

    • Name
      status
      Type
      string
      Description

      A status to query.

    • Name
      filterKeyword
      Type
      string
      Description

      A filter keyword to filter note list items.

    "trash": Show notes in trash

    • Name
      bookId
      Type
      string
      Description

      The trash notebook ID.

    "search": Show notes that match keywords and conditions

    • Name
      searchKeyword
      Type
      string
      Description

      The search keyword to query.

Get the queryContext state manually:

const { queryContext } = inkdrop.store.getState()

Connect the state with your React component:

import { useSelector } from 'react-redux'
const selector = ({ queryContext }) => queryContext
const MyComponent = props => {
  const queryContext = useSelector(selector)
  // render
}

An example state for "book" mode:

{
  "mode": "book",
  "filterKeyword": "",
  "bookId": "book:uP2kEsahM",
  "includeChildren": false
}
Can you help us improve the docs? 🙏

The source of these docs is here on GitHub. If you see a way these docs can be improved, please fork us!