From 68ab7d3968fcfc3db7e355a7817e9bf2438e9462 Mon Sep 17 00:00:00 2001 From: Lynette Lopez Date: Wed, 28 Sep 2022 20:54:51 -0500 Subject: [PATCH 1/4] Remove double exclammation mark for function that already returns a boolean --- libs/components/common/src/lib/text/EditableText.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/components/common/src/lib/text/EditableText.tsx b/libs/components/common/src/lib/text/EditableText.tsx index 87c111544a..57509e9379 100644 --- a/libs/components/common/src/lib/text/EditableText.tsx +++ b/libs/components/common/src/lib/text/EditableText.tsx @@ -551,7 +551,7 @@ export const Text = forwardRef((props, ref) => { } } // markdown interception - if (supportMarkdown && !!handleMarkdown(e)) { + if (supportMarkdown && handleMarkdown(e)) { const start_selection = utils.current.getStartSelection(); utils.current.setSelection(start_selection); e.preventDefault(); From 1e0614ff5657e49279f4acb284e2f6e35619e232 Mon Sep 17 00:00:00 2001 From: Lynette Lopez Date: Wed, 28 Sep 2022 20:55:26 -0500 Subject: [PATCH 2/4] Move selection mark/cursor to end of markdown once done processing --- libs/components/common/src/lib/text/EditableText.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/components/common/src/lib/text/EditableText.tsx b/libs/components/common/src/lib/text/EditableText.tsx index 57509e9379..ba7ffad621 100644 --- a/libs/components/common/src/lib/text/EditableText.tsx +++ b/libs/components/common/src/lib/text/EditableText.tsx @@ -552,8 +552,8 @@ export const Text = forwardRef((props, ref) => { } // markdown interception if (supportMarkdown && handleMarkdown(e)) { - const start_selection = utils.current.getStartSelection(); - utils.current.setSelection(start_selection); + const endOfMarkdown = utils.current.getEndSelection(); + utils.current.setSelection(endOfMarkdown); e.preventDefault(); return true; } From b317c595c6b9ef8aa63f956e40fa0b36bb55eefc Mon Sep 17 00:00:00 2001 From: Frozen FIsh <76603360+sudongyuer@users.noreply.github.com> Date: Fri, 30 Sep 2022 12:33:27 +0800 Subject: [PATCH 3/4] fix: delete block leftMenu not delete (#472) --- .../editor-core/src/editor/commands/block-commands.ts | 6 ++++-- .../editor-plugins/src/menu/left-menu/LeftMenu.tsx | 10 +++++++--- .../src/menu/left-menu/LeftMenuDraggable.tsx | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libs/components/editor-core/src/editor/commands/block-commands.ts b/libs/components/editor-core/src/editor/commands/block-commands.ts index f156bd627a..bb6ba6eadf 100644 --- a/libs/components/editor-core/src/editor/commands/block-commands.ts +++ b/libs/components/editor-core/src/editor/commands/block-commands.ts @@ -46,12 +46,14 @@ export class BlockCommands { * * remove block by block id * @param {string} blockId + * @param onDelete Delete Block's LeftMenuDraggable * @memberof BlockCommands */ - public async removeBlock(blockId: string) { + public async removeBlock(blockId: string, onDelete?: () => void) { const block = await this._editor.getBlockById(blockId); if (block) { - block.remove(); + onDelete(); + await block.remove(); } } diff --git a/libs/components/editor-plugins/src/menu/left-menu/LeftMenu.tsx b/libs/components/editor-plugins/src/menu/left-menu/LeftMenu.tsx index 731b6ea42e..c951d7600f 100644 --- a/libs/components/editor-plugins/src/menu/left-menu/LeftMenu.tsx +++ b/libs/components/editor-plugins/src/menu/left-menu/LeftMenu.tsx @@ -18,17 +18,21 @@ interface LeftMenuProps { editor?: Virgo; hooks: PluginHooks; blockId: string; + onDelete: () => void; } export function LeftMenu(props: LeftMenuProps) { - const { editor, anchorEl, hooks, blockId, onClose } = props; + const { editor, anchorEl, hooks, blockId, onClose, onDelete } = props; const { t } = useTranslation(); const menu: CascaderItemProps[] = useMemo( () => [ { title: t('Delete'), - callback: () => { - editor.commands.blockCommands.removeBlock(blockId); + callback: async () => { + await editor.commands.blockCommands.removeBlock( + blockId, + onDelete + ); }, shortcut: 'Del', icon: , diff --git a/libs/components/editor-plugins/src/menu/left-menu/LeftMenuDraggable.tsx b/libs/components/editor-plugins/src/menu/left-menu/LeftMenuDraggable.tsx index 71e11e4679..4701c6c312 100644 --- a/libs/components/editor-plugins/src/menu/left-menu/LeftMenuDraggable.tsx +++ b/libs/components/editor-plugins/src/menu/left-menu/LeftMenuDraggable.tsx @@ -165,6 +165,10 @@ export const LeftMenuDraggable = (props: LeftMenuProps) => { setAnchorEl(currentTarget); }; + const onDelete = useCallback(() => { + setBlock(undefined); + }, []); + const onClose = useCallback(() => setAnchorEl(undefined), [setAnchorEl]); useEffect(() => { @@ -241,6 +245,7 @@ export const LeftMenuDraggable = (props: LeftMenuProps) => { editor={props.editor} hooks={props.hooks} onClose={onClose} + onDelete={onDelete} blockId={block.block.id} > From 23f7577e3aa9f96b55a97f838be1a382e2aa8944 Mon Sep 17 00:00:00 2001 From: alt0 Date: Fri, 30 Sep 2022 17:58:05 +0800 Subject: [PATCH 4/4] fix: add block suite link --- apps/venus/src/app/common/Footer.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/venus/src/app/common/Footer.tsx b/apps/venus/src/app/common/Footer.tsx index d13ae5bb25..d8cc674223 100644 --- a/apps/venus/src/app/common/Footer.tsx +++ b/apps/venus/src/app/common/Footer.tsx @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { useTranslation } from 'react-i18next'; -import { Box, Button, Grid, Typography } from '@mui/joy'; +import { Box, Button, Grid, styled, Typography } from '@mui/joy'; import GitHubIcon from '@mui/icons-material/GitHub'; import RedditIcon from '@mui/icons-material/Reddit'; @@ -361,7 +361,14 @@ export const AFFiNEFooter = ({ > #OpenSource - company + software, built with  + + BlockSuite + @@ -383,3 +390,13 @@ export const AFFiNEFooter = ({ ); }; + +const StyledLink = styled('a')({ + fontWeight: '900', + color: '#000', + textDecoration: 'none', + + '&:hover': { + textDecoration: 'underline', + }, +});