reiji-h 2 лет назад
Родитель
Сommit
8c57e1aecc

+ 1 - 2
packages/editor/src/components/CodeMirrorEditorComment.tsx

@@ -31,7 +31,7 @@ export const CodeMirrorEditorComment = (props: Props): JSX.Element => {
     return codeMirrorEditor?.appendExtensions?.(additionalExtensions);
   }, [codeMirrorEditor]);
 
-  // setup comment keymap
+  // set handler to comment with ctrl/cmd + Enter key
   useEffect(() => {
     if (onComment == null) {
       return;
@@ -39,7 +39,6 @@ export const CodeMirrorEditorComment = (props: Props): JSX.Element => {
 
     const keymapExtension = keymap.of([
       {
-        // set handler to comment with ctrl/cmd + Enter key
         key: 'Mod-Enter',
         preventDefault: true,
         run: () => {

+ 3 - 4
packages/editor/src/components/CodeMirrorEditorMain.tsx

@@ -32,15 +32,14 @@ export const CodeMirrorEditorMain = (props: Props): JSX.Element => {
     return codeMirrorEditor?.appendExtensions?.(additionalExtensions);
   }, [codeMirrorEditor]);
 
-  // setup page keymap
+  // set handler to save with shortcut key
   useEffect(() => {
     if (onSave == null) {
       return;
     }
 
-    const keymapExtension = keymap.of([
+    const extension = keymap.of([
       {
-        // set handler to save with shortcut key
         key: 'Mod-s',
         preventDefault: true,
         run: () => {
@@ -53,7 +52,7 @@ export const CodeMirrorEditorMain = (props: Props): JSX.Element => {
       },
     ]);
 
-    const cleanupFunction = codeMirrorEditor?.appendExtensions?.(keymapExtension);
+    const cleanupFunction = codeMirrorEditor?.appendExtensions?.(extension);
 
     return cleanupFunction;
   }, [codeMirrorEditor, onSave]);