Browse Source

Fix forwarding album by forward arrow

Prevent keyboard closening on clicking @via
Hide message input scrollbar
Fix flickering media border in inline helper
Hide checkbox ripple in popups
Hide urls underline in reply markup buttons
master
morethanwords 3 years ago
parent
commit
b5905c428b
  1. 9
      src/components/chat/bubbles.ts
  2. 3
      src/components/chat/input.ts
  3. 8
      src/components/inputField.ts
  4. 2
      src/components/popups/peer.ts
  5. 4
      src/scss/partials/_chatBubble.scss
  6. 5
      src/scss/partials/_chatInlineHelper.scss

9
src/components/chat/bubbles.ts

@ -43,12 +43,12 @@ import LazyLoadQueue from "../lazyLoadQueue";
import ListenerSetter from "../../helpers/listenerSetter"; import ListenerSetter from "../../helpers/listenerSetter";
import PollElement from "../poll"; import PollElement from "../poll";
import AudioElement from "../audio"; import AudioElement from "../audio";
import { KeyboardButton, Message, MessageEntity, MessageReplyHeader, ReplyMarkup, Update } from "../../layer"; import { Message, MessageEntity, MessageReplyHeader, ReplyMarkup, Update } from "../../layer";
import { REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config"; import { REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config";
import { FocusDirection } from "../../helpers/fastSmoothScroll"; import { FocusDirection } from "../../helpers/fastSmoothScroll";
import useHeavyAnimationCheck, { getHeavyAnimationPromise, dispatchHeavyAnimationEvent, interruptHeavyAnimation } from "../../hooks/useHeavyAnimationCheck"; import useHeavyAnimationCheck, { getHeavyAnimationPromise, dispatchHeavyAnimationEvent, interruptHeavyAnimation } from "../../hooks/useHeavyAnimationCheck";
import { fastRaf, fastRafPromise } from "../../helpers/schedulers"; import { fastRaf, fastRafPromise } from "../../helpers/schedulers";
import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise"; import { deferredPromise } from "../../helpers/cancellablePromise";
import RepliesElement from "./replies"; import RepliesElement from "./replies";
import DEBUG from "../../config/debug"; import DEBUG from "../../config/debug";
import { SliceEnd } from "../../helpers/slicedArray"; import { SliceEnd } from "../../helpers/slicedArray";
@ -71,7 +71,6 @@ import whichChild from "../../helpers/dom/whichChild";
import { cancelAnimationByKey } from "../../helpers/animation"; import { cancelAnimationByKey } from "../../helpers/animation";
import assumeType from "../../helpers/assumeType"; import assumeType from "../../helpers/assumeType";
import { EmoticonsDropdown } from "../emoticonsDropdown"; import { EmoticonsDropdown } from "../emoticonsDropdown";
import PopupPickUser from "../popups/pickUser";
const USE_MEDIA_TAILS = false; const USE_MEDIA_TAILS = false;
const IGNORE_ACTIONS: Set<Message.messageService['action']['_']> = new Set([ const IGNORE_ACTIONS: Set<Message.messageService['action']['_']> = new Set([
@ -860,6 +859,7 @@ export default class ChatBubbles {
if(nameDiv.classList.contains('is-via')) { if(nameDiv.classList.contains('is-via')) {
const message = '@' + this.appUsersManager.getUser(peerId).username + ' '; const message = '@' + this.appUsersManager.getUser(peerId).username + ' ';
this.appDraftsManager.setDraft(this.peerId, this.chat.threadId, message); this.appDraftsManager.setDraft(this.peerId, this.chat.threadId, message);
cancelEvent(e);
} else if(savedFrom) { } else if(savedFrom) {
const splitted = savedFrom.split('_'); const splitted = savedFrom.split('_');
const peerId = +splitted[0]; const peerId = +splitted[0];
@ -985,7 +985,8 @@ export default class ChatBubbles {
return; return;
} else if(target.classList.contains('forward')) { } else if(target.classList.contains('forward')) {
const mid = +bubble.dataset.mid; const mid = +bubble.dataset.mid;
new PopupForward(this.peerId, [mid]); const message = this.appMessagesManager.getMessageByPeer(this.peerId, mid);
new PopupForward(this.peerId, this.appMessagesManager.getMidsByMessage(message));
//appSidebarRight.forwardTab.open([mid]); //appSidebarRight.forwardTab.open([mid]);
return; return;
} }

3
src/components/chat/input.ts

@ -813,6 +813,7 @@ export default class ChatInput {
this.messageInputField.input.classList.replace('input-field-input', 'input-message-input'); this.messageInputField.input.classList.replace('input-field-input', 'input-message-input');
this.messageInputField.inputFake.classList.replace('input-field-input', 'input-message-input'); this.messageInputField.inputFake.classList.replace('input-field-input', 'input-message-input');
this.messageInput = this.messageInputField.input; this.messageInput = this.messageInputField.input;
this.messageInput.classList.add('no-scrollbar');
this.attachMessageInputListeners(); this.attachMessageInputListeners();
if(oldInputField) { if(oldInputField) {
@ -1327,7 +1328,7 @@ export default class ChatInput {
} }
this.inlineHelper.checkQuery(this.chat.peerId, username, query).then(({user, renderPromise}) => { this.inlineHelper.checkQuery(this.chat.peerId, username, query).then(({user, renderPromise}) => {
if(needPlaceholder) { if(needPlaceholder && user.bot_inline_placeholder) {
this.messageInput.dataset.inlinePlaceholder = user.bot_inline_placeholder; this.messageInput.dataset.inlinePlaceholder = user.bot_inline_placeholder;
} }

8
src/components/inputField.ts

@ -88,7 +88,7 @@ class InputField {
//public onLengthChange: (length: number, isOverflow: boolean) => void; //public onLengthChange: (length: number, isOverflow: boolean) => void;
protected wasInputFakeClientHeight: number; protected wasInputFakeClientHeight: number;
protected showScrollDebounced: () => void; // protected showScrollDebounced: () => void;
constructor(public options: InputFieldOptions = {}) { constructor(public options: InputFieldOptions = {}) {
this.container = document.createElement('div'); this.container = document.createElement('div');
@ -139,7 +139,7 @@ class InputField {
if(options.animate) { if(options.animate) {
input.classList.add('scrollable', 'scrollable-y'); input.classList.add('scrollable', 'scrollable-y');
this.wasInputFakeClientHeight = 0; this.wasInputFakeClientHeight = 0;
this.showScrollDebounced = debounce(() => this.input.classList.remove('no-scrollbar'), 150, false, true); // this.showScrollDebounced = debounce(() => this.input.classList.remove('no-scrollbar'), 150, false, true);
this.inputFake = document.createElement('div'); this.inputFake = document.createElement('div');
this.inputFake.setAttribute('contenteditable', 'true'); this.inputFake.setAttribute('contenteditable', 'true');
this.inputFake.className = input.className + ' input-field-input-fake'; this.inputFake.className = input.className + ' input-field-input-fake';
@ -223,10 +223,10 @@ class InputField {
public onFakeInput() { public onFakeInput() {
const {scrollHeight, clientHeight} = this.inputFake; const {scrollHeight, clientHeight} = this.inputFake;
if(this.wasInputFakeClientHeight && this.wasInputFakeClientHeight !== clientHeight) { /* if(this.wasInputFakeClientHeight && this.wasInputFakeClientHeight !== clientHeight) {
this.input.classList.add('no-scrollbar'); // ! в сафари может вообще не появиться скролл после анимации, так как ему нужен полный reflow блока с overflow. this.input.classList.add('no-scrollbar'); // ! в сафари может вообще не появиться скролл после анимации, так как ему нужен полный reflow блока с overflow.
this.showScrollDebounced(); this.showScrollDebounced();
} } */
this.wasInputFakeClientHeight = clientHeight; this.wasInputFakeClientHeight = clientHeight;
this.input.style.height = scrollHeight ? scrollHeight + 'px' : ''; this.input.style.height = scrollHeight ? scrollHeight + 'px' : '';

2
src/components/popups/peer.ts

@ -51,7 +51,7 @@ export default class PopupPeer extends PopupElement {
this.container.classList.add('have-checkbox'); this.container.classList.add('have-checkbox');
options.checkboxes.forEach(o => { options.checkboxes.forEach(o => {
o.withRipple = true; o.withRipple = false;
const checkboxField = new CheckboxField(o); const checkboxField = new CheckboxField(o);
o.checkboxField = checkboxField; o.checkboxField = checkboxField;
fragment.append(checkboxField.label); fragment.append(checkboxField.label);

4
src/scss/partials/_chatBubble.scss

@ -2276,6 +2276,10 @@ $bubble-margin: .25rem;
//line-height: var(--line-height); //line-height: var(--line-height);
background: var(--message-highlightning-color); background: var(--message-highlightning-color);
&.anchor-url {
text-decoration: none !important;
}
&:after { &:after {
content: " "; content: " ";
display: block; display: block;

5
src/scss/partials/_chatInlineHelper.scss

@ -57,10 +57,15 @@
} }
} }
.media-container {
border-radius: inherit;
}
.media-photo, .media-video, .media-poster { .media-photo, .media-video, .media-poster {
object-fit: cover; object-fit: cover;
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: inherit;
} }
.gif { .gif {

Loading…
Cancel
Save