From dc8cfb66df23d433c25bebc542597ac7a2d01c88 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 21 Jul 2024 07:09:59 +0800 Subject: [PATCH] fix missing trans-text attribute bug --- sui/core/build.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sui/core/build.go b/sui/core/build.go index f1b32eb8..664faaa4 100644 --- a/sui/core/build.go +++ b/sui/core/build.go @@ -271,6 +271,20 @@ func (page *Page) copyChildren(from *goquery.Selection, to *goquery.Selection) e return nil } children.Find("slot").Remove() + + // copy trans-node and trans-text properties + transNode, hasTransNode := from.Attr("s:trans-node") + transText, hasTransText := from.Attr("s:trans-text") + if hasTransNode || hasTransText { + parent := to.Find("children").Parent() + if hasTransNode { + parent.SetAttr("s:trans-node", transNode) + } + if hasTransText { + parent.SetAttr("s:trans-text", transText) + } + } + to.Find("children").ReplaceWithSelection(children) return nil }