> For the complete documentation index, see [llms.txt](/llms.txt).
> The full corpus is at [llms-full.txt](/llms-full.txt).

# PortableTextEditor

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:33

:::caution[Deprecated]
Use `useEditor()` instead

```
import {useEditor} from '@portabletext/editor'

// Get the editor instance
const editor = useEditor()

// Send events to the editor
editor.send(...)

// Derive state from the editor
const state = useEditorSelector(editor, snapshot => ...)
```
:::

## Constructors

### Constructor

> **new PortableTextEditor**(`config`): `PortableTextEditor`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:43

#### Parameters

##### config

###### editable

`EditableAPI`

###### editorActor

`ActorRef`

#### Returns

`PortableTextEditor`

## Properties

### ~~schemaTypes~~

> **schemaTypes**: `Schema`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:37

A lookup table for all the relevant schema types for this portable text type.

## Methods

### ~~setEditable()~~

> **setEditable**(`editable`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:48

#### Parameters

##### editable

`EditableAPI`

#### Returns

`void`

***

### ~~activeAnnotations()~~

> `static` **activeAnnotations**(`editor`): [`PortableTextObject`](/api/editor/interfaces/portabletextobject/)[]

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:65

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isActive = useEditorSelector(editor, selectors.getActiveAnnotations)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

[`PortableTextObject`](/api/editor/interfaces/portabletextobject/)[]

***

### ~~addAnnotation()~~

> `static` **addAnnotation**\<`TSchemaType`\>(`editor`, `type`, `value?`): [`AddedAnnotationPaths`](/api/editor/type-aliases/addedannotationpaths/) \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:105

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'annotation.add',
 annotation: {
   name: '...',
   value: {...},
 }
})
```
:::

#### Type Parameters

##### TSchemaType

`TSchemaType` *extends* `object`

#### Parameters

##### editor

`PortableTextEditor`

##### type

`TSchemaType`

##### value?

#### Returns

[`AddedAnnotationPaths`](/api/editor/type-aliases/addedannotationpaths/) \| `undefined`

***

### ~~blur()~~

> `static` **blur**(`editor`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:123

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'blur',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`void`

***

### ~~delete()~~

> `static` **delete**(`editor`, `selection`, `options?`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:141

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'delete',
 at: {...},
 direction: '...',
 unit: '...',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### selection

[`EditorSelection`](/api/editor/type-aliases/editorselection/)

##### options?

[`EditableAPIDeleteOptions`](/api/editor/interfaces/editableapideleteoptions/)

#### Returns

`void`

***

### ~~findByPath()~~

> `static` **findByPath**(`editor`, `path`): \[[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) \| [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/) \| [`PortableTextTextBlock`](/api/editor/interfaces/portabletexttextblock/)\<[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) \| [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/)\> \| `undefined`, [`Path`](/api/editor/type-aliases/path/) \| `undefined`\]

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:154

#### Parameters

##### editor

`PortableTextEditor`

##### path

[`Path`](/api/editor/type-aliases/path/)

#### Returns

\[[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) \| [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/) \| [`PortableTextTextBlock`](/api/editor/interfaces/portabletexttextblock/)\<[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) \| [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/)\> \| `undefined`, [`Path`](/api/editor/type-aliases/path/) \| `undefined`\]

***

### ~~findDOMNode()~~

> `static` **findDOMNode**(`editor`, `element`): `Node` \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:147

#### Parameters

##### editor

`PortableTextEditor`

##### element

[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) | [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/) | [`PortableTextTextBlock`](/api/editor/interfaces/portabletexttextblock/)\<[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) \| [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/)\>

#### Returns

`Node` \| `undefined`

***

### ~~focus()~~

> `static` **focus**(`editor`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:169

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'focus',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`void`

***

### ~~focusBlock()~~

> `static` **focusBlock**(`editor`): [`PortableTextBlock`](/api/editor/type-aliases/portabletextblock/) \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:183

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const focusBlock = useEditorSelector(editor, selectors.getFocusBlock)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

[`PortableTextBlock`](/api/editor/type-aliases/portabletextblock/) \| `undefined`

***

### ~~focusChild()~~

> `static` **focusChild**(`editor`): [`PortableTextChild`](/api/editor/type-aliases/portabletextchild/) \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:197

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const focusChild = useEditorSelector(editor, selectors.getFocusChild)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

[`PortableTextChild`](/api/editor/type-aliases/portabletextchild/) \| `undefined`

***

### ~~getFragment()~~

> `static` **getFragment**(`editor`): [`PortableTextBlock`](/api/editor/type-aliases/portabletextblock/)[] \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:485

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const selectedValue = useEditorSelector(editor, selectors.getSelectedValue)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

[`PortableTextBlock`](/api/editor/type-aliases/portabletextblock/)[] \| `undefined`

***

### ~~getSelection()~~

> `static` **getSelection**(`editor`): [`EditorSelection`](/api/editor/type-aliases/editorselection/)

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:213

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const selection = useEditorSelector(editor, selectors.getSelection)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

[`EditorSelection`](/api/editor/type-aliases/editorselection/)

***

### ~~getValue()~~

> `static` **getValue**(`editor`): [`PortableTextBlock`](/api/editor/type-aliases/portabletextblock/)[] \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:227

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const value = useEditorSelector(editor, selectors.getValue)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

[`PortableTextBlock`](/api/editor/type-aliases/portabletextblock/)[] \| `undefined`

***

### ~~hasBlockStyle()~~

> `static` **hasBlockStyle**(`editor`, `blockStyle`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:241

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isActive = useEditorSelector(editor, selectors.isActiveStyle(...))
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### blockStyle

`string`

#### Returns

`boolean`

***

### ~~hasListStyle()~~

> `static` **hasListStyle**(`editor`, `listStyle`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:255

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isActive = useEditorSelector(editor, selectors.isActiveListItem(...))
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### listStyle

`string`

#### Returns

`boolean`

***

### ~~insertBlock()~~

> `static` **insertBlock**\<`TSchemaType`\>(`editor`, `type`, `value?`): [`Path`](/api/editor/type-aliases/path/) \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:343

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'insert.block object',
 blockObject: {
   name: '...',
   value: {...},
 },
 placement: 'auto' | 'after' | 'before',
})
```
:::

