From ef499efcbdc4e99139203046241fa1e6ce890816 Mon Sep 17 00:00:00 2001 From: yangxiaolang <1810849666@qq.com> Date: Wed, 21 Jan 2026 16:40:00 +0800 Subject: [PATCH] feat: outline position --- styles/doc-layout.css | 37 ++++++++++++++++++++++++- theme/components/EditOnGithub/index.tsx | 29 +++++++++++-------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/styles/doc-layout.css b/styles/doc-layout.css index f5be273..c7b9420 100644 --- a/styles/doc-layout.css +++ b/styles/doc-layout.css @@ -88,7 +88,7 @@ top: calc(var(--rp-nav-height) + var(--rp-banner-height, 0px)); margin-top: var(--rp-sidebar-menu-height); z-index: var(--rp-z-index-aside); - padding-top: var(--rp-content-padding-y); + padding-top: 0; scrollbar-width: none; max-height: calc(100vh - var(--rp-nav-height) - var(--rp-banner-height, 0px)); box-shadow: var(--rp-shadow-1); @@ -97,6 +97,22 @@ overflow: hidden scroll; } +/* beforeOutline sticky 容器 */ +.edit-on-github { + margin-top: calc(-1 * var(--rp-content-padding-y)); + background: var(--rp-c-bg); +} + +.edit-on-github__mask { + height: var(--rp-content-padding-y); + background: var(--rp-c-bg); +} + +.edit-on-github__content { + padding-bottom: 8px; + background: var(--rp-c-bg); +} + .rp-doc-layout__menu { top: calc(var(--rp-nav-height) + var(--rp-banner-height, 0px)); z-index: var(--rp-z-index-sidebar-menu); @@ -203,3 +219,22 @@ transform: translate3d(0, 0, 0); } } + +.edit-on-github{ + margin-top:0 !important; +} + +.rp-doc-layout__outline{ + padding-top:0 !important; +} + +/* Outline 标题 sticky 定位 */ +.rp-outline__title { + position: sticky; + top: calc(var(--rp-content-padding-y) + 59px); + background: var(--rp-c-bg); + z-index: 10; + padding-top: 8px; + padding-bottom: 8px; + margin-top: -8px; +} \ No newline at end of file diff --git a/theme/components/EditOnGithub/index.tsx b/theme/components/EditOnGithub/index.tsx index 7209ad7..87b077c 100644 --- a/theme/components/EditOnGithub/index.tsx +++ b/theme/components/EditOnGithub/index.tsx @@ -46,18 +46,23 @@ export const EditOnGithub = () => { const t = useI18n(); return ( -
-
- - - {t("edit_page")} - -
-
- - - {t("create_issue")} - +
+ {/* 48px 遮罩层,用于隐藏滚动上来的 outline 内容 */} +
+ {/* 实际内容 */} +
+ +
);