🎨 Support configuring the floating window hover trigger delay (#17123)

* 🎨 Support configuring the floating window hover trigger delay

* 🎨 Support configuring the floating window hover trigger delay
This commit is contained in:
Jeffrey Chen 2026-03-02 23:13:02 +08:00 committed by GitHub
parent ec4424265a
commit 2739def842
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 82 additions and 2 deletions

View file

@ -317,6 +317,13 @@ func setEditor(c *gin.Context) {
editor.HistoryRetentionDays = 3650
}
if nil == editor.FloatWindowDelay {
v := 620
editor.FloatWindowDelay = &v
} else {
*editor.FloatWindowDelay = max(0, min(10000, *editor.FloatWindowDelay))
}
oldVirtualBlockRef := model.Conf.Editor.VirtualBlockRef
oldVirtualBlockRefInclude := model.Conf.Editor.VirtualBlockRefInclude
oldVirtualBlockRefExclude := model.Conf.Editor.VirtualBlockRefExclude

View file

@ -45,6 +45,7 @@ type Editor struct {
ListLogicalOutdent bool `json:"listLogicalOutdent"` // 列表逻辑反向缩进
ListItemDotNumberClickFocus bool `json:"listItemDotNumberClickFocus"` // 单击列表项标记聚焦
FloatWindowMode int `json:"floatWindowMode"` // 浮窗触发模式0光标悬停1按住 Ctrl 悬停2不触发浮窗
FloatWindowDelay *int `json:"floatWindowDelay"` // 浮窗悬停触发延迟,单位:毫秒,默认 620nil 表示未设置
DynamicLoadBlocks int `json:"dynamicLoadBlocks"` // 块动态数,可配置区间 [48, 1024]
Justify bool `json:"justify"` // 是否两端对齐
RTL bool `json:"rtl"` // 是否从右到左显示
@ -87,6 +88,7 @@ func NewEditor() *Editor {
ListLogicalOutdent: false,
ListItemDotNumberClickFocus: true,
FloatWindowMode: 0,
FloatWindowDelay: func() *int { v := 620; return &v }(),
DynamicLoadBlocks: 192,
Justify: false,
RTL: false,

View file

@ -292,6 +292,12 @@ func InitConf() {
if 3650 < Conf.Editor.HistoryRetentionDays {
Conf.Editor.HistoryRetentionDays = 3650
}
if nil == Conf.Editor.FloatWindowDelay {
v := 620
Conf.Editor.FloatWindowDelay = &v
} else {
*Conf.Editor.FloatWindowDelay = max(0, min(10000, *Conf.Editor.FloatWindowDelay))
}
if conf.MinDynamicLoadBlocks > Conf.Editor.DynamicLoadBlocks {
Conf.Editor.DynamicLoadBlocks = conf.MinDynamicLoadBlocks
}