fix: fix callout

pull/29/head
fantasticit 2022-04-25 15:35:31 +08:00
parent c1ddc14a32
commit 3a284ad903
3 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import { Extension } from '@tiptap/core'; import { Extension } from '@tiptap/core';
import { Plugin, PluginKey, NodeSelection, TextSelection, Selection, AllSelection } from 'prosemirror-state'; import { Plugin, PluginKey, NodeSelection, TextSelection, Selection, AllSelection } from 'prosemirror-state';
import { Decoration, DecorationSet } from 'prosemirror-view'; import { Decoration, DecorationSet } from 'prosemirror-view';
import { getCurrentNode, isInCodeBlock, isInBanner } from '../utils/node'; import { getCurrentNode, isInCodeBlock, isInCallout } from '../utils/node';
import { EXTENSION_PRIORITY_HIGHEST } from '../constants'; import { EXTENSION_PRIORITY_HIGHEST } from '../constants';
export const selectionPluginKey = new PluginKey('selection'); export const selectionPluginKey = new PluginKey('selection');
@ -68,7 +68,7 @@ export const SelectionExtension = Extension.create({
} }
// 信息框 // 信息框
if (isInBanner(view.state)) { if (isInCallout(view.state)) {
// @ts-ignore // @ts-ignore
const { path = [] } = $head; const { path = [] } = $head;
startPos = path[2]; startPos = path[2];

View File

@ -93,7 +93,7 @@ export const CalloutBubbleMenu: React.FC<{ editor: Editor }> = ({ editor }) => {
type="tertiary" type="tertiary"
theme="borderless" theme="borderless"
icon={<IconDelete />} icon={<IconDelete />}
onClick={() => deleteNode('banner', editor)} onClick={() => deleteNode('callout', editor)}
/> />
</Tooltip> </Tooltip>
</Space> </Space>

View File

@ -51,6 +51,6 @@ export function isInTitle(state: EditorState): boolean {
return isInCustomNode(state, 'title'); return isInCustomNode(state, 'title');
} }
export function isInBanner(state: EditorState): boolean { export function isInCallout(state: EditorState): boolean {
return isInCustomNode(state, 'banner'); return isInCustomNode(state, 'callout');
} }