diff --git a/.changeset/remove-change-observable.md b/.changeset/remove-change-observable.md new file mode 100644 index 000000000..b81177d93 --- /dev/null +++ b/.changeset/remove-change-observable.md @@ -0,0 +1,78 @@ +--- +'@portabletext/editor': major +--- + +feat!: remove `change$` observable and `rxjs` dependency + +The `PortableTextEditor.change$` observable isn't used internally anymore. It's +purely a legacy public API that allows consumers to read editor changes/events +through an Observable rather than through the ordinary subscription API. This +does not justify declaring `rxjs` as a peer dependency of PTE and therefore +this commit removes the `change$` Observable along with the `rxjs` dependency. + +BREAKING CHANGES: +- Removed `PortableTextEditor.change$` property +- Removed `EditorChanges` type export (`Subject`) +- Removed `PatchObservable` type export (`Observable<...>`) +- Removed `rxjs` from peerDependencies + +Migration: Replace `change$.subscribe()` with `editor.on()` or +``. Every active `EditorChange` type +has a 1:1 equivalent in the new event API. + +What's preserved: +- `EditorChange` type (still used by sanity's `onEditorChange` prop) +- `PortableTextEditor` class (separate deprecation path) +- All static methods and `schemaTypes` property + +### Migration + +Replace `change$.subscribe()` with `editor.on()` or ``: + +**Before (rxjs):** + +```tsx +import {usePortableTextEditor} from '@portabletext/editor' + +const editor = usePortableTextEditor() + +useEffect(() => { + const sub = editor.change$.subscribe((change) => { + if (change.type === 'mutation') { + // ... + } + }) + return () => sub.unsubscribe() +}, [editor]) +``` + +**After (editor.on):** + +```tsx +import {useEditor} from '@portabletext/editor' + +const editor = useEditor() + +useEffect(() => { + const unsubscribe = editor.on('mutation', (event) => { + // ... + }) + return unsubscribe +}, [editor]) +``` + +**After (EventListenerPlugin):** + +```tsx +import {EventListenerPlugin} from '@portabletext/editor/plugins' + + { + if (event.type === 'mutation') { + // ... + } + }} +/> +``` + +Every active `EditorChange` type has a 1:1 equivalent in the new event API. See the [event listener documentation](https://www.portabletext.org/reference/event-listener-plugin/) for details. diff --git a/packages/editor/package.json b/packages/editor/package.json index 701ef38eb..b4ebbfdf5 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -119,7 +119,6 @@ "racejar": "workspace:*", "react": "^19.2.3", "react-dom": "^19.2.3", - "rxjs": "^7.8.2", "typescript": "catalog:", "typescript-eslint": "^8.48.0", "vite": "^7.3.1", @@ -128,8 +127,7 @@ }, "peerDependencies": { "@portabletext/sanity-bridge": "workspace:^2.0.2", - "react": "^19.2.3", - "rxjs": "^7.8.2" + "react": "^19.2.3" }, "engines": { "node": ">=20.19 <22 || >=22.12" diff --git a/packages/editor/src/editor/Editable.tsx b/packages/editor/src/editor/Editable.tsx index 68f588103..ea1760df4 100644 --- a/packages/editor/src/editor/Editable.tsx +++ b/packages/editor/src/editor/Editable.tsx @@ -251,7 +251,7 @@ export const PortableTextEditable = forwardRef< if (slateRange) { Transforms.select(slateEditor, slateRange) // Output selection here in those cases where the editor selection was the same, and there are no set_selection operations made. - // The selection is usually automatically emitted to change$ by the withPortableTextSelections plugin whenever there is a set_selection operation applied. + // The selection is usually automatically emitted by the withPortableTextSelections plugin whenever there is a set_selection operation applied. if (!slateEditor.operations.some((o) => o.type === 'set_selection')) { editorActor.send({ type: 'update selection', diff --git a/packages/editor/src/editor/PortableTextEditor.tsx b/packages/editor/src/editor/PortableTextEditor.tsx index 1684f5479..0fc73b774 100644 --- a/packages/editor/src/editor/PortableTextEditor.tsx +++ b/packages/editor/src/editor/PortableTextEditor.tsx @@ -4,12 +4,10 @@ import type { PortableTextObject, Schema, } from '@portabletext/schema' -import {Subject} from 'rxjs' import type { AddedAnnotationPaths, EditableAPI, EditableAPIDeleteOptions, - EditorChanges, EditorSelection, } from '../types/editor' import type {Path} from '../types/paths' @@ -33,10 +31,6 @@ import type {InternalEditor} from './create-editor' * ``` */ export class PortableTextEditor { - /** - * An observable of all the editor changes. - */ - public change$: EditorChanges = new Subject() /** * A lookup table for all the relevant schema types for this portable text type. */ diff --git a/packages/editor/src/editor/editor-provider.tsx b/packages/editor/src/editor/editor-provider.tsx index ca01dd13a..4c276ff21 100644 --- a/packages/editor/src/editor/editor-provider.tsx +++ b/packages/editor/src/editor/editor-provider.tsx @@ -6,7 +6,6 @@ import {Slate} from '../slate-react' import {createInternalEditor} from './create-editor' import {EditorActorContext} from './editor-actor-context' import {EditorContext} from './editor-context' -import {eventToChange} from './event-to-change' import {PortableTextEditor} from './PortableTextEditor' import {RelayActorContext} from './relay-actor-context' import {PortableTextEditorContext} from './usePortableTextEditor' @@ -54,18 +53,6 @@ export function EditorProvider(props: EditorProviderProps) { unsubscribers.push(subscription()) } - const relayActorSubscription = internalEditor.actors.relayActor.on( - '*', - (event) => { - const change = eventToChange(event) - - if (change) { - portableTextEditor.change$.next(change) - } - }, - ) - unsubscribers.push(relayActorSubscription.unsubscribe) - internalEditor.actors.editorActor.start() internalEditor.actors.editorActor.send({ type: 'add slate editor', @@ -85,7 +72,7 @@ export function EditorProvider(props: EditorProviderProps) { stopActor(internalEditor.actors.relayActor) stopActor(internalEditor.actors.syncActor) } - }, [internalEditor, portableTextEditor]) + }, [internalEditor]) return ( diff --git a/packages/editor/src/index.ts b/packages/editor/src/index.ts index 55ea4fbc2..75cc3a451 100644 --- a/packages/editor/src/index.ts +++ b/packages/editor/src/index.ts @@ -57,7 +57,6 @@ export type { EditableAPI, EditableAPIDeleteOptions, EditorChange, - EditorChanges, EditorSelection, EditorSelectionPoint, ErrorChange, @@ -73,7 +72,6 @@ export type { OnPasteResultOrPromise, PasteData, PatchChange, - PatchObservable, RangeDecoration, RangeDecorationOnMovedDetails, ReadyChange, diff --git a/packages/editor/src/plugins/plugin.internal.change-ref.tsx b/packages/editor/src/plugins/plugin.internal.change-ref.tsx deleted file mode 100644 index ac85cb721..000000000 --- a/packages/editor/src/plugins/plugin.internal.change-ref.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import {useEffect} from 'react' -import {usePortableTextEditor} from '../editor/usePortableTextEditor' -import type {EditorChange} from '../types/editor' - -export function InternalChange$Plugin(props: { - onChange: (change: EditorChange) => void -}) { - const change$ = usePortableTextEditor().change$ - - useEffect(() => { - const subscription = change$.subscribe(props.onChange) - - return () => { - subscription.unsubscribe() - } - }, [change$, props.onChange]) - - return null -} diff --git a/packages/editor/src/plugins/plugin.internal.editor-change-ref.tsx b/packages/editor/src/plugins/plugin.internal.editor-change-ref.tsx new file mode 100644 index 000000000..445115f96 --- /dev/null +++ b/packages/editor/src/plugins/plugin.internal.editor-change-ref.tsx @@ -0,0 +1,27 @@ +import {useEffect} from 'react' +import {eventToChange} from '../editor/event-to-change' +import {useEditor} from '../editor/use-editor' +import type {EditorChange} from '../types/editor' + +export function InternalEditorChangePlugin(props: { + onChange: (change: EditorChange) => void +}) { + const editor = useEditor() + const {onChange} = props + + useEffect(() => { + const subscription = editor.on('*', (event) => { + const change = eventToChange(event) + + if (change) { + onChange(change) + } + }) + + return () => { + subscription.unsubscribe() + } + }, [editor, onChange]) + + return null +} diff --git a/packages/editor/src/types/editor.ts b/packages/editor/src/types/editor.ts index fb3410b8f..8f8627725 100644 --- a/packages/editor/src/types/editor.ts +++ b/packages/editor/src/types/editor.ts @@ -20,7 +20,6 @@ import type { ReactElement, RefObject, } from 'react' -import type {Observable, Subject} from 'rxjs' import type {PortableTextEditableProps} from '../editor/Editable' import type {EditorSchema} from '../editor/editor-schema' import type {PortableTextEditor} from '../editor/PortableTextEditor' @@ -288,11 +287,6 @@ export type EditorChange = | UnsetChange | ValueChange -/** - * @beta - */ -export type EditorChanges = Subject - /** @beta */ export type OnPasteResult = | { @@ -330,12 +324,6 @@ export type OnCopyFn = ( event: ClipboardEvent, ) => undefined | unknown -/** @beta */ -export type PatchObservable = Observable<{ - patches: Patch[] - snapshot: PortableTextBlock[] | undefined -}> - /** @beta */ export interface BlockRenderProps { children: ReactElement diff --git a/packages/editor/tests/PortableTextEditor.test.tsx b/packages/editor/tests/PortableTextEditor.test.tsx index a86c9062e..a9b62c48c 100644 --- a/packages/editor/tests/PortableTextEditor.test.tsx +++ b/packages/editor/tests/PortableTextEditor.test.tsx @@ -3,7 +3,7 @@ import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import type {EditorSelection} from '../src' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -24,7 +24,7 @@ describe('initialization', () => { const {locator} = await createTestEditor({ children: ( <> - + ), @@ -46,7 +46,7 @@ describe('initialization', () => { await createTestEditor({ children: ( <> - + ), @@ -80,7 +80,7 @@ describe('initialization', () => { await createTestEditor({ children: ( <> - + ), @@ -121,7 +121,7 @@ describe('initialization', () => { await createTestEditor({ children: ( <> - + ), @@ -166,7 +166,7 @@ describe('initialization', () => { await createTestEditor({ children: ( <> - + ), @@ -211,7 +211,7 @@ describe('initialization', () => { const {editor} = await createTestEditor({ children: ( <> - + ), initialValue: value, @@ -289,7 +289,7 @@ describe('initialization', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/change-subject.test.tsx b/packages/editor/tests/change-subject.test.tsx deleted file mode 100644 index 7f86e94ca..000000000 --- a/packages/editor/tests/change-subject.test.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import {describe, expect, test} from 'vitest' -import {userEvent} from 'vitest/browser' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' -import {createTestEditor} from '../src/test/vitest' -import type {EditorChange} from '../src/types/editor' - -describe('change$', () => { - test('emits changes', async () => { - const changes: Array = [] - - const {locator} = await createTestEditor({ - children: ( - { - changes.push(change) - }} - /> - ), - }) - - expect(changes).toEqual([{type: 'ready'}]) - - await userEvent.type(locator, 'f') - - expect(changes).toEqual([ - {type: 'ready'}, - expect.objectContaining({type: 'focus'}), - expect.objectContaining({type: 'selection'}), - expect.objectContaining({ - type: 'patch', - patch: expect.objectContaining({type: 'setIfMissing'}), - }), - expect.objectContaining({ - type: 'patch', - patch: expect.objectContaining({type: 'insert'}), - }), - expect.objectContaining({ - type: 'patch', - patch: expect.objectContaining({type: 'diffMatchPatch'}), - }), - expect.objectContaining({type: 'selection'}), - ]) - }) -}) diff --git a/packages/editor/tests/editor-change.test.tsx b/packages/editor/tests/editor-change.test.tsx new file mode 100644 index 000000000..21b6f9e7c --- /dev/null +++ b/packages/editor/tests/editor-change.test.tsx @@ -0,0 +1,42 @@ +import {expect, test} from 'vitest' +import {userEvent} from 'vitest/browser' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' +import {createTestEditor} from '../src/test/vitest' +import type {EditorChange} from '../src/types/editor' + +test('EditorChange', async () => { + const changes: Array = [] + + const {locator} = await createTestEditor({ + children: ( + { + changes.push(change) + }} + /> + ), + }) + + expect(changes).toEqual([{type: 'ready'}]) + + await userEvent.type(locator, 'f') + + expect(changes).toEqual([ + {type: 'ready'}, + expect.objectContaining({type: 'focus'}), + expect.objectContaining({type: 'selection'}), + expect.objectContaining({ + type: 'patch', + patch: expect.objectContaining({type: 'setIfMissing'}), + }), + expect.objectContaining({ + type: 'patch', + patch: expect.objectContaining({type: 'insert'}), + }), + expect.objectContaining({ + type: 'patch', + patch: expect.objectContaining({type: 'diffMatchPatch'}), + }), + expect.objectContaining({type: 'selection'}), + ]) +}) diff --git a/packages/editor/tests/insert-block.test.tsx b/packages/editor/tests/insert-block.test.tsx index 6a9c67d98..9d0ea4753 100644 --- a/packages/editor/tests/insert-block.test.tsx +++ b/packages/editor/tests/insert-block.test.tsx @@ -2,7 +2,7 @@ import {defineSchema, type PortableTextBlock} from '@portabletext/schema' import {createRef, type RefObject} from 'react' import {describe, expect, test, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' import type {EditorChange, EditorSelection} from '../src/types/editor' @@ -29,7 +29,7 @@ describe(PortableTextEditor.insertBlock.name, () => { await createTestEditor({ children: ( <> - + ), @@ -102,7 +102,7 @@ describe(PortableTextEditor.insertBlock.name, () => { await createTestEditor({ children: ( <> - + ), @@ -179,7 +179,7 @@ describe(PortableTextEditor.insertBlock.name, () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/pteWarningsSelfSolving.test.tsx b/packages/editor/tests/pteWarningsSelfSolving.test.tsx index ae01e574f..9ebf86936 100644 --- a/packages/editor/tests/pteWarningsSelfSolving.test.tsx +++ b/packages/editor/tests/pteWarningsSelfSolving.test.tsx @@ -2,7 +2,7 @@ import type {PortableTextBlock} from '@portabletext/schema' import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -30,7 +30,7 @@ describe('when PTE would display warnings, instead it self solves', () => { await createTestEditor({ children: ( <> - + ), @@ -91,7 +91,7 @@ describe('when PTE would display warnings, instead it self solves', () => { await createTestEditor({ children: ( <> - + ), @@ -151,7 +151,7 @@ describe('when PTE would display warnings, instead it self solves', () => { await createTestEditor({ children: ( <> - + ), @@ -226,7 +226,7 @@ describe('when PTE would display warnings, instead it self solves', () => { await createTestEditor({ children: ( <> - + ), @@ -293,7 +293,7 @@ describe('when PTE would display warnings, instead it self solves', () => { await createTestEditor({ children: ( <> - + ), @@ -337,7 +337,7 @@ describe('when PTE would display warnings, instead it self solves', () => { await createTestEditor({ children: ( <> - + ), @@ -372,7 +372,7 @@ describe('when PTE would display warnings, instead it self solves', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/range-decorations.test.tsx b/packages/editor/tests/range-decorations.test.tsx index 854a5b655..5843b479e 100644 --- a/packages/editor/tests/range-decorations.test.tsx +++ b/packages/editor/tests/range-decorations.test.tsx @@ -25,7 +25,7 @@ import { } from '../src/internal-utils/text-selection' import {EditorRefPlugin} from '../src/plugins/plugin.editor-ref' import {EventListenerPlugin} from '../src/plugins/plugin.event-listener' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' import { @@ -311,7 +311,7 @@ describe('RangeDecorations', () => { const {rerender} = await createTestEditor({ children: ( <> - + ), @@ -337,7 +337,7 @@ describe('RangeDecorations', () => { await rerender({ children: ( <> - + ), @@ -363,7 +363,7 @@ describe('RangeDecorations', () => { await rerender({ children: ( <> - + ), @@ -391,7 +391,7 @@ describe('RangeDecorations', () => { await rerender({ children: ( <> - + ), @@ -421,7 +421,7 @@ describe('RangeDecorations', () => { await rerender({ children: ( <> - + ), @@ -451,7 +451,7 @@ describe('RangeDecorations', () => { await rerender({ children: ( <> - + ), @@ -481,7 +481,7 @@ describe('RangeDecorations', () => { await rerender({ children: ( <> - + ), diff --git a/packages/editor/tests/valueNormalization.test.tsx b/packages/editor/tests/valueNormalization.test.tsx index 722732ce1..1515146c5 100644 --- a/packages/editor/tests/valueNormalization.test.tsx +++ b/packages/editor/tests/valueNormalization.test.tsx @@ -2,7 +2,7 @@ import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {defineSchema} from '../src' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -29,7 +29,7 @@ describe('values: normalization', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/withEditableAPIDelete.test.tsx b/packages/editor/tests/withEditableAPIDelete.test.tsx index 388d98d95..5f82aff05 100644 --- a/packages/editor/tests/withEditableAPIDelete.test.tsx +++ b/packages/editor/tests/withEditableAPIDelete.test.tsx @@ -1,7 +1,7 @@ import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -49,7 +49,7 @@ describe('plugin:withEditableAPI: .delete()', () => { await createTestEditor({ children: ( <> - + ), @@ -105,7 +105,7 @@ describe('plugin:withEditableAPI: .delete()', () => { await createTestEditor({ children: ( <> - + ), @@ -162,7 +162,7 @@ describe('plugin:withEditableAPI: .delete()', () => { await createTestEditor({ children: ( <> - + ), @@ -241,7 +241,7 @@ describe('plugin:withEditableAPI: .delete()', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/withEditableAPIGetFragment.test.tsx b/packages/editor/tests/withEditableAPIGetFragment.test.tsx index 3f8e21a6a..050d672aa 100644 --- a/packages/editor/tests/withEditableAPIGetFragment.test.tsx +++ b/packages/editor/tests/withEditableAPIGetFragment.test.tsx @@ -2,7 +2,7 @@ import {compileSchema, defineSchema, isTextBlock} from '@portabletext/schema' import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -55,7 +55,7 @@ describe('plugin:withEditableAPI: .getFragment()', () => { await createTestEditor({ children: ( <> - + ), @@ -108,7 +108,7 @@ describe('plugin:withEditableAPI: .getFragment()', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/withEditableAPIInsert.test.tsx b/packages/editor/tests/withEditableAPIInsert.test.tsx index 1c1346852..c747cbf36 100644 --- a/packages/editor/tests/withEditableAPIInsert.test.tsx +++ b/packages/editor/tests/withEditableAPIInsert.test.tsx @@ -2,7 +2,7 @@ import {defineSchema} from '@portabletext/schema' import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -62,7 +62,7 @@ describe('plugin:withEditableAPI: .insertChild()', () => { await createTestEditor({ children: ( <> - + ), @@ -210,7 +210,7 @@ describe('plugin:withEditableAPI: .insertBlock()', () => { await createTestEditor({ children: ( <> - + ), @@ -268,7 +268,7 @@ describe('plugin:withEditableAPI: .insertBlock()', () => { await createTestEditor({ children: ( <> - + ), @@ -330,7 +330,7 @@ describe('plugin:withEditableAPI: .insertBlock()', () => { await createTestEditor({ children: ( <> - + ), @@ -399,7 +399,7 @@ describe('plugin:withEditableAPI: .insertBlock()', () => { await createTestEditor({ children: ( <> - + ), @@ -466,7 +466,7 @@ describe('plugin:withEditableAPI: .insertBlock()', () => { await createTestEditor({ children: ( <> - + ), @@ -528,7 +528,7 @@ describe('plugin:withEditableAPI: .insertBlock()', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/withEditableAPISelectionsOverlapping.test.tsx b/packages/editor/tests/withEditableAPISelectionsOverlapping.test.tsx index efe49a0e0..4494a57a6 100644 --- a/packages/editor/tests/withEditableAPISelectionsOverlapping.test.tsx +++ b/packages/editor/tests/withEditableAPISelectionsOverlapping.test.tsx @@ -2,7 +2,7 @@ import type {PortableTextBlock} from '@portabletext/schema' import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -31,7 +31,7 @@ describe('plugin:withEditableAPI: .isSelectionsOverlapping', () => { await createTestEditor({ children: ( <> - + ), @@ -68,7 +68,7 @@ describe('plugin:withEditableAPI: .isSelectionsOverlapping', () => { await createTestEditor({ children: ( <> - + ), @@ -105,7 +105,7 @@ describe('plugin:withEditableAPI: .isSelectionsOverlapping', () => { await createTestEditor({ children: ( <> - + ), @@ -142,7 +142,7 @@ describe('plugin:withEditableAPI: .isSelectionsOverlapping', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/withPortableTextLists.test.tsx b/packages/editor/tests/withPortableTextLists.test.tsx index fdb815ce4..522875e54 100644 --- a/packages/editor/tests/withPortableTextLists.test.tsx +++ b/packages/editor/tests/withPortableTextLists.test.tsx @@ -1,7 +1,6 @@ import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -40,12 +39,10 @@ describe('plugin:withPortableTextLists', () => { style: 'normal', }, ] - const onChange = vi.fn() await createTestEditor({ children: ( <> - ), diff --git a/packages/editor/tests/withPortableTextMarkModel.test.tsx b/packages/editor/tests/withPortableTextMarkModel.test.tsx index 90a6602a3..c6ea4dae4 100644 --- a/packages/editor/tests/withPortableTextMarkModel.test.tsx +++ b/packages/editor/tests/withPortableTextMarkModel.test.tsx @@ -2,7 +2,7 @@ import {defineSchema} from '@portabletext/schema' import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' import type {EditorSelection} from '../src/types/editor' @@ -44,7 +44,7 @@ describe('plugin:withPortableTextMarksModel', () => { await createTestEditor({ children: ( <> - + ), @@ -178,7 +178,7 @@ describe('plugin:withPortableTextMarksModel', () => { await createTestEditor({ children: ( <> - + ), @@ -285,7 +285,7 @@ describe('plugin:withPortableTextMarksModel', () => { await createTestEditor({ children: ( <> - + ), @@ -389,7 +389,7 @@ describe('plugin:withPortableTextMarksModel', () => { await createTestEditor({ children: ( <> - + ), @@ -460,7 +460,7 @@ describe('plugin:withPortableTextMarksModel', () => { await createTestEditor({ children: ( <> - + ), @@ -516,7 +516,7 @@ describe('plugin:withPortableTextMarksModel', () => { await createTestEditor({ children: ( <> - + ), @@ -566,7 +566,7 @@ describe('plugin:withPortableTextMarksModel', () => { await createTestEditor({ children: ( <> - + ), diff --git a/packages/editor/tests/withPortableTextSelections.test.tsx b/packages/editor/tests/withPortableTextSelections.test.tsx index cac82de3a..63f4d890a 100644 --- a/packages/editor/tests/withPortableTextSelections.test.tsx +++ b/packages/editor/tests/withPortableTextSelections.test.tsx @@ -1,7 +1,7 @@ import {createRef, type RefObject} from 'react' import {describe, expect, it, vi} from 'vitest' import {PortableTextEditor} from '../src/editor/PortableTextEditor' -import {InternalChange$Plugin} from '../src/plugins/plugin.internal.change-ref' +import {InternalEditorChangePlugin} from '../src/plugins/plugin.internal.editor-change-ref' import {InternalPortableTextEditorRefPlugin} from '../src/plugins/plugin.internal.portable-text-editor-ref' import {createTestEditor} from '../src/test/vitest' @@ -44,7 +44,7 @@ describe('plugin:withPortableTextSelections', () => { await createTestEditor({ children: ( <> - + ), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea3b33c46..07c4a2ae4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -517,9 +517,6 @@ importers: react-dom: specifier: ^19.2.3 version: 19.2.3(react@19.2.3) - rxjs: - specifier: ^7.8.2 - version: 7.8.2 typescript: specifier: 'catalog:' version: 5.9.3