Improve editor, plugin updates, and window transfers for 0.1.41
This commit is contained in:
@@ -60,6 +60,16 @@ export function copyTableCells(source: string, range: CellRange): string {
|
||||
return Array.from({ length: bottom - top + 1 }, (_, r) => Array.from({ length: right - left + 1 }, (_, c) => quote(table.rows[sourceRow(top + r)]?.cells[left + c]?.text || "")).join("\t")).join("\n");
|
||||
}
|
||||
|
||||
export function copyTableMarkdown(source: string, range: CellRange): string {
|
||||
const table = parseMarkdownTable(source);
|
||||
if (!table) return "";
|
||||
const { top, bottom, left, right } = bounds(range);
|
||||
const rows = Array.from({ length: bottom - top + 1 }, (_, r) =>
|
||||
`| ${Array.from({ length: right - left + 1 }, (_, c) => table.rows[sourceRow(top + r)]?.cells[left + c]?.text || "").join(" | ")} |`);
|
||||
rows.splice(1, 0, `| ${Array.from({ length: right - left + 1 }, () => "---").join(" | ")} |`);
|
||||
return rows.join("\n");
|
||||
}
|
||||
|
||||
// Parse quoted spreadsheet TSV, including embedded tabs/newlines, or a Markdown table.
|
||||
export function clipboardCells(text: string): string[][] {
|
||||
const table = parseMarkdownTable(text);
|
||||
|
||||
Reference in New Issue
Block a user