mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
The inline cell editor is a single-line input that drops a value's line breaks on the first change, and it committed on every Enter; the Record view's fields had the same problem. Multi-line values now open in the multi-line editor, Shift+Enter opens it for any cell (from the grid or the inline editor) and Cmd/Ctrl+Enter applies it; CRLF values keep CRLF; the grid marks line breaks with a muted ↵; the Record view uses a text area for multi-line values.
14 lines
573 B
TypeScript
14 lines
573 B
TypeScript
export const CELL_PREVIEW_LIMIT = 1000;
|
|
|
|
/** Bound text layout without changing the underlying value or splitting a surrogate pair. */
|
|
export function cellPreview(value: string): string {
|
|
if (value.length <= CELL_PREVIEW_LIMIT) return value;
|
|
let end = CELL_PREVIEW_LIMIT;
|
|
const last = value.charCodeAt(end - 1);
|
|
if (last >= 0xd800 && last <= 0xdbff) end--;
|
|
return value.slice(0, end) + "\u2026";
|
|
}
|
|
|
|
/** Whether the value spans several lines (a single-line field would drop its line breaks). */
|
|
export const hasLineBreak = (value: string) => /[\r\n]/.test(value);
|