Jelajahi Sumber

Disable Insert > Comment menu item when no text is selected (#26805)

GitOrigin-RevId: a5fdd662cd487359f9b09212a449d7831bb5dcac
Alf Eaton 1 tahun lalu
induk
melakukan
b410de7c39

+ 2 - 0
services/web/frontend/js/features/ide-redesign/hooks/use-toolbar-menu-editor-commands.tsx

@@ -177,6 +177,7 @@ export const useToolbarMenuBarEditorCommands = () => {
         handler: () => {
         handler: () => {
           commands.addComment()
           commands.addComment()
         },
         },
+        disabled: state.selection.main.empty,
       },
       },
       /************************************
       /************************************
        *         Format menu
        *         Format menu
@@ -286,6 +287,7 @@ export const useToolbarMenuBarEditorCommands = () => {
     newEditor,
     newEditor,
     trackedWrite,
     trackedWrite,
     isTeXFile,
     isTeXFile,
+    state.selection.main.empty,
   ])
   ])
 
 
   const { toggleSymbolPalette } = useEditorPropertiesContext()
   const { toggleSymbolPalette } = useEditorPropertiesContext()