Merge pull request #9922 from streetwriters/fix/400

mobile: hide toc button if no headings in editor
This commit is contained in:
Ammar Ahmed
2026-06-04 08:54:08 +05:00
committed by GitHub

View File

@@ -139,6 +139,7 @@ function Header({
}): JSX.Element {
const tab = useTabContext();
const editor = editors[tab.id];
const tableOfContents = editorControllers[tab.id]?.getTableOfContents?.();
const insets = useSafeArea();
const openedTabsCount = useTabStore((state) => state.tabs.length);
const [isOpen, setOpen] = useState(false);
@@ -148,6 +149,8 @@ function Header({
state.canGoForward
]);
console.log(tableOfContents?.length);
return (
<div
style={{
@@ -496,6 +499,7 @@ function Header({
</span>
</MenuItem>
{tableOfContents?.length ? (
<MenuItem
value="toc"
style={{
@@ -516,6 +520,8 @@ function Header({
{strings.toc()}
</span>
</MenuItem>
) : null}
<MenuItem
value="scroll-top"
style={{