feat(内存占用): 降低复杂文档阅读的内存占用
build.yaml / build (push) Successful in 34s

This commit is contained in:
xiaoqidun committed 2026-09-14 19:54:05 +08:00
1 parent 7f1a16710e
commit aacb83c50f
5 files changed
+211 -24

No files matched your search

+6
View File
@@ -19,6 +19,7 @@ package webui
import (
"bufio"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
@@ -282,6 +283,10 @@ func renderPage(args []js.Value) (any, error) {
for i, font := range page.Fonts {
fonts[i] = map[string]any{"name": font.Name, "weight": font.Weight, "style": font.Style}
}
images := make([]any, len(page.Images))
for i, image := range page.Images {
images[i] = map[string]any{"name": image.Name, "url": "data:" + image.MIME + ";base64," + base64.StdEncoding.EncodeToString(image.Data)}
}
return successResult(map[string]any{
"index": page.Index,
"number": page.Number,
@@ -291,6 +296,7 @@ func renderPage(args []js.Value) (any, error) {
"svg": page.SVG,
"links": links,
"fonts": fonts,
"images": images,
"text": string(textData),
}), nil
}