1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-11 16:18:10 +00:00

Merge pull request #406 from thewhodidthis/bf#404--textbox

visual/TextBox: add clear method, tweak reset to take editable into account
This commit is contained in:
Alain Pitiot 2021-06-15 19:28:34 +02:00 committed by GitHub
commit 9cecf2984f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,17 +178,33 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
/**
* Clears the current text value.
* Clears the current text value or sets it back to match the placeholder.
*
* @name module:visual.TextBox#reset
* @public
*/
reset()
{
const text = this.editable ? '' : this.placeholder;
this.setText(this.placeholder);
}
/**
* Clears the current text value.
*
* @name module:visual.TextBox#clear
* @public
*/
clear()
{
this.setText();
}
/**
* For tweaking the underlying input value.
*