Browse Source

Fix replacing input with new after peer changing

master
Eduard Kuzmenko 4 years ago
parent
commit
e56c729880
  1. 5
      src/components/chat/input.ts
  2. 2
      src/lib/appManagers/appStateManager.ts
  3. 1
      src/scss/partials/_input.scss
  4. 4
      src/scss/partials/pages/_pages.scss

5
src/components/chat/input.ts

@ -535,6 +535,7 @@ export default class ChatInput {
} }
private attachMessageInputField() { private attachMessageInputField() {
const oldInput = this.messageInputField?.input;
this.messageInputField = new InputField({ this.messageInputField = new InputField({
placeholder: 'Message', placeholder: 'Message',
name: 'message' name: 'message'
@ -545,8 +546,8 @@ export default class ChatInput {
this.attachMessageInputListeners(); this.attachMessageInputListeners();
const container = this.inputScroll.container; const container = this.inputScroll.container;
if(container.firstElementChild) { if(oldInput) {
container.replaceChild(this.messageInputField.input, container.firstElementChild); oldInput.replaceWith(this.messageInputField.input);
} else { } else {
container.append(this.messageInputField.input); container.append(this.messageInputField.input);
} }

2
src/lib/appManagers/appStateManager.ts

@ -60,7 +60,7 @@ export class AppStateManager extends EventListenerBase<{
if(state) { if(state) {
if(state.version != STATE_VERSION) { if(state.version != STATE_VERSION) {
state = {}; state = {};
} else if(((state.stateCreatedTime || 0) + REFRESH_EVERY) < time && false) { } else if(((state.stateCreatedTime || 0) + REFRESH_EVERY) < time/* && false */) {
this.log('will refresh state', state.stateCreatedTime, time); this.log('will refresh state', state.stateCreatedTime, time);
REFRESH_KEYS.forEach(key => { REFRESH_KEYS.forEach(key => {
delete state[key]; delete state[key];

1
src/scss/partials/_input.scss

@ -61,7 +61,6 @@
transition: .2s border-color; transition: .2s border-color;
position: relative; position: relative;
z-index: 1; z-index: 1;
text-align: left;
//line-height: calc(54px - var(--border-width)); //line-height: calc(54px - var(--border-width));
/* overflow: hidden; /* overflow: hidden;
white-space: nowrap; */ white-space: nowrap; */

4
src/scss/partials/pages/_pages.scss

@ -193,4 +193,8 @@
margin-top: 100px; margin-top: 100px;
} }
} }
.input-field {
text-align: center;
}
} }
Loading…
Cancel
Save