From 3a284ad90396af72f1b787307b65ab259534a177 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Mon, 25 Apr 2022 15:35:31 +0800 Subject: [PATCH] fix: fix callout --- packages/client/src/tiptap/extensions/selection.ts | 4 ++-- packages/client/src/tiptap/menus/callout/bubble.tsx | 2 +- packages/client/src/tiptap/utils/node.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/client/src/tiptap/extensions/selection.ts b/packages/client/src/tiptap/extensions/selection.ts index 4dcf59f0..474b5068 100644 --- a/packages/client/src/tiptap/extensions/selection.ts +++ b/packages/client/src/tiptap/extensions/selection.ts @@ -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]; diff --git a/packages/client/src/tiptap/menus/callout/bubble.tsx b/packages/client/src/tiptap/menus/callout/bubble.tsx index 43506d2e..c9b569da 100644 --- a/packages/client/src/tiptap/menus/callout/bubble.tsx +++ b/packages/client/src/tiptap/menus/callout/bubble.tsx @@ -93,7 +93,7 @@ export const CalloutBubbleMenu: React.FC<{ editor: Editor }> = ({ editor }) => { type="tertiary" theme="borderless" icon={} - onClick={() => deleteNode('banner', editor)} + onClick={() => deleteNode('callout', editor)} /> diff --git a/packages/client/src/tiptap/utils/node.ts b/packages/client/src/tiptap/utils/node.ts index a7787da8..81687f4b 100644 --- a/packages/client/src/tiptap/utils/node.ts +++ b/packages/client/src/tiptap/utils/node.ts @@ -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'); }