mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-11 13:33:41 +03:00
fix(cfe-borrow,form-edit,cfe-patch-method): fix borrowed form structure to match Configurator
- cfe-borrow: keep AutoCommandBar ChildItems (buttons) with CommandName=0 instead of stripping them — Configurator expects buttons to be present - form-edit: insert Events section after AutoCommandBar, not before — matches Configurator's element ordering - cfe-patch-method(py): fix \r\r\n double line endings by using newline="" in open() calls Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1078,11 +1078,18 @@ if ($def.formEvents -and $def.formEvents.Count -gt 0) {
|
||||
$eventsSection = $xmlDoc.CreateElement("Events", $formNs)
|
||||
$insertAfter = $root.SelectSingleNode("f:AutoCommandBar", $nsMgr)
|
||||
if ($insertAfter) {
|
||||
$refNode = $insertAfter
|
||||
$ws = $xmlDoc.CreateWhitespace("`r`n`t")
|
||||
# Insert before the AutoCommandBar (Events come before AutoCommandBar in 1C)
|
||||
$root.InsertBefore($ws, $refNode) | Out-Null
|
||||
$root.InsertBefore($eventsSection, $refNode) | Out-Null
|
||||
# Insert after AutoCommandBar (Events come after AutoCommandBar in 1C)
|
||||
$ws1 = $xmlDoc.CreateWhitespace("`r`n`t")
|
||||
$ws2 = $xmlDoc.CreateWhitespace("`r`n`t")
|
||||
if ($insertAfter.NextSibling) {
|
||||
$root.InsertBefore($ws1, $insertAfter.NextSibling) | Out-Null
|
||||
$root.InsertBefore($eventsSection, $ws1) | Out-Null
|
||||
$root.InsertBefore($ws2, $eventsSection) | Out-Null
|
||||
} else {
|
||||
$root.AppendChild($xmlDoc.CreateWhitespace("`r`n`t")) | Out-Null
|
||||
$root.AppendChild($eventsSection) | Out-Null
|
||||
$root.AppendChild($xmlDoc.CreateWhitespace("`r`n")) | Out-Null
|
||||
}
|
||||
} else {
|
||||
$firstChild = $root.FirstChild
|
||||
if ($firstChild) {
|
||||
|
||||
@@ -1162,7 +1162,15 @@ form_events_list = defn.get("formEvents") or []
|
||||
if form_events_list:
|
||||
events_section = root.find("f:Events", NS)
|
||||
if events_section is None:
|
||||
events_section = etree.SubElement(root, f"{{{FORM_NS}}}Events")
|
||||
events_section = etree.Element(f"{{{FORM_NS}}}Events")
|
||||
# Insert after AutoCommandBar (Events come after AutoCommandBar in 1C)
|
||||
acb_node = root.find("f:AutoCommandBar", NS)
|
||||
if acb_node is not None:
|
||||
acb_idx = list(root).index(acb_node)
|
||||
acb_node.tail = (acb_node.tail or "") + "\r\n\t"
|
||||
root.insert(acb_idx + 1, events_section)
|
||||
else:
|
||||
root.append(events_section)
|
||||
|
||||
evt_child_indent = get_child_indent(events_section)
|
||||
if not evt_child_indent:
|
||||
|
||||
Reference in New Issue
Block a user