#### Type Parameters

##### TSchemaType

`TSchemaType` *extends* `object`

#### Parameters

##### editor

`PortableTextEditor`

##### type

`TSchemaType`

##### value?

#### Returns

[`Path`](/api/editor/type-aliases/path/) \| `undefined`

***

### ~~insertBreak()~~

> `static` **insertBreak**(`editor`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:362

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'insert.break',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`void`

***

### ~~insertChild()~~

> `static` **insertChild**\<`TSchemaType`\>(`editor`, `type`, `value?`): [`Path`](/api/editor/type-aliases/path/) \| `undefined`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:319

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'insert.span',
 text: '...',
 annotations: [{name: '...', value: {...}}],
 decorators: ['...'],
})
editor.send({
 type: 'insert.inline object',
 inlineObject: {
   name: '...',
   value: {...},
 },
})
```
:::

#### Type Parameters

##### TSchemaType

`TSchemaType` *extends* `object`

#### Parameters

##### editor

`PortableTextEditor`

##### type

`TSchemaType`

##### value?

#### Returns

[`Path`](/api/editor/type-aliases/path/) \| `undefined`

***

### ~~isAnnotationActive()~~

> `static` **isAnnotationActive**(`editor`, `annotationType`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:81

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isActive = useEditorSelector(editor, selectors.isActiveAnnotation(...))
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### annotationType

`string`

#### Returns

`boolean`

***

### ~~isCollapsedSelection()~~

> `static` **isCollapsedSelection**(`editor`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:269

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isSelectionCollapsed = useEditorSelector(editor, selectors.isSelectionCollapsed)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`boolean`

***

### ~~isExpandedSelection()~~

> `static` **isExpandedSelection**(`editor`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:282

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isSelectionExpanded = useEditorSelector(editor, selectors.isSelectionExpanded)
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`boolean`

***

### ~~isMarkActive()~~

> `static` **isMarkActive**(`editor`, `mark`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:295

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isActive = useEditorSelector(editor, selectors.isActiveDecorator(...))
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### mark

`string`

#### Returns

`boolean`

***

### ~~isObjectPath()~~

> `static` **isObjectPath**(`_editor`, `path`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:373

#### Parameters

##### \_editor

`PortableTextEditor`

##### path

[`Path`](/api/editor/type-aliases/path/)

#### Returns

`boolean`

***

### ~~isSelectionsOverlapping()~~

> `static` **isSelectionsOverlapping**(`editor`, `selectionA`, `selectionB`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:531

:::caution[Deprecated]
Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/

```
import * as selectors from '@portabletext/editor/selectors'
const editor = useEditor()
const isOverlapping = useEditorSelector(editor, selectors.isOverlappingSelection(selectionB))
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### selectionA

