Improve editor, plugin updates, and window transfers for 0.1.41

This commit is contained in:
Knotty Wyvern
2026-10-21 10:42:44 -07:00
parent 68e86ab6eb
commit 42dd0fa711
56 changed files with 2313 additions and 221 deletions
+13 -1
View File
@@ -1,12 +1,24 @@
import assert from "node:assert/strict";
import test from "node:test";
import { alignTableCells, clipboardCells, copyTableCells, deleteTableCells, formatTableCells, mapTableCells, pasteTableCells } from "../src/lib/editor/tableSelection.ts";
import { alignTableCells, clipboardCells, copyTableCells, copyTableMarkdown, deleteTableCells, formatTableCells, mapTableCells, pasteTableCells } from "../src/lib/editor/tableSelection.ts";
import { htmlToMarkdown } from "../src/lib/workspace/htmlToMarkdown.ts";
import { parseMarkdownTable } from "../src/lib/editor/markdownTable.ts";
import { renderMarkdownHtml, plainInlineMarkdown } from "../src/lib/workspace/noteHtml.ts";
import { tableCellMarkdown } from "../src/lib/editor/tableCellMarkdown.ts";
const source = "| A | B | C |\r\n| --- | :---: | ---: |\r\n| one | two | three |\r\n| four | five | six |\r\n\r\nTail";
const range = { anchor: { row: 2, column: 1 }, head: { row: 1, column: 0 } };
test("selected cells retain table structure and line breaks through HTML clipboard", () => {
const source = "| Name | Notes |\n| --- | --- |\n| **Alpha** | First<br>Second |";
const range = { anchor: { row: 0, column: 0 }, head: { row: 1, column: 1 } };
const copied = copyTableMarkdown(source, range);
const pasted = htmlToMarkdown(renderMarkdownHtml(copied, new Map()));
const table = parseMarkdownTable(pasted)!;
assert.equal(table.columns, 2);
assert.equal(table.rows.length, 3);
assert.equal(table.rows[2].cells[0].text, "**Alpha**");
assert.equal(table.rows[2].cells[1].text, "First<br>Second");
});
test("reversed rectangular selections only change selected cells and preserve CRLF", () => {
const changed = formatTableCells(source, range, "bold");
assert.equal(changed, source.replace("one", "**one**").replace("two", "**two**").replace("four", "**four**").replace("five", "**five**"));