Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Workspace

Represents a Workspace. Can be used to inquire and load workspaces and apply them using methods on the App object.

Example: Find and Load Workspace

// find workspace and load it in drafts list
let workspace = Workspace.find("Projects");
app.applyWorkspace(workspace);

Hierarchy

  • Workspace

Index

Constructors

constructor

Display Properties

archiveIncludesFlagged

archiveIncludesFlagged: boolean

Should flagged drafts be included in archive.

inboxIncludesFlagged

inboxIncludesFlagged: boolean

Should flagged drafts be included in inbox.

Optional loadActionBarGroup

loadActionBarGroup: ActionGroup

Action group to load in Action Bar when applying the workspace.

Optional loadActionListGroup

loadActionListGroup: ActionGroup

Action group to load in action list when applying the workspace.

Optional loadFolder

loadFolder: draftFolderTab

Folder tab to select when applying the workspace.

Optional preferredDarkTheme

preferredDarkTheme: Theme

Preferred dark theme to load when applying the workspace.

Optional preferredLightTheme

preferredLightTheme: Theme

Preferred light theme to load when applying the workspace.

showDate

showDate: boolean

Show date information in list.

showLastAction

showLastAction: boolean

Show last logged action for draft in list.

showPreview

showPreview: boolean

Show preview of draft body in list.

showTags

showTags: boolean

Show draft tags in list.

Filter Properties

endDate

endDate: QueryDate

A QueryDate specifying a date which all drafts in the workspace must be less than or equal to.

queryString

queryString: string

Search string to filter results.

startDate

startDate: QueryDate

A QueryDate specifying a date which all drafts in the workspace must be greater than or equal to.

tagFilter

tagFilter: string

Comma-delimited list tag string like "blue, !green" using "!" to omit a tag.

tagFilterRequireAll

tagFilterRequireAll: boolean

If true, all (AND) tags in the tag filter must match, if false match any of the tags (OR)

Identification Properties

Readonly installURL

installURL: string

URL which can be used to install this Workspace in another installation of Drafts. Useful for sharing and backups.

name

name: string

The name of the workspace.

Other Methods

query

  • query(filter: "inbox" | "archive" | "flagged" | "trash" | "all"): Draft[]
  • Query for a list of drafts contained in the workspace.

    Parameters

    • filter: "inbox" | "archive" | "flagged" | "trash" | "all"

    Returns Draft[]

update

  • update(): void
  • Save changes made to the workspace to the database. This must be called to save changes.

    Returns void

Static create

  • create a new workspace object. This is an in-memory object only, unless update() is called to save the it. The initial state of the workspace properties is based on the configuration of the user's default workspace.

    Returns Workspace

Static find

  • Search for workspace matching the name passed and return it if found. Returns undefined if not found.

    Parameters

    • name: string

    Returns Workspace | undefined

Static getAll

Sort Methods

setAllSort

  • setAllSort(sortBy: sortBy, sortDescending: boolean, sortFlaggedToTop: boolean): void
  • Set sort order for "all" drafts folder.

    Parameters

    • sortBy: sortBy
    • sortDescending: boolean
    • sortFlaggedToTop: boolean

    Returns void

setArchiveSort

  • setArchiveSort(sortBy: sortBy, sortDescending: boolean, sortFlaggedToTop: boolean): void
  • Set sort order for archive.

    Parameters

    • sortBy: sortBy
    • sortDescending: boolean
    • sortFlaggedToTop: boolean

    Returns void

setFlaggedSort

  • setFlaggedSort(sortBy: sortBy, sortDescending: boolean): void
  • Set sort order for flagged.

    Parameters

    • sortBy: sortBy
    • sortDescending: boolean

    Returns void

setInboxSort

  • setInboxSort(sortBy: sortBy, sortDescending: boolean, sortFlaggedToTop: boolean): void
  • Set sort order for inbox.

    Parameters

    • sortBy: sortBy
    • sortDescending: boolean
    • sortFlaggedToTop: boolean

    Returns void

Generated using TypeDoc