|
|
@@ -9,8 +9,7 @@ import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
|
import { GlobalCodeMirrorEditorKey, AcceptedUploadFileType } from '../../consts';
|
|
|
import { useFileDropzone, FileDropzoneOverlay } from '../../services';
|
|
|
import {
|
|
|
- adjustPasteData,
|
|
|
- // useNewlineAndIndentContinueMarkdownList,
|
|
|
+ getStrFromBol, adjustPasteData,
|
|
|
} from '../../services/list-util/markdown-list-util';
|
|
|
import { useCodeMirrorEditorIsolated } from '../../stores';
|
|
|
|
|
|
@@ -53,28 +52,6 @@ export const CodeMirrorEditor = (props: Props): JSX.Element => {
|
|
|
}, [onChange]);
|
|
|
const { data: codeMirrorEditor } = useCodeMirrorEditorIsolated(editorKey, containerRef.current, cmProps);
|
|
|
|
|
|
- const editor = codeMirrorEditor?.view;
|
|
|
-
|
|
|
- // const newlineAndIndentContinueMarkdownList = useNewlineAndIndentContinueMarkdownList(editor);
|
|
|
-
|
|
|
- // useEffect(() => {
|
|
|
- // const handleEnterKey = (event: KeyboardEvent) => {
|
|
|
- // if (event.key === 'Enter') {
|
|
|
- // event.preventDefault();
|
|
|
- // if (editor == null) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // newlineAndIndentContinueMarkdownList?.(editor);
|
|
|
- // }
|
|
|
- // };
|
|
|
-
|
|
|
- // editor?.dom.addEventListener('keydown', handleEnterKey);
|
|
|
-
|
|
|
- // return () => {
|
|
|
- // editor?.dom.removeEventListener('keydown', handleEnterKey);
|
|
|
- // };
|
|
|
- // }, [codeMirrorEditor, editor, newlineAndIndentContinueMarkdownList]);
|
|
|
-
|
|
|
useEffect(() => {
|
|
|
if (indentSize == null) {
|
|
|
return;
|
|
|
@@ -108,7 +85,7 @@ export const CodeMirrorEditor = (props: Props): JSX.Element => {
|
|
|
|
|
|
const textData = event.clipboardData.getData('text/plain');
|
|
|
|
|
|
- // const strFromBol = getLineToCursor(editor);
|
|
|
+ const strFromBol = getStrFromBol(editor);
|
|
|
|
|
|
const adjusted = adjustPasteData(strFromBol, textData);
|
|
|
|