[`EditorSelection`](/api/editor/type-aliases/editorselection/)

##### selectionB

[`EditorSelection`](/api/editor/type-aliases/editorselection/)

#### Returns

`boolean`

***

### ~~isVoid()~~

> `static` **isVoid**(`editor`, `element`): `boolean`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:366

#### Parameters

##### editor

`PortableTextEditor`

##### element

[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) | [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/) | [`PortableTextTextBlock`](/api/editor/interfaces/portabletexttextblock/)\<[`PortableTextObject`](/api/editor/interfaces/portabletextobject/) \| [`PortableTextSpan`](/api/editor/interfaces/portabletextspan/)\>

#### Returns

`boolean`

***

### ~~marks()~~

> `static` **marks**(`editor`): `string`[]

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:382

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`string`[]

***

### ~~redo()~~

> `static` **redo**(`editor`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:517

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
  type: 'history.redo',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`void`

***

### ~~removeAnnotation()~~

> `static` **removeAnnotation**\<`TSchemaType`\>(`editor`, `type`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:419

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'annotation.remove',
 annotation: {
   name: '...',
 },
})
```
:::

#### Type Parameters

##### TSchemaType

`TSchemaType` *extends* `object`

#### Parameters

##### editor

`PortableTextEditor`

##### type

`TSchemaType`

#### Returns

`void`

***

### ~~select()~~

> `static` **select**(`editor`, `selection`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:398

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'select',
 selection: {...},
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### selection

[`EditorSelection`](/api/editor/type-aliases/editorselection/)

#### Returns

`void`

***

### ~~toggleBlockStyle()~~

> `static` **toggleBlockStyle**(`editor`, `blockStyle`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:436

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'style.toggle',
 style: '...',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### blockStyle

`string`

#### Returns

`void`

***

### ~~toggleList()~~

> `static` **toggleList**(`editor`, `listStyle`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:455

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'list item.toggle',
 listItem: '...',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### listStyle

`string`

#### Returns

`void`

***

### ~~toggleMark()~~

> `static` **toggleMark**(`editor`, `mark`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:471

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
 type: 'decorator.toggle',
 decorator: '...',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

##### mark

`string`

#### Returns

`void`

***

### ~~undo()~~

> `static` **undo**(`editor`): `void`

Defined in: packages/editor/src/editor/PortableTextEditor.tsx:502

:::caution[Deprecated]
Use `editor.send(...)` instead

```
const editor = useEditor()
editor.send({
  type: 'history.undo',
})
```
:::

#### Parameters

##### editor

`PortableTextEditor`

#### Returns

`void`