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