fix: can't add image and delete more action button (#430)

This commit is contained in:
DiamondThree
2022-09-16 11:34:45 +08:00
committed by GitHub
parent 4a2f01b924
commit 74b1caf01d
3 changed files with 15 additions and 11 deletions
@@ -168,7 +168,9 @@ export const ImageView = ({ block, editor }: ImageView) => {
<BlockPendantProvider editor={editor} block={block}>
<ImageBlock>
<div style={{ position: 'relative' }} ref={resizeBox}>
{!isSelect ? <ImageShade onClick={handleClick} /> : null}
{!isSelect && imgUrl ? (
<ImageShade onClick={handleClick} />
) : null}
{imgUrl ? (
<div
onMouseDown={e => {
@@ -1,5 +1,3 @@
import { useState } from 'react';
import { CustomText, TextProps } from '@toeverything/components/common';
import {
BlockPendantProvider,
@@ -11,9 +9,11 @@ import {
import { styled } from '@toeverything/components/ui';
import { Protocol } from '@toeverything/datasource/db-service';
import { CreateView } from '@toeverything/framework/virgo';
import { useState } from 'react';
import { BlockContainer } from '../../components/BlockContainer';
import { TextManage } from '../../components/text-manage';
import { dedentBlock, tabBlock } from '../../utils/indent';
interface CreateTextView extends CreateView {
// TODO: need to optimize
containerClassName?: string;
@@ -247,6 +247,9 @@ export const TextView = ({
await block.setProperty('text', {
value: options?.['text'] as CustomText[],
});
setTimeout(async () => {
await editor.selectionManager.activeNodeByNodeId(block.id);
}, 100);
block.firstCreateFlag = true;
};
const onTab: TextProps['handleTab'] = async ({ isShiftKey }) => {
@@ -22,7 +22,6 @@ import {
HeadingTwoIcon,
ImageIcon,
LinkIcon,
MoreIcon,
NumberIcon,
PagesIcon,
QuoteIcon,
@@ -827,13 +826,13 @@ export const getInlineMenuData = ({
nameKey: inlineMenuNamesKeys.backlinks,
onClick: common_handler_for_inline_menu,
},
{
type: INLINE_MENU_UI_TYPES.icon,
icon: MoreIcon,
name: inlineMenuNames.moreActions,
nameKey: inlineMenuNamesKeys.moreActions,
onClick: common_handler_for_inline_menu,
},
// {
// type: INLINE_MENU_UI_TYPES.icon,
// icon: MoreIcon,
// name: inlineMenuNames.moreActions,
// nameKey: inlineMenuNamesKeys.moreActions,
// onClick: common_handler_for_inline_menu,
// },
];
return inlineMenuData.filter(item => Boolean(item));