mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-11 16:18:10 +00:00
Retain entered text (and placeholder) upon resize
This commit is contained in:
parent
733526ae63
commit
de2b210e99
@ -59,6 +59,12 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
||||
'',
|
||||
this._onChange(true, true)
|
||||
);
|
||||
this._addAttribute(
|
||||
'placeholder',
|
||||
text,
|
||||
'',
|
||||
this._onChange(true, true)
|
||||
);
|
||||
this._addAttribute(
|
||||
'anchor',
|
||||
anchor,
|
||||
@ -404,6 +410,9 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
||||
{
|
||||
this._pixi.destroy(true);
|
||||
}
|
||||
// Get the currently entered text
|
||||
let enteredText = this._pixi !== undefined? this._pixi.text: '';
|
||||
// Create new TextInput
|
||||
this._pixi = new TextInput(this._getTextInputOptions());
|
||||
|
||||
// listeners required for regular textboxes, but may cause problems with button stimuli
|
||||
@ -425,7 +434,8 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
||||
}
|
||||
if (this._editable)
|
||||
{
|
||||
this._pixi.placeholder = this._text;
|
||||
this.text = enteredText;
|
||||
this._pixi.placeholder = this._placeholder;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user