Merge remote-tracking branch 'upstream/dev' into theme_switcher
This commit is contained in:
@@ -14,19 +14,22 @@ type bookmarksWidget struct {
|
||||
Color *hslColorField `yaml:"color"`
|
||||
SameTab bool `yaml:"same-tab"`
|
||||
HideArrow bool `yaml:"hide-arrow"`
|
||||
Target string `yaml:"target"`
|
||||
Links []struct {
|
||||
Title string `yaml:"title"`
|
||||
URL string `yaml:"url"`
|
||||
Icon customIconField `yaml:"icon"`
|
||||
Title string `yaml:"title"`
|
||||
URL string `yaml:"url"`
|
||||
Description string `yaml:"description"`
|
||||
Icon customIconField `yaml:"icon"`
|
||||
// we need a pointer to bool to know whether a value was provided,
|
||||
// however there's no way to dereference a pointer in a template so
|
||||
// {{ if not .SameTab }} would return true for any non-nil pointer
|
||||
// which leaves us with no way of checking if the value is true or
|
||||
// false, hence the duplicated fields below
|
||||
SameTabRaw *bool `yaml:"same-tab"`
|
||||
SameTab bool `yaml:"-"`
|
||||
HideArrowRaw *bool `yaml:"hide-arrow"`
|
||||
HideArrow bool `yaml:"-"`
|
||||
SameTabRaw *bool `yaml:"same-tab"`
|
||||
SameTab bool `yaml:"-"`
|
||||
HideArrowRaw *bool `yaml:"hide-arrow"`
|
||||
HideArrow bool `yaml:"-"`
|
||||
Target string `yaml:"target"`
|
||||
} `yaml:"links"`
|
||||
} `yaml:"groups"`
|
||||
}
|
||||
@@ -49,6 +52,18 @@ func (widget *bookmarksWidget) initialize() error {
|
||||
} else {
|
||||
link.HideArrow = *link.HideArrowRaw
|
||||
}
|
||||
|
||||
if link.Target == "" {
|
||||
if group.Target != "" {
|
||||
link.Target = group.Target
|
||||
} else {
|
||||
if link.SameTab {
|
||||
link.Target = ""
|
||||
} else {
|
||||
link.Target = "_blank"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user