MCPcopy
hub / github.com/callumalpass/tasknotes / configureTextSetting

Function configureTextSetting

src/settings/components/settingHelpers.ts:188–219  ·  view source on GitHub ↗
(setting: Setting, options: TextSettingOptions)

Source from the content-addressed store, hash-verified

186 * Helper for configuring a text input setting (works with SettingGroup.addSetting)
187 */
188export function configureTextSetting(setting: Setting, options: TextSettingOptions): Setting {
189 return setting
190 .setName(options.name)
191 .setDesc(options.desc)
192 .addText((text) => {
193 text.setValue(options.getValue());
194
195 // Use debounced onChange if debounceMs is specified
196 const handleChange = (value: string) => {
197 runAsyncSettingCallback(() => options.setValue(value));
198 };
199 if (options.debounceMs && options.debounceMs > 0) {
200 const debouncedSetValue = debounce(handleChange, options.debounceMs);
201 text.onChange(debouncedSetValue);
202 } else {
203 text.onChange(handleChange);
204 }
205
206 if (options.placeholder) {
207 text.setPlaceholder(options.placeholder);
208 }
209
210 if (options.ariaLabel) {
211 text.inputEl.setAttribute("aria-label", options.ariaLabel);
212 }
213
214 // Apply consistent styling
215 text.inputEl.addClass("settings-view__input");
216
217 return text;
218 });
219}
220
221/**
222 * Helper for creating standard text input settings

Callers 5

renderGeneralTabFunction · 0.90
renderIntegrationsTabFunction · 0.90
renderFeaturesTabFunction · 0.90
renderAppearanceTabFunction · 0.90
createTextSettingFunction · 0.85

Calls 9

setDescMethod · 0.80
setPlaceholderMethod · 0.80
debounceFunction · 0.70
setValueMethod · 0.65
addClassMethod · 0.65
addTextMethod · 0.45
setNameMethod · 0.45
getValueMethod · 0.45
onChangeMethod · 0.45

Tested by

no test coverage detected