MCPcopy Create free account
hub / github.com/MathMan05/Fermi / TextInput

Class TextInput

src/webpage/settings.ts:133–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 div.textContent = str;
132 return div;
133 }
134 last?: Options | string;
135 generateHTMLArea(buttonInfo: Options | string, htmlarea: HTMLElement) {
136 if (this.last) {
137 const elm = this.buttonMap.get(this.last);
138 if (elm) {
139 elm.classList.remove("activeSetting");
140 }
141 }
142 this.last = buttonInfo;
143 const elm = this.buttonMap.get(buttonInfo);
144 if (elm) {
145 elm.classList.add("activeSetting");
146 }
147 let html: HTMLElement;
148 if (buttonInfo instanceof Options) {
149 buttonInfo.subOptions = undefined;
150 html = buttonInfo.generateHTML();
151 } else {
152 html = this.handleString(buttonInfo);
153 }
154
155 htmlarea.innerHTML = "";
156 htmlarea.append(html);
157
158 return html;
159 }
160 changed(html: HTMLElement) {
161 this.warndiv = html;
162 this.buttonList.append(html);
163 }
164 watchForChange() {}
165 save() {}
166 submit() {}
167}
168
169class TextInput implements OptionsElement<string> {
170 readonly label: string;
171 readonly owner: Options;
172 readonly onSubmit: (str: string) => void;
173 value: string;
174 input!: WeakRef<HTMLInputElement>;
175 password: boolean;
176 spaceReplace: string;
177 name: string;
178 charLimit: number;
179 constructor(
180 label: string,
181 onSubmit: (str: string) => void,
182 owner: Options,
183 {initText = "", password = false, spaceReplace = " ", name = "", charLimit = -1} = {},
184 ) {
185 this.label = label;
186 this.value = initText;
187 this.owner = owner;
188 this.onSubmit = onSubmit;
189 this.password = password;
190 this.spaceReplace = spaceReplace;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected