|
|
@ -112,31 +112,6 @@ const MemoEditor = () => {
|
|
|
|
handleSaveBtnClick();
|
|
|
|
handleSaveBtnClick();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (event.key === "b") {
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
editorRef.current.insertText("", "**", "**");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.key === "i") {
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
editorRef.current.insertText("", "*", "*");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.key === "e") {
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
editorRef.current.insertText("", "`", "`");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.key === "k") {
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
const selectedContent = editorRef.current.getSelectedContent();
|
|
|
|
|
|
|
|
editorRef.current.insertText("", "[", "](url)");
|
|
|
|
|
|
|
|
if (selectedContent) {
|
|
|
|
|
|
|
|
const startPos = editorRef.current.getCursorPosition() + 2;
|
|
|
|
|
|
|
|
const endPos = startPos + 3;
|
|
|
|
|
|
|
|
editorRef.current.setCursorPosition(startPos, endPos);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (event.key === "Enter") {
|
|
|
|
if (event.key === "Enter") {
|
|
|
|
const cursorPosition = editorRef.current.getCursorPosition();
|
|
|
|
const cursorPosition = editorRef.current.getCursorPosition();
|
|
|
|