Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

feat(svg-editor): element property display

WodenJay0a069eb05af6
diff --git a/skills/ppt-master/scripts/svg_editor/static/app.js b/skills/ppt-master/scripts/svg_editor/static/app.js
index 410e3371..b7268c01 100644
--- a/skills/ppt-master/scripts/svg_editor/static/app.js
+++ b/skills/ppt-master/scripts/svg_editor/static/app.js
@@ -181,19 +181,23 @@
}
function updateSelectionPanel() {
+ var propsEl = document.getElementById("element-props");
var count = selectedElementIds.size;
+
if (count === 0) {
selectedElementEl.classList.add("empty");
selectedElementEl.innerHTML = "Click an element on the slide to select it";
annotationInput.style.display = "none";
annotationText.value = "";
+ propsEl.style.display = "none";
+ propsEl.innerHTML = "";
return;
}
selectedElementEl.classList.remove("empty");
+ propsEl.style.display = "block";
if (count === 1) {
- // Single select — show tag + id (existing behavior)
var eid = selectedElementIds.values().next().value;
var el = svgContent.querySelector("#" + CSS.escape(eid));
if (el) {
@@ -201,11 +205,12 @@
selectedElementEl.innerHTML =
'<span class="el-tag">&lt;' + escapeHtml(tag) + '&gt;</span>' +
'<span class="el-id">' + escapeHtml(eid) + '</span>';
+ propsEl.innerHTML = renderPropertyTable(getElementProperties(el));
}
} else {
- // Multi select — show count
selectedElementEl.innerHTML =
'<span class="multi-count">' + count + ' elements selected</span>';
+ propsEl.innerHTML = renderMultiSelectSummary(Array.from(selectedElementIds));
}
annotationInput.style.display = "block";
@@ -213,8 +218,8 @@
? "Describe how to modify all " + count + " elements..."
: "Describe how the AI should modify this element...";
annotationText.value = count === 1
- ? (slideAnnotations[selectedElementIds.values().next().value] || "")
- : "";
+ ? (slideAnnotations[selectedElementIds.values().next().value] || "")
+ : "";
annotationText.focus();
}
@@ -594,6 +599,121 @@
return d.innerHTML;
}
+ // ================================================================
+ // Property extraction & rendering
+ // ================================================================
+ function getElementProperties(elem) {
+ var props = {};
+ var tag = elem.tagName.toLowerCase();
+ var style = window.getComputedStyle(elem);
+
+ // Position (common to all)
+ try {
+ var bbox = elem.getBBox();
+ props["position"] = Math.round(bbox.x) + ", " + Math.round(bbox.y);
+ props["size"] = Math.round(bbox.width) + " x " + Math.round(bbox.height);
+ } catch (e) {
+ // no geometry
+ }
+
+ if (tag === "text" || tag === "tspan") {
+ props["font"] = style.fontFamily || elem.getAttribute("font-family") || "";
+ props["font-size"] = style.fontSize || elem.getAttribute("font-size") || "";
+ props["font-weight"] = style.fontWeight || elem.getAttribute("font-weight") || "";
+ props["fill"] = style.fill || elem.getAttribute("fill") || "";
+ props["anchor"] = elem.getAttribute("text-anchor") || style.textAnchor || "";
+ var text = elem.textContent || "";
+ if (text.length > 50) text = text.substring(0, 50) + "...";
+ props["content"] = text;
+ } else if (tag === "rect") {
+ props["fill"] = elem.getAttribute("fill") || style.fill || "";
+ props["stroke"] = elem.getAttribute("stroke") || style.stroke || "";
+ } else if (tag === "circle") {
+ props["r"] = elem.getAttribute("r") || "";
+ props["fill"] = elem.getAttribute("fill") || style.fill || "";
+ props["stroke"] = elem.getAttribute("stroke") || style.stroke || "";
+ } else if (tag === "ellipse") {
+ props["rx"] = elem.getAttribute("rx") || "";
+ props["ry"] = elem.getAttribute("ry") || "";
+ props["fill"] = elem.getAttribute("fill") || style.fill || "";
+ } else if (tag === "image") {
+ var href = elem.getAttribute("href") || elem.getAttribute("xlink:href") || "";
+ var parts = href.split("/");
+ props["file"] = parts[parts.length - 1] || href;
+ } else if (tag === "path") {
+ props["fill"] = elem.getAttribute("fill") || style.fill || "";
+ props["stroke"] = elem.getAttribute("stroke") || style.stroke || "";
+ }
+
+ return props;
+ }
+
+ function renderPropertyTable(props) {
+ var html = '<table class="prop-table">';
+ Object.keys(props).forEach(function (key) {
+ var val = props[key];
+ if (!val) return;
+ html += '<tr><td class="prop-key">' + escapeHtml(key) + '</td><td class="prop-val">';
+ if (key === "fill" || key === "stroke") {
+ html += '<span class="prop-color" style="background:' + escapeHtml(val) + ';"></span>';
+ }
+ html += escapeHtml(val) + '</td></tr>';
+ });
+ html += '</table>';
+ return html;
+ }
+
+ function renderMultiSelectSummary(ids) {
+ var typeCounts = {};
+ var sharedFontSize = null;
+ var allHaveFontSize = true;
+
+ ids.forEach(function (eid) {
+ var el = svgContent.querySelector("#" + CSS.escape(eid));
+ if (!el) return;
+ var tag = el.tagName.toLowerCase();
+ typeCounts[tag] = (typeCounts[tag] || 0) + 1;
+
+ if (tag === "text" || tag === "tspan") {
+ var fs = window.getComputedStyle(el).fontSize || el.getAttribute("font-size") || "";
+ if (sharedFontSize === null) {
+ sharedFontSize = fs;
+ } else if (sharedFontSize !== fs) {
+ sharedFontSize = "mixed";
+ }
+ } else {
+ allHaveFontSize = false;
+ }
+ });
+
+ var summary = '<div class="multi-summary">';
+ var parts = [];
+ Object.keys(typeCounts).forEach(function (tag) {
+ parts.push(typeCounts[tag] + " " + tag);
+ });
+ summary += parts.join(", ");
+
+ if (allHaveFontSize && sharedFontSize && sharedFontSize !== "mixed") {
+ summary += ' | font-size: ' + escapeHtml(sharedFontSize);
+ } else if (allHaveFontSize && sharedFontSize === "mixed") {
+ summary += ' | font-size: mixed';
+ }
+ summary += '</div>';
+
+ // Element list
+ summary += '<div class="multi-el-list">';
+ ids.forEach(function (eid) {
+ var el = svgContent.querySelector("#" + CSS.escape(eid));
+ if (!el) return;
+ var tag = el.tagName.toLowerCase();
+ summary += '<div class="multi-el-item"><span class="el-tag">&lt;' +
+ escapeHtml(tag) + '&gt;</span>' + escapeHtml(eid) + '</div>';
+ });
+ summary += '</div>';
+
+ return summary;
+ }
+
// ================================================================
// Boot
// ================================================================
diff --git a/skills/ppt-master/scripts/svg_editor/static/index.html b/skills/ppt-master/scripts/svg_editor/static/index.html
index 47e3f04d..77dcd2d5 100644
--- a/skills/ppt-master/scripts/svg_editor/static/index.html
+++ b/skills/ppt-master/scripts/svg_editor/static/index.html
@@ -24,6 +24,7 @@
<div id="selection-info">
<div class="section-label">Selected element</div>
<div id="selected-element" class="empty">Click an element on the slide to select it</div>
+ <div id="element-props" style="display:none;"></div>
</div>
<div id="annotation-input" style="display:none;">
<div class="section-label">Edit instruction</div>
diff --git a/skills/ppt-master/scripts/svg_editor/static/style.css b/skills/ppt-master/scripts/svg_editor/static/style.css
index 28eabd39..d70fd246 100644
--- a/skills/ppt-master/scripts/svg_editor/static/style.css
+++ b/skills/ppt-master/scripts/svg_editor/static/style.css
@@ -461,6 +461,78 @@ html, body {
background: #2a2a4a;
}
+/* --- Element properties --- */
+#element-props {
+ margin-top: 10px;
+ font-size: 12px;
+}
+
+.prop-table {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+.prop-table tr {
+ border-bottom: 1px solid #2a2a4a;
+}
+
+.prop-table tr:last-child {
+ border-bottom: none;
+}
+
+.prop-table td {
+ padding: 4px 0;
+ vertical-align: top;
+}
+
+.prop-table .prop-key {
+ color: #7a7a9a;
+ width: 80px;
+ font-size: 11px;
+ text-transform: uppercase;
+ letter-spacing: 0.4px;
+}
+
+.prop-table .prop-val {
+ color: #c0c0d8;
+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
+ font-size: 12px;
+ word-break: break-all;
+}
+
+.prop-table .prop-color {
+ display: inline-block;
+ width: 12px;
+ height: 12px;
+ border-radius: 2px;
+ vertical-align: middle;
+ margin-right: 4px;
+ border: 1px solid #3a3a5a;
+}
+
+.multi-el-list {
+ margin-top: 6px;
+ max-height: 100px;
+ overflow-y: auto;
+ font-size: 11px;
+}
+
+.multi-el-item {
+ padding: 2px 0;
+ color: #7a7a9a;
+}
+
+.multi-el-item .el-tag {
+ font-size: 10px;
+ margin-right: 4px;
+}
+
+.multi-summary {
+ margin-top: 8px;
+ font-size: 12px;
+ color: #a0a0c0;
+}
+
/* --- Multi-select count --- */
.multi-count {
color: #4a9eff;