fix(webui): make large text paste-as-attachment toggleable via settings
Add a user setting 'large_text_paste_as_attachment' (default: on) that lets users paste large text inline instead of having it auto-converted to .md file attachments. The toggle lives in Control Center → Chat tab and persists via settings.json, following the established upstream pattern for boolean settings.
This commit is contained in:
1 parent
2d9da824fe
commit
6b0d8eaadf
6 files changed
+78
No files matched your search
@@ -7776,6 +7776,7 @@ _SETTINGS_DEFAULTS = {
|
||||
"font_size": "default", # small | default | large | xlarge
|
||||
"session_jump_buttons": False, # show Start/End transcript jump pills
|
||||
"render_user_markdown": False, # opt-in: render full markdown in user messages (#3870)
|
||||
"large_text_paste_as_attachment": True, # convert very large composer text pastes into .md attachments by default
|
||||
"structured_code_default_view": "auto", # JSON/YAML fenced-block default render: auto | on | off (#484 follow-up). auto => Tree when line count >= structured_code_auto_tree_lines, else Raw.
|
||||
"structured_code_auto_tree_lines": 10, # in 'auto' mode, minimum line count to default a JSON/YAML block to Tree view (preserves the original hardcoded >=10 behavior)
|
||||
"session_endless_scroll": False, # auto-load older transcript pages while scrolling upward
|
||||
@@ -8023,6 +8024,7 @@ _SETTINGS_BOOL_KEYS = {
|
||||
"api_redact_enabled",
|
||||
"session_jump_buttons",
|
||||
"render_user_markdown",
|
||||
"large_text_paste_as_attachment",
|
||||
"session_endless_scroll",
|
||||
"auto_scroll_follow",
|
||||
"worklog_details_expanded_default",
|
||||
|
||||
@@ -1815,6 +1815,7 @@ function _largeTextPasteLineCount(text){
|
||||
return value.endsWith('\n')?lines.length-1:lines.length;
|
||||
}
|
||||
function _shouldAttachLargePastedText(text){
|
||||
if(window._largeTextPasteAsAttachment===false)return false;
|
||||
const value=String(text||'');
|
||||
if(!value.trim())return false;
|
||||
return value.length>=LARGE_TEXT_PASTE_CHAR_THRESHOLD || _largeTextPasteLineCount(value)>=LARGE_TEXT_PASTE_LINE_THRESHOLD;
|
||||
@@ -2423,6 +2424,7 @@ window._applyTitlebarProfileVisibility=_applyTitlebarProfileVisibility;
|
||||
window._busyInputMode=(s.busy_input_mode||'queue');
|
||||
window._sessionEndlessScrollEnabled=!!s.session_endless_scroll;
|
||||
window._autoScrollFollow=s.auto_scroll_follow!==false;
|
||||
window._largeTextPasteAsAttachment=s.large_text_paste_as_attachment!==false;
|
||||
window._composerControlVisibility=_composerControlVisibilityFromSettings(s);
|
||||
window._showTitlebarProfile=!!s.show_titlebar_profile;
|
||||
_applyTitlebarProfileVisibility();
|
||||
|
||||
@@ -614,6 +614,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar',
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.',
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -2253,6 +2255,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -3883,6 +3887,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -6225,6 +6231,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -7780,6 +7788,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -9016,6 +9026,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -10925,6 +10937,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -11782,6 +11796,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: '在標題列顯示設定檔切換器',
|
||||
settings_desc_show_titlebar_profile: '啟用後,左上角的應用程式標題列會出現設定檔切換按鈕,讓你在任何分頁都能切換設定檔。預設關閉;無論此設定為何,輸入列底部一律保留設定檔切換器。',
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -13309,6 +13325,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -14838,6 +14856,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -16480,6 +16500,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Afficher le sélecteur de profil dans la barre de titre',
|
||||
settings_desc_show_titlebar_profile: 'Lorsqu\'il est activé, un bouton de sélection de profil apparaît dans la barre de titre en haut à gauche de l\'application, vous permettant de changer de profil depuis n\'importe quel onglet. Désactivé par défaut ; le pied de page du compositeur dispose toujours d\'un sélecteur de profil, indépendamment de ce paramètre.',
|
||||
settings_desc_render_user_markdown: 'Lorsqu\'il est activé, le gras, l\'italique, les liens et autres éléments markdown dans vos propres messages sont rendus. Désactivé par défaut ; les blocs de code et les formules mathématiques sont toujours rendus, indépendamment de ce paramètre.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'Blocs de code JSON/YAML',
|
||||
settings_option_structured_code_auto: 'Auto : Arborescence pour les blocs longs',
|
||||
settings_option_structured_code_on: 'Arborescence par défaut',
|
||||
@@ -18078,6 +18100,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Show profile switcher in titlebar', // TODO: translate
|
||||
settings_desc_show_titlebar_profile: 'When enabled, a profile switcher button appears in the top-left app titlebar so you can change profiles from any tab. Off by default; the composer footer always has a profile switcher regardless of this setting.', // TODO: translate
|
||||
settings_desc_render_user_markdown: 'When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'JSON/YAML code blocks',
|
||||
settings_option_structured_code_auto: 'Auto: Tree for long blocks',
|
||||
settings_option_structured_code_on: 'Tree by default',
|
||||
@@ -19728,6 +19752,8 @@ const LOCALES = {
|
||||
settings_option_structured_code_off: 'Domyślnie widok źródła',
|
||||
settings_label_structured_code_auto_lines: 'Próg wierszy dla trybu automatycznego',
|
||||
settings_desc_structured_code: 'Gdy wybrano tryb automatyczny, bloki JSON/YAML o długości przynajmniej podanej liczby wierszy zostaną otwarte w widoku drzewa. Widok drzewa zawsze otwiera strukturyzowaną przeglądarkę; widok źródła zachowuje podświetlony składniowo tekst. Nadal możesz przełączać tryby dla każdego bloku osobno.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_worklog_details_expanded_default: 'Otwieraj szczegóły Worklog automatycznie',
|
||||
settings_desc_worklog_details_expanded_default: 'Gdy ta opcja jest włączona, nowe szczegóły Worklog zaczynają rozwinięte, dzięki czemu karty narzędzi, Thinking i postępu są widoczne bez dodatkowego kliknięcia. Gdy jest wyłączona, szczegóły Worklog pozostają domyślnie zwinięte. Ręczne decyzje o zwinięciu/rozwinięciu w danej turze mają pierwszeństwo.',
|
||||
settings_label_chat_activity_display_mode: 'Wyświetlanie aktywności',
|
||||
@@ -21254,6 +21280,8 @@ const LOCALES = {
|
||||
settings_label_show_titlebar_profile: 'Hiển thị bộ chuyển profile trên thanh tiêu đề',
|
||||
settings_desc_show_titlebar_profile: 'Khi bật, nút chuyển profile sẽ xuất hiện ở góc trên bên trái thanh tiêu đề ứng dụng để bạn đổi profile từ bất kỳ tab nào. Mặc định tắt; chân khung soạn thảo luôn có bộ chuyển profile dù cài đặt này thế nào.',
|
||||
settings_desc_render_user_markdown: 'Khi bật, chữ đậm, chữ nghiêng, liên kết và các Markdown khác trong tin nhắn của bạn sẽ được render. Mặc định tắt; khối code fenced và công thức toán luôn được render bất kể cài đặt này.',
|
||||
settings_label_large_text_paste_as_attachment: 'Attach large pasted text as file',
|
||||
settings_desc_large_text_paste_as_attachment: 'When enabled, long pasted text becomes a .md attachment instead of filling the composer.',
|
||||
settings_label_structured_code: 'Khối code JSON/YAML',
|
||||
settings_option_structured_code_auto: 'Tự động: dạng cây cho khối dài',
|
||||
settings_option_structured_code_on: 'Mặc định dạng cây',
|
||||
|
||||
@@ -1050,6 +1050,13 @@
|
||||
</label>
|
||||
<div style="font-size:11px;color:var(--muted);margin-top:4px" data-i18n="settings_desc_render_user_markdown">When enabled, bold, italic, links, and other markdown in your own messages are rendered. Off by default; fenced code blocks and math always render regardless of this setting.</div>
|
||||
</div>
|
||||
<div class="settings-field" style="margin-top:8px">
|
||||
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
||||
<input type="checkbox" id="settingsLargeTextPasteAsAttachment" style="width:15px;height:15px;accent-color:var(--accent)">
|
||||
<span data-i18n="settings_label_large_text_paste_as_attachment">Attach large pasted text as file</span>
|
||||
</label>
|
||||
<div style="font-size:11px;color:var(--muted);margin-top:4px" data-i18n="settings_desc_large_text_paste_as_attachment">When enabled, long pasted text becomes a .md attachment instead of filling the composer.</div>
|
||||
</div>
|
||||
<div class="settings-field" style="margin-top:8px">
|
||||
<label for="settingsStructuredCodeMode" data-i18n="settings_label_structured_code">JSON/YAML code blocks</label>
|
||||
<select id="settingsStructuredCodeMode" style="width:100%;padding:8px;background:var(--code-bg);color:var(--text);border:1px solid var(--border2);border-radius:6px">
|
||||
|
||||
@@ -7236,6 +7236,7 @@ function _appearancePayloadFromUi(){
|
||||
session_endless_scroll: !!($('settingsSessionEndlessScroll')||{}).checked,
|
||||
auto_scroll_follow: !!($('settingsAutoScrollFollow')||{}).checked,
|
||||
render_user_markdown: !!($('settingsRenderUserMarkdown')||{}).checked,
|
||||
large_text_paste_as_attachment: !!($('settingsLargeTextPasteAsAttachment')||{}).checked,
|
||||
..._structuredCodeViewFromUi(),
|
||||
show_titlebar_profile: !!($('settingsShowTitlebarProfile')||{}).checked,
|
||||
worklog_details_expanded_default: worklogDetailsExpanded,
|
||||
@@ -7325,6 +7326,7 @@ async function _autosaveAppearanceSettings(payload){
|
||||
}
|
||||
window._sessionEndlessScrollEnabled=!!(saved&&saved.session_endless_scroll);
|
||||
window._autoScrollFollow=!saved||saved.auto_scroll_follow!==false;
|
||||
window._largeTextPasteAsAttachment=!saved||saved.large_text_paste_as_attachment!==false;
|
||||
if(saved&&Object.prototype.hasOwnProperty.call(saved,'structured_code_default_view')){
|
||||
// Re-sync from the server-validated/clamped values so the UI and runtime
|
||||
// globals match exactly what was persisted.
|
||||
@@ -7666,6 +7668,15 @@ async function loadSettingsPanel(){
|
||||
_scheduleAppearanceAutosave();
|
||||
};
|
||||
}
|
||||
const largeTextPasteCb=$('settingsLargeTextPasteAsAttachment');
|
||||
if(largeTextPasteCb){
|
||||
largeTextPasteCb.checked=settings.large_text_paste_as_attachment!==false;
|
||||
window._largeTextPasteAsAttachment=largeTextPasteCb.checked;
|
||||
largeTextPasteCb.onchange=function(){
|
||||
window._largeTextPasteAsAttachment=this.checked;
|
||||
_scheduleAppearanceAutosave();
|
||||
};
|
||||
}
|
||||
const structuredCodeModeSel=$('settingsStructuredCodeMode');
|
||||
const structuredCodeLinesField=$('settingsStructuredCodeAutoLines');
|
||||
if(structuredCodeModeSel){
|
||||
@@ -9977,6 +9988,7 @@ function _applySavedSettingsUi(saved, body, opts){
|
||||
window._busyInputMode=body.busy_input_mode||'queue';
|
||||
window._sessionEndlessScrollEnabled=!!body.session_endless_scroll;
|
||||
window._autoScrollFollow=body.auto_scroll_follow!==false;
|
||||
window._largeTextPasteAsAttachment=body.large_text_paste_as_attachment!==false;
|
||||
if(Object.prototype.hasOwnProperty.call(body,'structured_code_default_view')){
|
||||
_applyStructuredCodeViewSettings(body.structured_code_default_view,body.structured_code_auto_tree_lines,false);
|
||||
}
|
||||
@@ -10543,6 +10555,7 @@ async function saveSettings(andClose){
|
||||
body.chat_activity_display_mode=(($('settingsChatActivityDisplayMode')||{}).value==='transparent_stream')?'transparent_stream':'compact_worklog';
|
||||
body.auto_scroll_follow=!!($('settingsAutoScrollFollow')||{}).checked;
|
||||
body.render_user_markdown=!!($('settingsRenderUserMarkdown')||{}).checked;
|
||||
body.large_text_paste_as_attachment=!!($('settingsLargeTextPasteAsAttachment')||{}).checked;
|
||||
Object.assign(body,_structuredCodeViewFromUi());
|
||||
body.language=language;
|
||||
body.show_token_usage=showTokenUsage;
|
||||
|
||||
@@ -4,7 +4,10 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
BOOT_JS = (ROOT / "static" / "boot.js").read_text(encoding="utf-8")
|
||||
CHANGELOG = (ROOT / "CHANGELOG.md").read_text(encoding="utf-8")
|
||||
CONFIG_PY = (ROOT / "api" / "config.py").read_text(encoding="utf-8")
|
||||
I18N_JS = (ROOT / "static" / "i18n.js").read_text(encoding="utf-8")
|
||||
INDEX_HTML = (ROOT / "static" / "index.html").read_text(encoding="utf-8")
|
||||
PANELS_JS = (ROOT / "static" / "panels.js").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_large_text_paste_threshold_helpers_are_defined():
|
||||
@@ -20,6 +23,26 @@ def test_large_text_line_count_does_not_overcount_trailing_newline():
|
||||
assert "return value.endsWith('\\n')?lines.length-1:lines.length;" in BOOT_JS
|
||||
|
||||
|
||||
def test_large_text_paste_attachment_setting_is_server_backed_and_default_on():
|
||||
assert '"large_text_paste_as_attachment": True' in CONFIG_PY
|
||||
bool_keys_start = CONFIG_PY.index("_SETTINGS_BOOL_KEYS")
|
||||
assert '"large_text_paste_as_attachment"' in CONFIG_PY[bool_keys_start:]
|
||||
|
||||
|
||||
def test_large_text_paste_attachment_setting_is_exposed_in_chat_settings():
|
||||
assert 'id="settingsLargeTextPasteAsAttachment"' in INDEX_HTML
|
||||
assert 'data-i18n="settings_label_large_text_paste_as_attachment"' in INDEX_HTML
|
||||
assert 'data-i18n="settings_desc_large_text_paste_as_attachment"' in INDEX_HTML
|
||||
assert "large_text_paste_as_attachment: !!($('settingsLargeTextPasteAsAttachment')||{}).checked" in PANELS_JS
|
||||
assert "largeTextPasteCb.checked=settings.large_text_paste_as_attachment!==false" in PANELS_JS
|
||||
assert "window._largeTextPasteAsAttachment=this.checked" in PANELS_JS
|
||||
|
||||
|
||||
def test_large_text_paste_attachment_setting_hydrates_runtime_gate_default_on():
|
||||
assert "window._largeTextPasteAsAttachment=s.large_text_paste_as_attachment!==false" in BOOT_JS
|
||||
assert "if(window._largeTextPasteAsAttachment===false)return false;" in BOOT_JS
|
||||
|
||||
|
||||
def test_line_threshold_is_one_hundred_lines():
|
||||
assert "const LARGE_TEXT_PASTE_LINE_THRESHOLD=100" in BOOT_JS
|
||||
assert "_largeTextPasteLineCount(value)>=LARGE_TEXT_PASTE_LINE_THRESHOLD" in BOOT_JS
|
||||
@@ -39,6 +62,9 @@ def test_large_text_paste_creates_markdown_file_and_uses_existing_tray():
|
||||
def test_large_text_status_uses_i18n_key_available_to_all_locales():
|
||||
assert "text_pasted: 'Pasted text attached as '," in I18N_JS
|
||||
assert I18N_JS.count("text_pasted:") == I18N_JS.count("image_pasted:")
|
||||
assert "settings_label_large_text_paste_as_attachment" in I18N_JS
|
||||
assert I18N_JS.count("settings_label_large_text_paste_as_attachment") == I18N_JS.count("settings_label_workspace_panel_open")
|
||||
assert I18N_JS.count("settings_desc_large_text_paste_as_attachment") == I18N_JS.count("settings_desc_workspace_panel_open")
|
||||
|
||||
|
||||
def test_paste_handler_keeps_image_paste_path_before_large_text_path():
|
||||
|
||||
Reference in new issue
Block a user