MCPcopy Index your code
hub / github.com/simstudioai/sim / findPlaceholderNode

Function findPlaceholderNode

apps/sim/lib/pptx-renderer/renderer/text-renderer.ts:60–87  ·  view source on GitHub ↗

* Find a placeholder node in a list by matching type and/or idx.

(
  placeholders: SafeXmlNode[],
  info: PlaceholderInfo
)

Source from the content-addressed store, hash-verified

58 * Find a placeholder node in a list by matching type and/or idx.
59 */
60function findPlaceholderNode(
61 placeholders: SafeXmlNode[],
62 info: PlaceholderInfo
63): SafeXmlNode | undefined {
64 for (const ph of placeholders) {
65 // Navigate to the ph element to read its attributes
66 let phEl: SafeXmlNode | undefined
67 const nvSpPr = ph.child('nvSpPr')
68 if (nvSpPr.exists()) {
69 phEl = nvSpPr.child('nvPr').child('ph')
70 }
71 if (!phEl || !phEl.exists()) {
72 const nvPicPr = ph.child('nvPicPr')
73 if (nvPicPr.exists()) {
74 phEl = nvPicPr.child('nvPr').child('ph')
75 }
76 }
77 if (!phEl || !phEl.exists()) continue
78
79 const phType = phEl.attr('type')
80 const phIdx = phEl.numAttr('idx')
81
82 // Match by idx first (most specific), then by type
83 if (info.idx !== undefined && phIdx === info.idx) return ph
84 if (info.type && phType === info.type) return ph
85 }
86 return undefined
87}
88
89/**
90 * Extract lstStyle from a placeholder shape node.

Callers 1

renderTextBodyFunction · 0.85

Calls 4

childMethod · 0.80
existsMethod · 0.80
attrMethod · 0.80
numAttrMethod · 0.80

Tested by

no test coverage detected