mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 18:31:31 +03:00
fix page title tranform
This commit is contained in:
parent
e50502417b
commit
c2edd93c72
@ -86,8 +86,9 @@ export const PageView: FC<CreateView> = ({ block, editor }) => {
|
||||
alwaysShowPlaceholder
|
||||
ref={textRef}
|
||||
className={'title'}
|
||||
supportMarkdown={true}
|
||||
supportMarkdown={false}
|
||||
handleEnter={onTextEnter}
|
||||
handleConvert={() => {}}
|
||||
placeholder={'Untitled'}
|
||||
block={block}
|
||||
editor={editor}
|
||||
|
@ -82,6 +82,11 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => {
|
||||
const checkIfShowCommandMenu = useCallback(
|
||||
async (event: React.KeyboardEvent<HTMLDivElement>) => {
|
||||
const { type, anchorNode } = editor.selection.currentSelectInfo;
|
||||
// console.log(await editor.getBlockById(anchorNode.id));
|
||||
let activeBlock = await editor.getBlockById(anchorNode.id);
|
||||
if (activeBlock.type === Protocol.Block.Type.page) {
|
||||
return;
|
||||
}
|
||||
if (event.key === '/' && type === 'Range') {
|
||||
if (anchorNode) {
|
||||
const text = editor.blockHelper.getBlockTextBeforeSelection(
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Protocol } from '@toeverything/datasource/db-service';
|
||||
import {
|
||||
MuiClickAwayListener as ClickAwayListener,
|
||||
MuiGrow as Grow,
|
||||
@ -22,8 +23,14 @@ export const InlineMenuContainer = ({ editor }: InlineMenuContainerProps) => {
|
||||
|
||||
useEffect(() => {
|
||||
// const unsubscribe = editor.selection.onSelectionChange(info => {
|
||||
const unsubscribe = editor.selection.onSelectEnd(info => {
|
||||
const unsubscribe = editor.selection.onSelectEnd(async info => {
|
||||
const { type, browserSelection, anchorNode } = info;
|
||||
if (anchorNode) {
|
||||
let activeBlock = await editor.getBlockById(anchorNode.id);
|
||||
if (activeBlock.type === Protocol.Block.Type.page) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (
|
||||
type === 'None' ||
|
||||
!anchorNode ||
|
||||
|
Loading…
Reference in New Issue
Block a user