From c5d25250862fbe6c9d85d6f1cf2b2bf7fbc634fd Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Mon, 8 Aug 2022 18:29:30 +0800 Subject: [PATCH 1/2] fix Cursor move up and down error --- .../src/components/text-manage/TextManage.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx b/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx index 43cd700aa9..ddc2c07550 100644 --- a/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx +++ b/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx @@ -146,7 +146,7 @@ export const TextManage = forwardRef( .getElementsByClassName('text-paragraph')[0] .getBoundingClientRect(); - if (rang_form === 'up') { + if (blockTop > blockDomStyle.top) { blockTop = blockDomStyle.bottom - 5; } else { blockTop = blockDomStyle.top + 5; @@ -319,7 +319,7 @@ export const TextManage = forwardRef( if (nowPosition.top === startPosition.top) { editor.selectionManager.activePreviousNode( block.id, - new Point(nowPosition.left, nowPosition.top - 20) + new Point(nowPosition.left, nowPosition.top) ); return true; @@ -357,17 +357,14 @@ export const TextManage = forwardRef( // The specific amount of TODO needs to be determined after subsequent padding editor.selectionManager.activeNextNode( block.id, - new Point(nowPosition.left, nowPosition.bottom + 20) + new Point(nowPosition.left, nowPosition.bottom) ); return true; } else { if (prePosition?.bottom === endPosition.bottom) { editor.selectionManager.activeNextNode( block.id, - new Point( - prePosition.left, - prePosition?.bottom + 20 - ) + new Point(prePosition.left, prePosition?.bottom) ); return true; } else { From b56199c69d46d67107b25569ac1c69aa547e17ed Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Mon, 8 Aug 2022 18:42:42 +0800 Subject: [PATCH 2/2] delete params --- .../editor-blocks/src/components/text-manage/TextManage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx b/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx index ddc2c07550..2e146c7701 100644 --- a/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx +++ b/libs/components/editor-blocks/src/components/text-manage/TextManage.tsx @@ -126,7 +126,7 @@ export const TextManage = forwardRef( // block = await editor.commands.blockCommands.createNextBlock(block.id,) const on_text_view_active = useCallback( - (point: CursorTypes, rang_form?: 'up' | 'down') => { + (point: CursorTypes) => { // TODO code to be optimized if (textRef.current) { const end_selection = textRef.current.getEndSelection();