mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 04:59:34 +01:00
fix(mobile): case sheet lift on a partial pan, live placeholder language
- The phone case sheet (#mobileCasePickerModal) is inside .app, so once .app follows a pan it takes the same insideLift as the bars. The layout gap on top lifted it twice (186px above the keyboard at offsetTop 100). Comment, architecture-invariants and a test case updated. - setHoldUntilEnter() writes the placeholder before the unchanged-mode early return, only when the text differs, so a live language switch shows up without touching the rest of the field. - Settings-Reference: Shift+Enter needs a hardware keyboard. - styles.css: the #cjkInput cap is a backstop now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e85bb83353
commit
c639b38c1a
7 files changed
+53
-18
No files matched your search
@@ -677,9 +677,22 @@ const CjkInput = (() => {
|
||||
* since nothing typed has reached the PTY yet. Off: the original live mode.
|
||||
*/
|
||||
setHoldUntilEnter(on) {
|
||||
// The placeholder first, before the early return: App Settings applies a
|
||||
// language switch live and then calls this with the mode unchanged. It is
|
||||
// written only when the text differs, so a field mid-composition is not
|
||||
// touched. i18n.js skips <textarea> subtrees (what is typed there is user
|
||||
// content), so it is translated here, like the prompt composer's.
|
||||
if (_textarea) {
|
||||
const source = !!on
|
||||
? 'Type, Enter to send (Shift+Enter: new line, Esc: clear)'
|
||||
: 'CJK input (Enter = send, Esc = clear)';
|
||||
const i18n = typeof window !== 'undefined' ? window.CodemanI18n : undefined;
|
||||
const placeholder = typeof i18n?.t === 'function' ? i18n.t(source) : source;
|
||||
if (_textarea.placeholder !== placeholder) _textarea.placeholder = placeholder;
|
||||
}
|
||||
// Called on every session select and SSE reconnect: with the mode
|
||||
// unchanged, leave the field alone, since rewriting its attributes while
|
||||
// it has focus can disturb a composition in progress.
|
||||
// unchanged, leave the rest of the field alone, since rewriting its
|
||||
// attributes while it has focus can disturb a composition in progress.
|
||||
if (_holdApplied && _textarea && _hold === !!on) return;
|
||||
const wasHolding = _hold;
|
||||
_hold = !!on;
|
||||
@@ -698,13 +711,6 @@ const CjkInput = (() => {
|
||||
_textarea.setAttribute('autocorrect', v);
|
||||
_textarea.setAttribute('autocapitalize', _hold ? 'sentences' : 'off');
|
||||
_textarea.setAttribute('spellcheck', _hold ? 'true' : 'false');
|
||||
// i18n.js skips <textarea> subtrees (what is typed there is user content),
|
||||
// so the placeholder is translated here, like the prompt composer's.
|
||||
const placeholder = _hold
|
||||
? 'Type, Enter to send (Shift+Enter: new line, Esc: clear)'
|
||||
: 'CJK input (Enter = send, Esc = clear)';
|
||||
const i18n = typeof window !== 'undefined' ? window.CodemanI18n : undefined;
|
||||
_textarea.placeholder = typeof i18n?.t === 'function' ? i18n.t(placeholder) : placeholder;
|
||||
if (_hold) {
|
||||
_cancelDebouncedFlush();
|
||||
_autoGrow();
|
||||
|
||||
@@ -446,7 +446,8 @@ const KeyboardHandler = {
|
||||
// ⚠️ The transform makes .app the box its position:fixed children (header,
|
||||
// toolbar, accessory bar, the field) are placed against, so their keyboard lift
|
||||
// below is measured from .app's bottom, not the layout viewport's, or they would
|
||||
// be lifted twice on a partial pan. The case sheet lives outside .app.
|
||||
// be lifted twice on a partial pan. The case sheet (#mobileCasePickerModal) is
|
||||
// inside .app too and takes the same lift.
|
||||
const appEl = document.querySelector('.app');
|
||||
const pan = isSmallMedium ? Math.round(window.visualViewport.offsetTop || 0) : 0;
|
||||
if (appEl) appEl.style.transform = pan > 0 ? `translateY(${pan}px)` : '';
|
||||
@@ -475,7 +476,7 @@ const KeyboardHandler = {
|
||||
accessoryBar.style.transform = insideLift > 0 ? `translateY(${-insideLift}px)` : '';
|
||||
}
|
||||
if (caseSheet) {
|
||||
caseSheet.style.transform = keyboardOffset > 0 ? `translateY(${-keyboardOffset}px)` : '';
|
||||
caseSheet.style.transform = insideLift > 0 ? `translateY(${-insideLift}px)` : '';
|
||||
}
|
||||
if (main && keyboardHeight > 0) {
|
||||
// The field grows with its text in Send-on-Enter mode, so reserve its
|
||||
|
||||
@@ -14199,9 +14199,10 @@ html:is([data-skin="paper-gray"], [data-skin="solarized-light"], [data-skin="cat
|
||||
resize: none;
|
||||
line-height: 1.4;
|
||||
box-sizing: border-box;
|
||||
/* Send on Enter grows the field with its text (input-cjk.js _autoGrow), and the
|
||||
setting is not limited to phones: cap it everywhere, not only in the
|
||||
.touch-device rule, or on desktop it pushes the terminal (and its PTY) down. */
|
||||
/* A backstop: Send on Enter grows the field with its text only on touch devices
|
||||
(input-cjk.js _autoGrow), where the .touch-device rule caps it too. On desktop
|
||||
it keeps its one-line height, so this cap only guards against anything else
|
||||
setting a taller one, which would push the terminal (and its PTY) down. */
|
||||
max-height: 68px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user