mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 14:53:44 +08:00
feat(附件管理): 完善附件管理功能
This commit is contained in:
1 parent
418a2fa0a7
commit
38004171cf
10 files changed
+254
-42
No files matched your search
@@ -18,7 +18,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"path"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strings"
|
||||
@@ -111,13 +110,14 @@ type DocumentDetails struct {
|
||||
// OutlineInfo 目录节点信息
|
||||
type OutlineInfo = ofdgo.OutlineInfo
|
||||
|
||||
// AttachmentInfo 可见附件信息,Size单位为KB
|
||||
// AttachmentInfo 附件信息,Size单位为KB
|
||||
type AttachmentInfo struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Format string `json:"format,omitempty"`
|
||||
Size *float64 `json:"size,omitempty"`
|
||||
FileName string `json:"fileName"`
|
||||
Visible bool `json:"visible"`
|
||||
}
|
||||
|
||||
// PageInfo 页面信息
|
||||
@@ -419,13 +419,14 @@ func (s *Session) Details() DocumentDetails {
|
||||
info := DocumentDetails{}
|
||||
if attachments, err := s.Reader.Attachments(); err == nil {
|
||||
for _, attachment := range attachments {
|
||||
if attachment.Visible {
|
||||
if attachment.Visible || s.editing {
|
||||
info.Attachments = append(info.Attachments, AttachmentInfo{
|
||||
ID: attachment.ID,
|
||||
Name: attachment.Name,
|
||||
Format: attachment.Format,
|
||||
Size: attachment.Size,
|
||||
FileName: path.Base(s.Reader.ResPath(attachment.FileLoc)),
|
||||
FileName: attachment.FileName(),
|
||||
Visible: attachment.Visible,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user