Просмотр исходного кода

Add "None" option to "Main document" menu when no root doc is set (#18102)

GitOrigin-RevId: 5e1cd6bcbf070d7b6a92a1fcd69370361a3e6d3e
Alf Eaton 2 лет назад
Родитель
Сommit
cb97bb5170

+ 9 - 1
services/web/frontend/js/features/editor-left-menu/components/settings/settings-document.tsx

@@ -24,6 +24,14 @@ export default function SettingsDocument() {
       label: doc.path,
     }))
 
+    if (!rootDocId) {
+      mappedDocs.unshift({
+        value: '',
+        label: 'None',
+        disabled: true,
+      })
+    }
+
     return mappedDocs
   }, [docs, rootDocId])
 
@@ -34,7 +42,7 @@ export default function SettingsDocument() {
   return (
     <SettingsMenuSelect
       onChange={setRootDocId}
-      value={rootDocId}
+      value={rootDocId ?? ''}
       options={validDocsOptions}
       label={t('main_document')}
       name="rootDocId"