mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 23:42:16 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d8ac6ed92 | ||
|
|
d181d9edca |
No files matched your search
@@ -357,7 +357,7 @@
|
||||
<div id="versionActions" class="document-actions" role="group" aria-label="版本操作">
|
||||
<button id="versionAdd" class="button" type="button" title="新增版本" aria-label="新增版本">新增</button>
|
||||
<button id="versionRename" class="button" type="button" title="修改名称" aria-label="修改名称">改名</button>
|
||||
<button id="versionDefault" class="button" type="button" title="默认版本" aria-label="默认版本">默认</button>
|
||||
<button id="versionDefault" class="button" type="button" title="设为默认" aria-label="设为默认">默认</button>
|
||||
<button id="versionDelete" class="button" type="button" title="删除版本" aria-label="删除版本">删除</button>
|
||||
<button id="versionSelect" class="button" type="button" title="切换版本" aria-label="切换版本">切换</button>
|
||||
<button id="versionClose" class="button" type="button">关闭</button>
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
"path"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DocumentVersions 获取当前编辑文档的版本信息,包含尚未写出的修改
|
||||
@@ -117,7 +116,7 @@ func (e *Editor) AddVersion(name string) (string, error) {
|
||||
return 0, err
|
||||
}
|
||||
body := root.childAt("DocBody", reader.documentIndex)
|
||||
location := packageAvailableName(reader, nil, path.Join(path.Dir(entry), "Versions", id+".xml"))
|
||||
location := packageAvailableName(reader, nil, path.Join(path.Dir(entry), "Versions", "Version_"+strconv.FormatInt(int64(index), 10)+".xml"))
|
||||
attrs := ofdAttrs{{Name: xml.Name{Local: "ID"}, Value: id}}
|
||||
format := reader.Version()
|
||||
if reader.versionInfo != nil && reader.versionInfo.Version != "" {
|
||||
@@ -250,8 +249,7 @@ func (e *Editor) RenameVersion(id, name string) error {
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
extension := path.Ext(version.Location)
|
||||
location := packageAvailableName(reader, nil, strings.TrimSuffix(version.Location, extension)+".edit"+extension)
|
||||
location := packageAvailableName(reader, nil, version.Location)
|
||||
body := root.childAt("DocBody", reader.documentIndex)
|
||||
for _, node := range body.child("Versions").children {
|
||||
if node.matchesOFD("Version") && node.attr("ID") == id {
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"maps"
|
||||
"path"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -272,8 +271,7 @@ func (r *Reader) versionOutputChanges(ctx context.Context, changes map[string][]
|
||||
reserved := maps.Clone(parts)
|
||||
var pending []string
|
||||
allocate := func(name string) {
|
||||
extension := path.Ext(name)
|
||||
target := packageAvailableName(r, reserved, strings.TrimSuffix(name, extension)+".edit"+extension)
|
||||
target := packageAvailableName(r, reserved, name)
|
||||
paths[name], reserved[target] = target, nil
|
||||
pending = append(pending, name)
|
||||
}
|
||||
@@ -452,8 +450,7 @@ func (r *Reader) versionManifest(parts map[string][]byte, paths map[string]strin
|
||||
}
|
||||
name := version.Location
|
||||
if shared[name] {
|
||||
extension := path.Ext(name)
|
||||
name = packageAvailableName(r, parts, strings.TrimSuffix(name, extension)+".edit"+extension)
|
||||
name = packageAvailableName(r, parts, name)
|
||||
entry, ok := parts["OFD.xml"]
|
||||
if !ok {
|
||||
entry, err = r.readFile("OFD.xml")
|
||||
|
||||
Reference in new issue
Block a user