mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 00:11:33 +03:00
Merge pull request #259 from toeverything/bugfex/undo-error
fix undo redo point err
This commit is contained in:
commit
c697f06b9b
@ -4,10 +4,7 @@ import {
|
|||||||
type SlateUtils,
|
type SlateUtils,
|
||||||
type TextProps,
|
type TextProps,
|
||||||
} from '@toeverything/components/common';
|
} from '@toeverything/components/common';
|
||||||
import {
|
import { useOnSelectActive } from '@toeverything/components/editor-core';
|
||||||
useOnSelectActive,
|
|
||||||
useOnSelectSetSelection,
|
|
||||||
} from '@toeverything/components/editor-core';
|
|
||||||
import { styled } from '@toeverything/components/ui';
|
import { styled } from '@toeverything/components/ui';
|
||||||
import { ContentColumnValue } from '@toeverything/datasource/db-service';
|
import { ContentColumnValue } from '@toeverything/datasource/db-service';
|
||||||
import {
|
import {
|
||||||
@ -119,15 +116,6 @@ export const TextManage = forwardRef<ExtendedTextUtils, CreateTextView>(
|
|||||||
|
|
||||||
const properties = block.getProperties();
|
const properties = block.getProperties();
|
||||||
|
|
||||||
const onTextViewSetSelection = (selection: Range | Point) => {
|
|
||||||
if (selection instanceof Point) {
|
|
||||||
//do some thing
|
|
||||||
} else {
|
|
||||||
textRef.current.setSelection(selection);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// block = await editor.commands.blockCommands.createNextBlock(block.id,)
|
|
||||||
const onTextViewActive = useCallback(
|
const onTextViewActive = useCallback(
|
||||||
(point: CursorTypes) => {
|
(point: CursorTypes) => {
|
||||||
// TODO code to be optimized
|
// TODO code to be optimized
|
||||||
@ -209,7 +197,6 @@ export const TextManage = forwardRef<ExtendedTextUtils, CreateTextView>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
useOnSelectActive(block.id, onTextViewActive);
|
useOnSelectActive(block.id, onTextViewActive);
|
||||||
useOnSelectSetSelection<'Range'>(block.id, onTextViewSetSelection);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (textRef.current) {
|
if (textRef.current) {
|
||||||
|
Loading…
Reference in New Issue
Block a user