forked from mbk-lab/rui_orig
Fixed SvgImageView
This commit is contained in:
parent
d1b30c56da
commit
372f5971e8
|
@ -3,6 +3,7 @@ package rui
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,13 +108,26 @@ func (imageView *svgImageViewData) htmlTag() string {
|
||||||
func (imageView *svgImageViewData) htmlSubviews(self View, buffer *strings.Builder) {
|
func (imageView *svgImageViewData) htmlSubviews(self View, buffer *strings.Builder) {
|
||||||
if value := imageView.getRaw(Content); value != nil {
|
if value := imageView.getRaw(Content); value != nil {
|
||||||
if content, ok := value.(string); ok && content != "" {
|
if content, ok := value.(string); ok && content != "" {
|
||||||
if image, ok := resources.images[content]; ok && image.fs != nil {
|
if strings.HasPrefix(content, "@") {
|
||||||
|
if name, ok := imageView.session.ImageConstant(content[1:]); ok {
|
||||||
|
content = name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if image, ok := resources.images[content]; ok {
|
||||||
|
if image.fs != nil {
|
||||||
if data, err := image.fs.ReadFile(image.path); err == nil {
|
if data, err := image.fs.ReadFile(image.path); err == nil {
|
||||||
buffer.WriteString(string(data))
|
buffer.WriteString(string(data))
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
DebugLog(err.Error())
|
DebugLog(err.Error())
|
||||||
}
|
}
|
||||||
|
} else if data, err := os.ReadFile(image.path); err == nil {
|
||||||
|
buffer.WriteString(string(data))
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
DebugLog(err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(content, "http://") || strings.HasPrefix(content, "https://") {
|
if strings.HasPrefix(content, "http://") || strings.HasPrefix(content, "https://") {
|
||||||
|
|
Loading…
Reference in New Issue