ugly hack to empty contenteditable div

pull/691/head
Audric Ackermann 6 years ago
parent 49d5106b56
commit db12bf0f3e

@ -125,4 +125,8 @@
const fx = new TextScramble(el); const fx = new TextScramble(el);
fx.setText(sessionID); fx.setText(sessionID);
}; };
window.Session.emptyContentEditableDivs = () => {
window.$('div[contenteditable]').html('');
};
})(); })();

@ -238,7 +238,7 @@ export class RegistrationTabs extends React.Component<{}, State> {
<div className="session-registration__unique-session-id"> <div className="session-registration__unique-session-id">
{window.i18n('yourUniqueSessionID')} {window.i18n('yourUniqueSessionID')}
</div> </div>
{this.renderEnterSessionID(false, this.state.hexGeneratedPubKey)} {this.renderEnterSessionID(false)}
{this.renderSignUpButton()} {this.renderSignUpButton()}
{this.getRenderTermsConditionAgreement()} {this.getRenderTermsConditionAgreement()}
</div> </div>
@ -429,22 +429,20 @@ export class RegistrationTabs extends React.Component<{}, State> {
); );
} }
private renderEnterSessionID(contentEditable: boolean, text?: string) { private renderEnterSessionID(contentEditable: boolean) {
const enterSessionIDHere = window.i18n('enterSessionIDHere'); const enterSessionIDHere = window.i18n('enterSessionIDHere');
return ( return (
<div <div
className="session-signin-enter-session-id" className="session-signin-enter-session-id"
contentEditable={contentEditable}
placeholder={enterSessionIDHere} placeholder={enterSessionIDHere}
contentEditable={contentEditable}
onInput={(e: any) => { onInput={(e: any) => {
if (contentEditable) { if (contentEditable) {
this.onSecondDeviceSessionIDChanged(e); this.onSecondDeviceSessionIDChanged(e);
} }
}} }}
> />
{text}
</div>
); );
} }
@ -532,6 +530,8 @@ export class RegistrationTabs extends React.Component<{}, State> {
displayName: '', displayName: '',
signUpMode: SignUpMode.Default, signUpMode: SignUpMode.Default,
}); });
//FIXME ugly hack to empty the content editable div used on enter session ID
window.Session.emptyContentEditableDivs();
}} }}
buttonType={buttonType} buttonType={buttonType}
text={window.i18n('restoreUsingSeed')} text={window.i18n('restoreUsingSeed')}

Loading…
Cancel
Save