beta/code-blocks (#1)
Reviewed-on: #1 Co-authored-by: obvTiger <obvtiger@epilogue.team> Co-committed-by: obvTiger <obvtiger@epilogue.team>
This commit is contained in:
parent
362b7aa15e
commit
d125640fe7
26 changed files with 1816 additions and 102 deletions
|
@ -55,6 +55,23 @@ class InputElementGenerator {
|
|||
attributes = ' type="range"';
|
||||
}
|
||||
|
||||
// Extract and handle ID attribute
|
||||
let idAttr = "";
|
||||
const idProp = node.props.find(p => typeof p === "string" && p.startsWith("id:"));
|
||||
if (idProp) {
|
||||
const idValue = idProp.substring(idProp.indexOf(":") + 1).trim().replace(/^"|"$/g, "");
|
||||
idAttr = ` id="${idValue}"`;
|
||||
node.elementId = idValue;
|
||||
|
||||
// Register as reactive element with the parent generator
|
||||
if (this.parentGenerator && this.parentGenerator.jsGenerator) {
|
||||
this.parentGenerator.jsGenerator.registerReactiveElement(idValue);
|
||||
if (this.options.debug) {
|
||||
console.log(`[InputElementGenerator] Registered checkbox with ID: ${idValue} as reactive`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const valueProp = node.props.find((p) => p.startsWith("value:"));
|
||||
if (valueProp) {
|
||||
const value = valueProp.substring(valueProp.indexOf(":") + 1).trim();
|
||||
|
@ -70,7 +87,7 @@ class InputElementGenerator {
|
|||
|
||||
if (node.children.length > 0) {
|
||||
let html = `<label class="${className}-container">`;
|
||||
html += `<input class="${className}"${attributes}>`;
|
||||
html += `<input class="${className}"${attributes}${idAttr}>`;
|
||||
|
||||
node.children.forEach((child) => {
|
||||
child.parent = node;
|
||||
|
@ -80,7 +97,7 @@ class InputElementGenerator {
|
|||
html += `</label>`;
|
||||
return html;
|
||||
} else {
|
||||
return `<input class="${className}"${attributes}>`;
|
||||
return `<input class="${className}"${attributes}${idAttr}>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue