pxt icon indicating copy to clipboard operation
pxt copied to clipboard

pxtJsonOptions support input type

Open THEb0nny opened this issue 6 months ago • 0 comments

https://github.com/microsoft/pxt/blob/b2f1590599b0db73021aee208b43e2336b9c0180/webapp/src/pxtjson.tsx#L169C22-L169C36

Implementation of fields of another type in pxtJsonOptions. In addition to checkbox, I would like an input in which a string would be entered. I want to implement in pxt-ev3, so that it would be possible to specify a project folder, so that after that the download would occur in this folder, so that it would be created in advance. I have already tested this possibility and it works.

{pxtJsonOptions.map(option =>
    option.type === "checkbox" ? (
        <sui.Checkbox
            key={option.property}
            inputLabel={pxt.Util.rlf(`{id:setting}${option.label}`)}
            checked={!!c?.[option.property as keyof pxt.PackageConfig]}
            onChange={value => this.applyPropertyCheckbox(option, value)}
        />
    ) : option.type === "input" ? (
        <sui.Input
            key={option.property}
            id={option.property}
            ariaLabel={option.label}
            value={(c as any)?.[option.property] || ""}
            onChange={(v: string) => {
                (c as any)[option.property] = v;
                this.parent.forceUpdate();
            }}
            autoComplete={false}
    ) : undefined
)}

THEb0nny avatar Jun 30 '25 17:06 THEb0nny