Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface EditorSlice

Hierarchy

  • { activeTabIndex: number; tabs: TabState[] }
    • EditorSlice

Index

Properties

activeTabIndex

activeTabIndex: number

The index of the currently active tab with regards to the tabs list of this object.

Optional defaultHeaders

defaultHeaders: undefined | string

Headers to be set when opening a new tab.

Optional defaultQuery

defaultQuery: undefined | string

The initial content of the operation editor when loading GraphiQL and there is no saved query in storage and no initialQuery prop.

This value is used only for the first tab. Additional tabs will open with an empty operation editor.

default

"# Welcome to GraphiQL..."

Optional documentAST

documentAST: OperationFacts["documentAST"]
remarks

from graphiql 5

externalFragments

externalFragments: Map<string, FragmentDefinitionNode>

A map of fragment definitions using the fragment name as a key which are made available to include in the query.

Optional headerEditor

headerEditor: MonacoEditor

The Monaco Editor instance used in the request headers editor, used to edit HTTP headers.

initialHeaders

initialHeaders: string

The contents of the request headers editor when initially rendering the provider component.

initialQuery

initialQuery: string

The contents of the operation editor when initially rendering the provider component.

initialVariables

initialVariables: string

The contents of the variables editor when initially rendering the provider component.

Optional onCopyQuery

onCopyQuery: undefined | ((query: string) => void)

Invoked when the current contents of the operation editor are copied to the clipboard.

param

The content that has been copied.

onPrettifyQuery

onPrettifyQuery: (query: string) => MaybePromise<string>

Invoked when the prettify callback is invoked.

param

The current value of the operation editor.

default

import prettier from 'prettier/standalone'

prettier.format(query, { parser: 'graphql' })

returns

The formatted query.

Type declaration

Optional operationName

operationName: undefined | string
remarks

from graphiql 5

Optional operations

operations: OperationFacts["operations"]
remarks

from graphiql 5

Optional queryEditor

queryEditor: MonacoEditor

The Monaco Editor instance used in the operation editor.

Optional responseEditor

responseEditor: MonacoEditor

The Monaco Editor instance used in the response editor.

shouldPersistHeaders

shouldPersistHeaders: boolean

If the contents of the request headers editor are persisted in storage.

tabs

tabs: TabState[]

A list of state objects for each tab.

uriInstanceId

uriInstanceId: string

Unique ID of the GraphiQL instance, which will be suffixed to the URIs for operations, variables, headers, and response editors.

see

https://github.com/microsoft/monaco-editor#uris

Optional variableEditor

variableEditor: MonacoEditor

The Monaco Editor instance used in the variables editor.

Methods

Optional onEditOperationName

  • onEditOperationName(operationName: string): void
  • Invoked when the operation name changes. Possible triggers are:

    • Editing the contents of the operation editor
    • Selecting an operation for execution in a document that contains multiple operation definitions

    Parameters

    • operationName: string

      The operation name after it has been changed.

    Returns void

Optional onTabChange

  • Invoked when the state of the tabs changes. Possible triggers are:

    • Updating any editor contents inside the currently active tab
    • Adding a tab
    • Switching to a different tab
    • Closing a tab

    Parameters

    • tabState: TabsState

      The tab state after it has been updated.

    Returns void

Generated using TypeDoc