tiptap: clean code in mind

pull/66/head
fantasticit 2022-06-05 19:34:11 +08:00
parent 5368182a7f
commit 1407117eb0
1 changed files with 4 additions and 4 deletions

View File

@ -13,16 +13,16 @@ import { copyNode, deleteNode, getEditorContainerDOMSize } from 'tiptap/prose-ut
import { triggerOpenMindSettingModal } from '../_event';
export const MindBubbleMenu = ({ editor }) => {
const { width: maxWidth } = getEditorContainerDOMSize(editor);
const attrs = useAttributes<IMindAttrs>(editor, Mind.name, {
defaultShowPicker: false,
createUser: '',
width: 0,
height: 0,
});
const { defaultShowPicker, createUser } = attrs;
const { defaultShowPicker, createUser, width, height } = attrs;
const { user } = useUser();
const { width: maxWidth } = getEditorContainerDOMSize(editor);
const { width, height } = useAttributes(editor, Mind.name, { width: 0, height: 0 });
const setSize = useCallback(
(size) => {
editor.chain().updateAttributes(Mind.name, size).setNodeSelection(editor.state.selection.from).focus().run();