roymondchen df8790042f feat(editor): 导航菜单支持菜单项溢出收纳,新增 NavMenuColumn 组件
- 抽离每列渲染逻辑为 NavMenuColumn 组件,监听容器宽度
- 容器空间不足时自动隐藏溢出项,并通过更多按钮 Popover 展开
- ToolButton 暴露根元素引用,便于父级测量宽度
- design ButtonProps 新增 bg 属性,用于更多按钮的激活态样式
- 补充 NavMenuColumn / NavMenu / ToolButton 的单元测试

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 19:33:53 +08:00

148 lines
2.5 KiB
SCSS

@use "common/var" as *;
.m-editor-nav-menu {
display: flex;
z-index: 5;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
background-color: $nav--background-color;
font-size: 19.2px;
color: $nav-color;
font-weight: 400;
box-sizing: border-box;
margin: 0px;
flex: 0 0 $nav-height;
border-bottom: 1px solid #d8dee8;
> div {
display: flex;
gap: 3px;
height: 100%;
z-index: 1;
align-items: center;
flex-wrap: nowrap;
overflow: hidden;
position: relative;
min-width: 0;
}
.menu-center {
justify-content: center;
}
.menu-right {
justify-content: flex-end;
}
.m-editor-nav-menu-slot-hidden {
position: absolute;
left: -99999px;
top: 0;
visibility: hidden;
pointer-events: none;
}
.m-editor-nav-menu-more-wrapper {
flex: 0 0 auto;
display: flex;
align-items: center;
height: 100%;
&.m-editor-nav-menu-more-wrapper-hidden {
visibility: hidden;
pointer-events: none;
}
}
.m-editor-nav-menu-more {
flex: 0 0 auto;
}
.menu-item {
flex-direction: row;
flex: 0 0 auto;
-webkit-box-align: center;
align-items: center;
vertical-align: middle;
font-size: 14px;
line-height: 1;
height: 100%;
color: rgba(255, 255, 255, 0.7);
box-sizing: inherit;
z-index: 1;
display: flex !important;
transition: all 0.3s ease 0s;
border-bottom: 2px solid transparent;
margin: 0;
white-space: nowrap;
.is-disabled {
opacity: 0.5;
}
.is-text {
padding: 5px;
}
.is-text > i {
color: $font-color;
}
.icon {
display: flex;
-webkit-box-align: center;
align-items: center;
height: 100%;
padding: 0px 8px;
}
.menu-item-text {
color: $nav-color;
white-space: nowrap;
}
&.rule {
.el-icon {
transform: rotate(-90deg);
}
}
.t-button {
padding-left: 1px;
padding-right: 1px;
}
}
}
.m-editor-nav-menu-popover {
.m-editor-nav-menu-overflow-list {
display: flex;
flex-direction: column;
gap: 4px;
padding: 4px 0;
.menu-item {
display: flex;
align-items: center;
padding: 4px 8px;
cursor: pointer;
border-radius: 4px;
&:hover {
background-color: rgba(0, 0, 0, 0.05);
}
&.divider {
padding: 0;
cursor: default;
&:hover {
background-color: transparent;
}
}
}
}
}