mirror of https://github.com/fantasticit/think.git
tiptap: clean code in mind
This commit is contained in:
parent
5368182a7f
commit
1407117eb0
|
@ -13,16 +13,16 @@ import { copyNode, deleteNode, getEditorContainerDOMSize } from 'tiptap/prose-ut
|
||||||
import { triggerOpenMindSettingModal } from '../_event';
|
import { triggerOpenMindSettingModal } from '../_event';
|
||||||
|
|
||||||
export const MindBubbleMenu = ({ editor }) => {
|
export const MindBubbleMenu = ({ editor }) => {
|
||||||
|
const { width: maxWidth } = getEditorContainerDOMSize(editor);
|
||||||
const attrs = useAttributes<IMindAttrs>(editor, Mind.name, {
|
const attrs = useAttributes<IMindAttrs>(editor, Mind.name, {
|
||||||
defaultShowPicker: false,
|
defaultShowPicker: false,
|
||||||
createUser: '',
|
createUser: '',
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
});
|
});
|
||||||
const { defaultShowPicker, createUser } = attrs;
|
const { defaultShowPicker, createUser, width, height } = attrs;
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
|
||||||
const { width: maxWidth } = getEditorContainerDOMSize(editor);
|
|
||||||
const { width, height } = useAttributes(editor, Mind.name, { width: 0, height: 0 });
|
|
||||||
|
|
||||||
const setSize = useCallback(
|
const setSize = useCallback(
|
||||||
(size) => {
|
(size) => {
|
||||||
editor.chain().updateAttributes(Mind.name, size).setNodeSelection(editor.state.selection.from).focus().run();
|
editor.chain().updateAttributes(Mind.name, size).setNodeSelection(editor.state.selection.from).focus().run();
|
||||||
|
|
Loading…
Reference in New Issue