Quotes: Various fixes (#3954)
This commit is contained in:
parent
a0c0c58e9b
commit
b0e8a36e72
@ -95,6 +95,7 @@ import buildAttachment, { prepareAttachmentsToSend } from '../middle/composer/he
|
|||||||
import { escapeHtml } from '../middle/composer/helpers/cleanHtml';
|
import { escapeHtml } from '../middle/composer/helpers/cleanHtml';
|
||||||
import { buildCustomEmojiHtml } from '../middle/composer/helpers/customEmoji';
|
import { buildCustomEmojiHtml } from '../middle/composer/helpers/customEmoji';
|
||||||
import { isSelectionInsideInput } from '../middle/composer/helpers/selection';
|
import { isSelectionInsideInput } from '../middle/composer/helpers/selection';
|
||||||
|
import { getPeerColorClass } from './helpers/peerColor';
|
||||||
import renderText from './helpers/renderText';
|
import renderText from './helpers/renderText';
|
||||||
import { getTextWithEntitiesAsHtml } from './helpers/renderTextWithEntities';
|
import { getTextWithEntitiesAsHtml } from './helpers/renderTextWithEntities';
|
||||||
|
|
||||||
@ -166,12 +167,12 @@ type OwnProps = {
|
|||||||
dropAreaState?: string;
|
dropAreaState?: string;
|
||||||
isReady: boolean;
|
isReady: boolean;
|
||||||
isMobile?: boolean;
|
isMobile?: boolean;
|
||||||
onDropHide?: NoneToVoidFunction;
|
|
||||||
inputId: string;
|
inputId: string;
|
||||||
editableInputCssSelector: string;
|
editableInputCssSelector: string;
|
||||||
editableInputId: string;
|
editableInputId: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
inputPlaceholder?: string;
|
inputPlaceholder?: string;
|
||||||
|
onDropHide?: NoneToVoidFunction;
|
||||||
onForward?: NoneToVoidFunction;
|
onForward?: NoneToVoidFunction;
|
||||||
onFocus?: NoneToVoidFunction;
|
onFocus?: NoneToVoidFunction;
|
||||||
onBlur?: NoneToVoidFunction;
|
onBlur?: NoneToVoidFunction;
|
||||||
@ -202,6 +203,7 @@ type StateProps =
|
|||||||
customEmojiForEmoji?: ApiSticker[];
|
customEmojiForEmoji?: ApiSticker[];
|
||||||
groupChatMembers?: ApiChatMember[];
|
groupChatMembers?: ApiChatMember[];
|
||||||
currentUserId?: string;
|
currentUserId?: string;
|
||||||
|
currentUser?: ApiUser;
|
||||||
recentEmojis: string[];
|
recentEmojis: string[];
|
||||||
contentToBeScheduled?: TabState['contentToBeScheduled'];
|
contentToBeScheduled?: TabState['contentToBeScheduled'];
|
||||||
shouldSuggestStickers?: boolean;
|
shouldSuggestStickers?: boolean;
|
||||||
@ -301,6 +303,7 @@ const Composer: FC<OwnProps & StateProps> = ({
|
|||||||
groupChatMembers,
|
groupChatMembers,
|
||||||
topInlineBotIds,
|
topInlineBotIds,
|
||||||
currentUserId,
|
currentUserId,
|
||||||
|
currentUser,
|
||||||
captionLimit,
|
captionLimit,
|
||||||
contentToBeScheduled,
|
contentToBeScheduled,
|
||||||
shouldSuggestStickers,
|
shouldSuggestStickers,
|
||||||
@ -1593,7 +1596,7 @@ const Composer: FC<OwnProps & StateProps> = ({
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<div className="message-input-wrapper">
|
<div className={buildClassName('message-input-wrapper', getPeerColorClass(currentUser))}>
|
||||||
{isInMessageList && (
|
{isInMessageList && (
|
||||||
<>
|
<>
|
||||||
{withBotMenuButton && (
|
{withBotMenuButton && (
|
||||||
@ -1898,6 +1901,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
const botKeyboardMessageId = messageWithActualBotKeyboard ? messageWithActualBotKeyboard.id : undefined;
|
const botKeyboardMessageId = messageWithActualBotKeyboard ? messageWithActualBotKeyboard.id : undefined;
|
||||||
const keyboardMessage = botKeyboardMessageId ? selectChatMessage(global, chatId, botKeyboardMessageId) : undefined;
|
const keyboardMessage = botKeyboardMessageId ? selectChatMessage(global, chatId, botKeyboardMessageId) : undefined;
|
||||||
const { currentUserId } = global;
|
const { currentUserId } = global;
|
||||||
|
const currentUser = selectUser(global, currentUserId!)!;
|
||||||
const defaultSendAsId = chatFullInfo ? chatFullInfo?.sendAsId || currentUserId : undefined;
|
const defaultSendAsId = chatFullInfo ? chatFullInfo?.sendAsId || currentUserId : undefined;
|
||||||
const sendAsId = chat?.sendAsPeerIds && defaultSendAsId && (
|
const sendAsId = chat?.sendAsPeerIds && defaultSendAsId && (
|
||||||
chat.sendAsPeerIds.some((peer) => peer.id === defaultSendAsId)
|
chat.sendAsPeerIds.some((peer) => peer.id === defaultSendAsId)
|
||||||
@ -1957,6 +1961,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
groupChatMembers: chatFullInfo?.members,
|
groupChatMembers: chatFullInfo?.members,
|
||||||
topInlineBotIds: global.topInlineBots?.userIds,
|
topInlineBotIds: global.topInlineBots?.userIds,
|
||||||
currentUserId,
|
currentUserId,
|
||||||
|
currentUser,
|
||||||
contentToBeScheduled: tabState.contentToBeScheduled,
|
contentToBeScheduled: tabState.contentToBeScheduled,
|
||||||
shouldSuggestStickers,
|
shouldSuggestStickers,
|
||||||
shouldSuggestCustomEmoji,
|
shouldSuggestCustomEmoji,
|
||||||
|
|||||||
@ -189,8 +189,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.inside-input {
|
&.inside-input {
|
||||||
padding-inline-start: 0.5625rem;
|
flex-grow: 1;
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
.embedded-thumb {
|
.embedded-thumb {
|
||||||
margin-left: 0.125rem;
|
margin-left: 0.125rem;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { getPeerColorCount, getPeerColorKey } from '../../../global/helpers';
|
|||||||
export function getPeerColorClass(peer?: ApiPeer, noUserColors?: boolean, shouldReset?: boolean) {
|
export function getPeerColorClass(peer?: ApiPeer, noUserColors?: boolean, shouldReset?: boolean) {
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
if (!shouldReset) return undefined;
|
if (!shouldReset) return undefined;
|
||||||
return noUserColors ? 'peer-color-count-0' : 'peer-color-0';
|
return noUserColors ? 'peer-color-count-1' : 'peer-color-0';
|
||||||
}
|
}
|
||||||
return noUserColors ? `peer-color-count-${getPeerColorCount(peer)}` : `peer-color-${getPeerColorKey(peer)}`;
|
return noUserColors ? `peer-color-count-${getPeerColorCount(peer)}` : `peer-color-${getPeerColorKey(peer)}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -392,11 +392,9 @@ function processEntity({
|
|||||||
return <strong data-entity-type={entity.type}>{renderNestedMessagePart()}</strong>;
|
return <strong data-entity-type={entity.type}>{renderNestedMessagePart()}</strong>;
|
||||||
case ApiMessageEntityTypes.Blockquote:
|
case ApiMessageEntityTypes.Blockquote:
|
||||||
return (
|
return (
|
||||||
<div className="message-entity-blockquote-wrapper">
|
<blockquote data-entity-type={entity.type}>
|
||||||
<blockquote data-entity-type={entity.type}>
|
{renderNestedMessagePart()}
|
||||||
{renderNestedMessagePart()}
|
</blockquote>
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
case ApiMessageEntityTypes.BotCommand:
|
case ApiMessageEntityTypes.BotCommand:
|
||||||
return (
|
return (
|
||||||
@ -574,6 +572,11 @@ function processEntityAsHtml(
|
|||||||
>${renderedContent}</span>`;
|
>${renderedContent}</span>`;
|
||||||
case ApiMessageEntityTypes.CustomEmoji:
|
case ApiMessageEntityTypes.CustomEmoji:
|
||||||
return buildCustomEmojiHtmlFromEntity(rawEntityText, entity);
|
return buildCustomEmojiHtmlFromEntity(rawEntityText, entity);
|
||||||
|
case ApiMessageEntityTypes.Blockquote:
|
||||||
|
return `<span
|
||||||
|
class="blockquote"
|
||||||
|
data-entity-type="${ApiMessageEntityTypes.Blockquote}"
|
||||||
|
>${renderedContent}</span>`;
|
||||||
default:
|
default:
|
||||||
return renderedContent;
|
return renderedContent;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -347,6 +347,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
if (!sender) {
|
if (!sender) {
|
||||||
sender = selectPeer(global, fromChatId!);
|
sender = selectPeer(global, fromChatId!);
|
||||||
}
|
}
|
||||||
|
} else if (editingId) {
|
||||||
|
sender = selectSender(global, message!);
|
||||||
}
|
}
|
||||||
|
|
||||||
const forwardsHaveCaptions = forwardedMessages?.some((forward) => (
|
const forwardsHaveCaptions = forwardedMessages?.some((forward) => (
|
||||||
|
|||||||
@ -935,7 +935,7 @@
|
|||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote, .blockquote {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-inline: 0.5rem 1rem;
|
padding-inline: 0.5rem 1rem;
|
||||||
@ -943,6 +943,7 @@ blockquote {
|
|||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: var(--accent-background-color);
|
background-color: var(--accent-background-color);
|
||||||
|
white-space: pre-wrap;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: "";
|
content: "";
|
||||||
@ -967,6 +968,12 @@ blockquote {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Input specific styles
|
||||||
|
.blockquote {
|
||||||
|
display: block;
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes text-loading {
|
@keyframes text-loading {
|
||||||
0% {
|
0% {
|
||||||
background-position-x: 0;
|
background-position-x: 0;
|
||||||
|
|||||||
@ -425,8 +425,10 @@ addActionHandler('clearDraft', (global, actions, payload): ActionReturnType => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newDraft: ApiDraft | undefined = shouldKeepReply ? {
|
const currentReplyInfo = currentDraft.replyInfo;
|
||||||
replyInfo: currentDraft.replyInfo,
|
|
||||||
|
const newDraft: ApiDraft | undefined = shouldKeepReply && currentReplyInfo ? {
|
||||||
|
replyInfo: currentReplyInfo,
|
||||||
} : undefined;
|
} : undefined;
|
||||||
|
|
||||||
if (!isLocalOnly) {
|
if (!isLocalOnly) {
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import {
|
|||||||
checkIfHasUnreadReactions, getMessageContent, getMessageText, isActionMessage,
|
checkIfHasUnreadReactions, getMessageContent, getMessageText, isActionMessage,
|
||||||
isMessageLocal, isUserId,
|
isMessageLocal, isUserId,
|
||||||
} from '../../helpers';
|
} from '../../helpers';
|
||||||
import { getMessageReplyInfo } from '../../helpers/replies';
|
import { getMessageReplyInfo, getStoryReplyInfo } from '../../helpers/replies';
|
||||||
import { addActionHandler, getGlobal, setGlobal } from '../../index';
|
import { addActionHandler, getGlobal, setGlobal } from '../../index';
|
||||||
import {
|
import {
|
||||||
addViewportId,
|
addViewportId,
|
||||||
@ -86,6 +86,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
|
|
||||||
const newMessage = selectChatMessage(global, chatId, id)!;
|
const newMessage = selectChatMessage(global, chatId, id)!;
|
||||||
const replyInfo = getMessageReplyInfo(newMessage);
|
const replyInfo = getMessageReplyInfo(newMessage);
|
||||||
|
const storyReplyInfo = getStoryReplyInfo(newMessage);
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
if (chat?.isForum
|
if (chat?.isForum
|
||||||
&& replyInfo?.isForumTopic
|
&& replyInfo?.isForumTopic
|
||||||
@ -97,7 +98,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
Object.values(global.byTabId).forEach(({ id: tabId }) => {
|
Object.values(global.byTabId).forEach(({ id: tabId }) => {
|
||||||
const isLocal = isMessageLocal(message as ApiMessage);
|
const isLocal = isMessageLocal(message as ApiMessage);
|
||||||
if (selectIsMessageInCurrentMessageList(global, chatId, message as ApiMessage, tabId)) {
|
if (selectIsMessageInCurrentMessageList(global, chatId, message as ApiMessage, tabId)) {
|
||||||
if (isLocal && message.isOutgoing && !(message.content?.action) && !replyInfo?.replyToMsgId
|
if (isLocal && message.isOutgoing && !(message.content?.action) && !storyReplyInfo?.storyId
|
||||||
&& !message.content?.storyData) {
|
&& !message.content?.storyData) {
|
||||||
const currentMessageList = selectCurrentMessageList(global, tabId);
|
const currentMessageList = selectCurrentMessageList(global, tabId);
|
||||||
if (currentMessageList) {
|
if (currentMessageList) {
|
||||||
|
|||||||
@ -142,7 +142,7 @@ addActionHandler('replyToNextMessage', (global, actions, payload): ActionReturnT
|
|||||||
|
|
||||||
let messageId: number | undefined;
|
let messageId: number | undefined;
|
||||||
|
|
||||||
if (!isLatest || !replyInfo) {
|
if (!isLatest || !replyInfo?.replyToMsgId) {
|
||||||
if (threadId === MAIN_THREAD_ID) {
|
if (threadId === MAIN_THREAD_ID) {
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ addActionHandler('replyToNextMessage', (global, actions, payload): ActionReturnT
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const chatMessageKeys = Object.keys(chatMessages);
|
const chatMessageKeys = Object.keys(chatMessages);
|
||||||
const indexOfCurrent = chatMessageKeys.indexOf(replyInfo.toString());
|
const indexOfCurrent = chatMessageKeys.indexOf(replyInfo.replyToMsgId.toString());
|
||||||
const newIndex = indexOfCurrent + targetIndexDelta;
|
const newIndex = indexOfCurrent + targetIndexDelta;
|
||||||
messageId = newIndex <= chatMessageKeys.length + 1 && newIndex >= 0
|
messageId = newIndex <= chatMessageKeys.length + 1 && newIndex >= 0
|
||||||
? Number(chatMessageKeys[newIndex])
|
? Number(chatMessageKeys[newIndex])
|
||||||
|
|||||||
@ -218,7 +218,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.peer-color-count-2, .peer-color-count-3 {
|
.peer-color-count-1,
|
||||||
|
.peer-color-count-2,
|
||||||
|
.peer-color-count-3 {
|
||||||
--accent-background-color: var(--hover-color);
|
--accent-background-color: var(--hover-color);
|
||||||
--accent-background-active-color: var(--active-color);
|
--accent-background-active-color: var(--active-color);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user