chore(ui): finish large text paste merge into main

Adds the Turkish dictionary entries main introduced after this branch was
opened, keeps the composer's four-space style in the new paste modules,
and drops the unused offer-action type plus the widening return
annotation flagged by the anti-slop lint.
This commit is contained in:
Bohdan Triapitsyn
2026-08-29 00:30:01 +03:00
parent 63755a8e45
commit 6b17c0b4e2
4 changed files with 44 additions and 35 deletions
@@ -10,13 +10,13 @@ export const LARGE_TEXT_PASTE_CHAR_THRESHOLD = 2000;
export const LARGE_TEXT_PASTE_LINE_THRESHOLD = 25;
const countLines = (text: string): number => {
let lines = 1;
for (let index = 0; index < text.length; index += 1) {
if (text.charCodeAt(index) === 10) {
lines += 1;
let lines = 1;
for (let index = 0; index < text.length; index += 1) {
if (text.charCodeAt(index) === 10) {
lines += 1;
}
}
}
return lines;
return lines;
};
/**
@@ -27,29 +27,29 @@ const countLines = (text: string): number => {
* character count or line count is enough.
*/
export const isLargePlainTextPaste = (
text: string,
options?: {
charThreshold?: number;
lineThreshold?: number;
},
text: string,
options?: {
charThreshold?: number;
lineThreshold?: number;
},
): boolean => {
if (!text || !text.trim()) {
return false;
}
if (!text || !text.trim()) {
return false;
}
const charThreshold = options?.charThreshold ?? LARGE_TEXT_PASTE_CHAR_THRESHOLD;
const lineThreshold = options?.lineThreshold ?? LARGE_TEXT_PASTE_LINE_THRESHOLD;
const charThreshold = options?.charThreshold ?? LARGE_TEXT_PASTE_CHAR_THRESHOLD;
const lineThreshold = options?.lineThreshold ?? LARGE_TEXT_PASTE_LINE_THRESHOLD;
if (text.length >= charThreshold) {
return true;
}
if (text.length >= charThreshold) {
return true;
}
return countLines(text) >= lineThreshold;
return countLines(text) >= lineThreshold;
};
export const createPastedContextFile = (text: string, filename: string): File => (
new File([text], filename, {
type: 'text/plain',
lastModified: Date.now(),
})
new File([text], filename, {
type: 'text/plain',
lastModified: Date.now(),
})
);
@@ -6,11 +6,9 @@
* invalidation pure so ChatInput only wires toast UI to attach/inline actions.
*/
export type LargeTextPasteOfferAction = 'attach' | 'inline';
/** Allocate a new offer id, superseding any unanswered previous offer. */
export const beginLargeTextPasteOffer = (activeOfferId: number): number => (
activeOfferId + 1
activeOfferId + 1
);
/**
@@ -19,15 +17,15 @@ export const beginLargeTextPasteOffer = (activeOfferId: number): number => (
* dismiss/action cannot double-apply.
*/
export const resolveLargeTextPasteOffer = (
activeOfferId: number,
offerId: number,
): { accepted: boolean; nextOfferId: number } => {
if (offerId !== activeOfferId) {
return { accepted: false, nextOfferId: activeOfferId };
}
return { accepted: true, nextOfferId: activeOfferId + 1 };
activeOfferId: number,
offerId: number,
) => {
if (offerId !== activeOfferId) {
return { accepted: false, nextOfferId: activeOfferId };
}
return { accepted: true, nextOfferId: activeOfferId + 1 };
};
/** Toast chrome: widen on desktop only; leave mobile full-width to Sonner. */
export const LARGE_TEXT_PASTE_TOAST_CLASSNAME =
'[&_[data-icon]]:!hidden sm:!min-w-[22rem] sm:!w-auto';
'[&_[data-icon]]:!hidden sm:!min-w-[22rem] sm:!w-auto';
@@ -2000,6 +2000,13 @@ export const settingsDict = {
'settings.openchamber.visual.field.queueMessagesByDefaultTooltip': 'Etkinleştirildiğinde Enter mesajları kuyruğa ekler. Göndermek için {modifier}+Enter kullanın.',
'settings.openchamber.visual.field.persistDraftMessagesAria': 'Taslak mesajları kalıcı olarak sakla',
'settings.openchamber.visual.field.persistDraftMessages': 'Taslak mesajları kalıcı olarak sakla',
'settings.openchamber.visual.field.largeTextPaste': 'Büyük metin yapıştırma',
'settings.openchamber.visual.field.largeTextPasteHint': 'Yaklaşık 2.000 karakterden veya 25 satırdan fazlasını yapıştırırken metnin dosya olarak eklenmesini mi, satır içi yapıştırılmasını mı yoksa her seferinde sorulmasını mı istediğinizi seçin.',
'settings.openchamber.visual.field.largeTextPasteAria': 'Büyük metin yapıştırma davranışı',
'settings.openchamber.visual.field.largeTextPasteOptionAria': 'Büyük metin yapıştırma: {option}',
'settings.openchamber.visual.option.largeTextPaste.ask.label': 'Her seferinde sor',
'settings.openchamber.visual.option.largeTextPaste.attach.label': 'Dosya olarak ekle',
'settings.openchamber.visual.option.largeTextPaste.inline.label': 'Satır içi yapıştır',
'settings.openchamber.visual.field.enableSpellcheckInTextInputsAria': 'Metin girişlerinde yazım denetimini etkinleştir',
'settings.openchamber.visual.field.enableSpellcheckInTextInputs': 'Metin girişlerinde yazım denetimini etkinleştir',
'settings.openchamber.visual.field.sendAnonymousUsageReportsAria': 'Anonim kullanım raporları gönder',
+4
View File
@@ -2272,6 +2272,10 @@ export const dict = {
'chat.chatInput.toast.sendAttachmentsFailed': 'Ekler gönderilemedi. Daha az dosya veya daha küçük görseller deneyin.',
'chat.chatInput.toast.messageSendFailed': 'Mesaj gönderilemedi. Ekler geri yüklendi.',
'chat.chatInput.toast.clipboardAttachFailed': 'Panodan görsel eklenemedi',
'chat.chatInput.toast.clipboardTextAttachFailed': 'Yapıştırılan metin dosya olarak eklenemedi',
'chat.chatInput.toast.largeTextPaste.title': 'Büyük metin algılandı',
'chat.chatInput.toast.largeTextPaste.attach': 'Dosya olarak ekle',
'chat.chatInput.toast.largeTextPaste.inline': 'Satır içi yapıştır',
'chat.chatInput.toast.addedFileMentions': '{count} dosya bahsi eklendi',
'chat.chatInput.toast.attachFileFailed': 'Dosya eklenemedi',
'chat.chatInput.toast.attachNamedFailed': '{name} eklenemedi',