Skip to content

Commit

Permalink
Update image.go
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonRider0o0 authored May 25, 2023
1 parent a62f6c7 commit 9fff679
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion claat/nodes/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type NewImageNodeOptions struct {
Width float32
Alt string
Title string
Bytes []byte
}

// NewImageNode creates a new ImageNode with the given options.
Expand All @@ -18,6 +19,7 @@ func NewImageNode(opts NewImageNodeOptions) *ImageNode {
Width: opts.Width,
Alt: opts.Alt,
Title: opts.Title,
Bytes: opts.Bytes,
}
}

Expand All @@ -28,11 +30,12 @@ type ImageNode struct {
Width float32
Alt string
Title string
Bytes []byte
}

// Empty returns true if its Src is zero, excluding space runes.
func (in *ImageNode) Empty() bool {
return strings.TrimSpace(in.Src) == ""
return strings.TrimSpace(in.Src) == "" && len(in.Bytes) == 0
}

// ImageNodes extracts everything except NodeImage nodes, recursively.
Expand Down

0 comments on commit 9fff679

Please sign in to comment.