mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-07 09:25:29 +08:00
parent
7280e2931e
commit
c7fd0f80af
5
.changeset/dry-cycles-sleep.md
Normal file
5
.changeset/dry-cycles-sleep.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@tiptap/react": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Updates the typings to `useEditor` and `EditorProvider` to not conflict with the core Editor type
|
@ -1,6 +1,7 @@
|
|||||||
|
import { Editor } from '@tiptap/core'
|
||||||
import React, { createContext, ReactNode, useContext } from 'react'
|
import React, { createContext, ReactNode, useContext } from 'react'
|
||||||
|
|
||||||
import { Editor } from './Editor.js'
|
import { Editor as ReactEditor } from './Editor.js'
|
||||||
import { EditorContent } from './EditorContent.js'
|
import { EditorContent } from './EditorContent.js'
|
||||||
import { useEditor, UseEditorOptions } from './useEditor.js'
|
import { useEditor, UseEditorOptions } from './useEditor.js'
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ export function EditorProvider({
|
|||||||
{slotBefore}
|
{slotBefore}
|
||||||
<EditorConsumer>
|
<EditorConsumer>
|
||||||
{({ editor: currentEditor }) => (
|
{({ editor: currentEditor }) => (
|
||||||
<EditorContent editor={currentEditor} />
|
<EditorContent editor={currentEditor as ReactEditor} />
|
||||||
)}
|
)}
|
||||||
</EditorConsumer>
|
</EditorConsumer>
|
||||||
{children}
|
{children}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { EditorOptions } from '@tiptap/core'
|
import { type EditorOptions, Editor } from '@tiptap/core'
|
||||||
import {
|
import {
|
||||||
DependencyList,
|
DependencyList,
|
||||||
MutableRefObject,
|
MutableRefObject,
|
||||||
@ -9,7 +9,6 @@ import {
|
|||||||
} from 'react'
|
} from 'react'
|
||||||
import { useSyncExternalStore } from 'use-sync-external-store/shim'
|
import { useSyncExternalStore } from 'use-sync-external-store/shim'
|
||||||
|
|
||||||
import { Editor } from './Editor.js'
|
|
||||||
import { useEditorState } from './useEditorState.js'
|
import { useEditorState } from './useEditorState.js'
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV !== 'production'
|
const isDev = process.env.NODE_ENV !== 'production'
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
import type { Editor } from '@tiptap/core'
|
||||||
import { useDebugValue, useEffect, useState } from 'react'
|
import { useDebugValue, useEffect, useState } from 'react'
|
||||||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'
|
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'
|
||||||
|
|
||||||
import type { Editor } from './Editor.js'
|
|
||||||
|
|
||||||
export type EditorStateSnapshot<TEditor extends Editor | null = Editor | null> = {
|
export type EditorStateSnapshot<TEditor extends Editor | null = Editor | null> = {
|
||||||
editor: TEditor;
|
editor: TEditor;
|
||||||
transactionNumber: number;
|
transactionNumber: number;
|
||||||
|
Loading…
Reference in New Issue
Block a user