mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-06-28 15:45:35 +08:00
实现外链新窗口打开
This commit is contained in:
parent
371459fd3f
commit
f821acf5af
@ -146,7 +146,7 @@ func (m *Document) ReleaseContent(bookId int) {
|
|||||||
content.Find("a").Each(func(i int, contentSelection *goquery.Selection) {
|
content.Find("a").Each(func(i int, contentSelection *goquery.Selection) {
|
||||||
if src, ok := contentSelection.Attr("href"); ok{
|
if src, ok := contentSelection.Attr("href"); ok{
|
||||||
if strings.HasPrefix(src, "http://") || strings.HasPrefix(src,"https://") {
|
if strings.HasPrefix(src, "http://") || strings.HasPrefix(src,"https://") {
|
||||||
beego.Info(src,conf.BaseUrl,strings.HasPrefix(src,conf.BaseUrl))
|
//beego.Info(src,conf.BaseUrl,strings.HasPrefix(src,conf.BaseUrl))
|
||||||
if conf.BaseUrl != "" && !strings.HasPrefix(src,conf.BaseUrl) {
|
if conf.BaseUrl != "" && !strings.HasPrefix(src,conf.BaseUrl) {
|
||||||
contentSelection.SetAttr("target", "_blank")
|
contentSelection.SetAttr("target", "_blank")
|
||||||
if html, err := content.Html();err == nil {
|
if html, err := content.Html();err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user