Skip to content

Commit

Permalink
docs: replace EditorEventListener->EventListenerPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhg committed Jan 29, 2025
1 parent 9b917da commit f8f68fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apps/docs/src/components/editor/portable-text-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
EditorEventListener,
EditorProvider,
PortableTextEditable,
type PortableTextBlock,
type SchemaDefinition,
} from '@portabletext/editor'
import {coreBehaviors, defineBehavior} from '@portabletext/editor/behaviors'
import {EventListenerPlugin} from '@portabletext/editor/plugins'
import {
getFocusSpan,
getFocusTextBlock,
Expand Down Expand Up @@ -72,7 +72,7 @@ export function PortableTextEditor({customSchema}: PortableTextEditorProps) {
],
}}
>
<EditorEventListener
<EventListenerPlugin
on={(event) => {
if (event.type === 'patch') {
setValue((prevValue) => applyAll(prevValue, [event.patch]))
Expand Down
10 changes: 5 additions & 5 deletions apps/docs/src/content/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ Start by installing the editor to your project

<PackageManagers pkg="@portabletext/editor" />

Next, import `EditorProvider`, `EditorEventListener`, `PortableTextEditable`, `defineSchema`, and the types in the code below.
Next, import `EditorProvider`, `EventListenerPlugin`, `PortableTextEditable`, `defineSchema`, and the types in the code below.

```tsx
// App.tsx
import {
defineSchema,
EditorEventListener,
EditorProvider,
PortableTextEditable,
} from '@portabletext/editor'
Expand All @@ -48,6 +47,7 @@ import type {
RenderDecoratorFunction,
RenderStyleFunction,
} from '@portabletext/editor'
import {EventListenerPlugin} from '@portabletext/editor/plugins'
```

You won't need all of these right away, but you can add them now.
Expand Down Expand Up @@ -108,7 +108,6 @@ Add `react` and `useState`, then scaffold out a basic application component. For
// app.tsx
import {
defineSchema,
EditorEventListener,
EditorProvider,
PortableTextEditable,
} from '@portabletext/editor'
Expand All @@ -117,6 +116,7 @@ import type {
RenderDecoratorFunction,
RenderStyleFunction,
} from '@portabletext/editor'
import {EventListenerPlugin} from '@portabletext/editor/plugins'
import {useState} from 'react'

const schemaDefinition = defineSchema({
Expand All @@ -137,7 +137,7 @@ function App() {
initialValue: value,
}}
>
<EditorEventListener
<EventListenerPlugin
on={(event) => {
if (event.type === 'mutation') {
setValue(event.value)
Expand Down Expand Up @@ -317,7 +317,7 @@ function App() {
initialValue: value,
}}
>
<EditorEventListener
<EventListenerPlugin
on={(event) => {
if (event.type === 'mutation') {
setValue(event.value)
Expand Down

0 comments on commit f8f68fa

Please sign in to comment.