mirror of https://github.com/fantasticit/think.git
tiptap: fix type
This commit is contained in:
parent
ff86457cf7
commit
bbb3ec3f53
|
@ -3,7 +3,7 @@ import { ReactNodeViewRenderer } from '@tiptap/react';
|
||||||
import { DocumentReferenceWrapper } from 'tiptap/core/wrappers/document-reference';
|
import { DocumentReferenceWrapper } from 'tiptap/core/wrappers/document-reference';
|
||||||
import { getDatasetAttribute } from 'tiptap/prose-utils';
|
import { getDatasetAttribute } from 'tiptap/prose-utils';
|
||||||
|
|
||||||
type IDocumentReferenceAttrs = {
|
export type IDocumentReferenceAttrs = {
|
||||||
defaultShowPicker?: boolean;
|
defaultShowPicker?: boolean;
|
||||||
createUser: string;
|
createUser: string;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';
|
||||||
import { ReactNodeViewRenderer } from '@tiptap/react';
|
import { ReactNodeViewRenderer } from '@tiptap/react';
|
||||||
import { KatexWrapper } from 'tiptap/core/wrappers/katex';
|
import { KatexWrapper } from 'tiptap/core/wrappers/katex';
|
||||||
|
|
||||||
type IKatexAttrs = {
|
export type IKatexAttrs = {
|
||||||
text?: string;
|
text?: string;
|
||||||
defaultShowPicker?: boolean;
|
defaultShowPicker?: boolean;
|
||||||
createUser: string;
|
createUser: string;
|
||||||
|
|
|
@ -10,19 +10,14 @@ import { useToggle } from 'hooks/use-toggle';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
import { BubbleMenu } from 'tiptap/core/bubble-menu';
|
import { BubbleMenu } from 'tiptap/core/bubble-menu';
|
||||||
import { DocumentReference } from 'tiptap/core/extensions/document-reference';
|
import { DocumentReference, IDocumentReferenceAttrs } from 'tiptap/core/extensions/document-reference';
|
||||||
import { useAttributes } from 'tiptap/core/hooks/use-attributes';
|
import { useAttributes } from 'tiptap/core/hooks/use-attributes';
|
||||||
import { copyNode, deleteNode } from 'tiptap/prose-utils';
|
import { copyNode, deleteNode } from 'tiptap/prose-utils';
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
type DocumentReferenceAttrs = {
|
|
||||||
defaultShowPicker: boolean;
|
|
||||||
createUser: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DocumentReferenceBubbleMenu = ({ editor }) => {
|
export const DocumentReferenceBubbleMenu = ({ editor }) => {
|
||||||
const attrs = useAttributes<DocumentReferenceAttrs, DocumentReferenceAttrs>(editor, DocumentReference.name, {
|
const attrs = useAttributes<IDocumentReferenceAttrs>(editor, DocumentReference.name, {
|
||||||
defaultShowPicker: false,
|
defaultShowPicker: false,
|
||||||
createUser: '',
|
createUser: '',
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,20 +7,14 @@ import { useToggle } from 'hooks/use-toggle';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { Editor } from 'tiptap/core';
|
import { Editor } from 'tiptap/core';
|
||||||
import { BubbleMenu } from 'tiptap/core/bubble-menu';
|
import { BubbleMenu } from 'tiptap/core/bubble-menu';
|
||||||
import { Katex } from 'tiptap/core/extensions/katex';
|
import { IKatexAttrs, Katex } from 'tiptap/core/extensions/katex';
|
||||||
import { useAttributes } from 'tiptap/core/hooks/use-attributes';
|
import { useAttributes } from 'tiptap/core/hooks/use-attributes';
|
||||||
import { copyNode, deleteNode } from 'tiptap/prose-utils';
|
import { copyNode, deleteNode } from 'tiptap/prose-utils';
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
type KatexAttrs = {
|
|
||||||
text: string;
|
|
||||||
defaultShowPicker: boolean;
|
|
||||||
createUser: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const KatexBubbleMenu: React.FC<{ editor: Editor }> = ({ editor }) => {
|
export const KatexBubbleMenu: React.FC<{ editor: Editor }> = ({ editor }) => {
|
||||||
const attrs = useAttributes<KatexAttrs, KatexAttrs>(editor, Katex.name, {
|
const attrs = useAttributes<IKatexAttrs>(editor, Katex.name, {
|
||||||
text: '',
|
text: '',
|
||||||
defaultShowPicker: false,
|
defaultShowPicker: false,
|
||||||
createUser: '',
|
createUser: '',
|
||||||
|
|
Loading…
Reference in New Issue