feat(编辑能力): 修复字体编辑错配,优化来源标识
build.yaml / build (push) Successful in 37s

This commit is contained in:
xiaoqidun committed 2026-09-16 19:11:33 +08:00
1 parent 1914b5329a
commit f9646c70e9
8 files changed
+163 -68

No files matched your search

+3 -12
View File
@@ -758,27 +758,18 @@ func editorObjects(index int, text *ofdgo.PageText) ([]any, error) {
return objects, nil
}
// editorFont 读取创作对象的完整内嵌字体,供画布输入使用
// editorFont 读取对象实际使用的内嵌字体,供画布输入使用
// 入参: args 字体资源标识
// 返回: any 字体数据, error 错误信息
func editorFont(args []js.Value) (any, error) {
if currentEditor == nil {
return nil, fmt.Errorf("no document is being edited")
}
fonts, err := currentSession.Reader.Fonts()
data, err := currentSession.Reader.FontData(args[0].String())
if err != nil {
return nil, err
}
for _, font := range fonts {
if font.ID == args[0].String() {
data, err := currentSession.Reader.ResData(font.FontFile)
if err != nil {
return nil, err
}
return successResult(map[string]any{"bytes": bytesToJS(data)}), nil
}
}
return nil, fmt.Errorf("font resource %q not found", args[0].String())
return successResult(map[string]any{"bytes": bytesToJS(data)}), nil
}
// replaceImage 替换图片资源并更新预览