feat(editor): open the author form directly on an empty byline
Browse files
frontend/src/editor/frontmatter/AuthorsManager.tsx
CHANGED
|
@@ -49,13 +49,16 @@ export function AuthorsManager({
|
|
| 49 |
if (!dialog) return;
|
| 50 |
if (open && !dialog.open) {
|
| 51 |
setEditingIndex(null);
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
| 53 |
setShowAffiliations(false);
|
| 54 |
dialog.showModal();
|
| 55 |
} else if (!open && dialog.open) {
|
| 56 |
dialog.close();
|
| 57 |
}
|
| 58 |
-
}, [open]);
|
| 59 |
|
| 60 |
useEffect(() => {
|
| 61 |
const dialog = dialogRef.current;
|
|
|
|
| 49 |
if (!dialog) return;
|
| 50 |
if (open && !dialog.open) {
|
| 51 |
setEditingIndex(null);
|
| 52 |
+
// Empty byline: the only sensible next step is adding an author,
|
| 53 |
+
// so surface the blank form immediately instead of making the
|
| 54 |
+
// user click "Add author" a second time inside the modal.
|
| 55 |
+
setAdding(authors.length === 0);
|
| 56 |
setShowAffiliations(false);
|
| 57 |
dialog.showModal();
|
| 58 |
} else if (!open && dialog.open) {
|
| 59 |
dialog.close();
|
| 60 |
}
|
| 61 |
+
}, [open, authors.length]);
|
| 62 |
|
| 63 |
useEffect(() => {
|
| 64 |
const dialog = dialogRef.current;
|