feat: toggle todo status by clicking (#99)

This commit is contained in:
boojack
2022-07-02 00:56:25 +08:00
committed by GitHub
parent 9611ff7386
commit a7425ac558
5 changed files with 42 additions and 18 deletions

View File

@ -214,7 +214,7 @@ const MemoEditor: React.FC<Props> = () => {
const prevString = currentValue.slice(0, selectionStart);
const nextString = currentValue.slice(selectionStart);
let nextValue = prevString + "# " + nextString;
let nextValue = prevString + "#" + nextString;
let cursorIndex = prevString.length + 1;
if (prevString.endsWith("#") && nextString.startsWith(" ")) {
@ -265,7 +265,7 @@ const MemoEditor: React.FC<Props> = () => {
const handleTagSeletorClick = useCallback((event: React.MouseEvent) => {
if (tagSeletorRef.current !== event.target && tagSeletorRef.current?.contains(event.target as Node)) {
editorRef.current?.insertText((event.target as HTMLElement).textContent ?? "");
editorRef.current?.insertText((event.target as HTMLElement).textContent + " " ?? "");
toggleTagSeletor(false);
}
}, []);