tiptap: fix type

This commit is contained in:
fantasticit 2022-06-05 00:33:11 +08:00
parent ff86457cf7
commit bbb3ec3f53
4 changed files with 6 additions and 17 deletions

View File

@ -3,7 +3,7 @@ import { ReactNodeViewRenderer } from '@tiptap/react';
import { DocumentReferenceWrapper } from 'tiptap/core/wrappers/document-reference';
import { getDatasetAttribute } from 'tiptap/prose-utils';
type IDocumentReferenceAttrs = {
export type IDocumentReferenceAttrs = {
defaultShowPicker?: boolean;
createUser: string;
};

View File

@ -2,7 +2,7 @@ import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';
import { ReactNodeViewRenderer } from '@tiptap/react';
import { KatexWrapper } from 'tiptap/core/wrappers/katex';
type IKatexAttrs = {
export type IKatexAttrs = {
text?: string;
defaultShowPicker?: boolean;
createUser: string;

View File

@ -10,19 +10,14 @@ import { useToggle } from 'hooks/use-toggle';
import { useRouter } from 'next/router';
import { useCallback, useEffect } from 'react';
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 { copyNode, deleteNode } from 'tiptap/prose-utils';
const { Text } = Typography;
type DocumentReferenceAttrs = {
defaultShowPicker: boolean;
createUser: string;
};
export const DocumentReferenceBubbleMenu = ({ editor }) => {
const attrs = useAttributes<DocumentReferenceAttrs, DocumentReferenceAttrs>(editor, DocumentReference.name, {
const attrs = useAttributes<IDocumentReferenceAttrs>(editor, DocumentReference.name, {
defaultShowPicker: false,
createUser: '',
});

View File

@ -7,20 +7,14 @@ import { useToggle } from 'hooks/use-toggle';
import { useCallback, useEffect, useRef } from 'react';
import { Editor } from 'tiptap/core';
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 { copyNode, deleteNode } from 'tiptap/prose-utils';
const { Text } = Typography;
type KatexAttrs = {
text: string;
defaultShowPicker: boolean;
createUser: string;
};
export const KatexBubbleMenu: React.FC<{ editor: Editor }> = ({ editor }) => {
const attrs = useAttributes<KatexAttrs, KatexAttrs>(editor, Katex.name, {
const attrs = useAttributes<IKatexAttrs>(editor, Katex.name, {
text: '',
defaultShowPicker: false,
createUser: '',