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 { Plugin, PluginKey, NodeSelection, TextSelection, Selection, AllSelection } from 'prosemirror-state';
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';
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
const { path = [] } = $head;
startPos = path[2];

View File

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

View File

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