style: format frontend, docs and skills with prettier; add .prettierignore
One-time prettier --write so the new format:check CI gate starts green. .prettierignore excludes generated (api-client.ts, documentation.json), vendored (public/cibg-huisstijl), and backend (dotnet format owns it). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,9 +76,15 @@ export function createChip(doc: Document, key: string, label: string, auto = fal
|
||||
return span;
|
||||
}
|
||||
|
||||
function renderNode(node: RichTextNode, labelFor: (key: string) => string, doc: Document, autoFor?: (key: string) => boolean): Node {
|
||||
function renderNode(
|
||||
node: RichTextNode,
|
||||
labelFor: (key: string) => string,
|
||||
doc: Document,
|
||||
autoFor?: (key: string) => boolean,
|
||||
): Node {
|
||||
if (node.type === 'lineBreak') return doc.createElement('br');
|
||||
if (node.type === 'placeholder') return createChip(doc, node.key, labelFor(node.key), autoFor?.(node.key) ?? false);
|
||||
if (node.type === 'placeholder')
|
||||
return createChip(doc, node.key, labelFor(node.key), autoFor?.(node.key) ?? false);
|
||||
let el: Node = doc.createTextNode(node.text);
|
||||
// Nest marks in a canonical order so read-back is deterministic.
|
||||
for (const m of ORDER.filter((x) => node.marks?.includes(x))) {
|
||||
@@ -124,7 +130,10 @@ function readLine(el: HTMLElement): { nodes: RichTextNode[] } {
|
||||
function collect(node: Node, marks: Mark[], out: RichTextNode[]): void {
|
||||
if (node.nodeType === Node.TEXT_NODE) {
|
||||
const text = node.textContent ?? '';
|
||||
if (text !== '') out.push(marks.length ? { type: 'text', text, marks: canonical(marks) } : { type: 'text', text });
|
||||
if (text !== '')
|
||||
out.push(
|
||||
marks.length ? { type: 'text', text, marks: canonical(marks) } : { type: 'text', text },
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (node.nodeType !== Node.ELEMENT_NODE) return;
|
||||
@@ -144,7 +153,11 @@ function collect(node: Node, marks: Mark[], out: RichTextNode[]): void {
|
||||
}
|
||||
|
||||
function isChip(node: Node | null | undefined): node is HTMLElement {
|
||||
return !!node && node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).dataset?.['phKey'] != null;
|
||||
return (
|
||||
!!node &&
|
||||
node.nodeType === Node.ELEMENT_NODE &&
|
||||
(node as HTMLElement).dataset?.['phKey'] != null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +165,11 @@ function isChip(node: Node | null | undefined): node is HTMLElement {
|
||||
* (-1 = before / Backspace, +1 = after / Delete), or null. Chips are contenteditable=false,
|
||||
* which some browsers won't delete on Backspace; the editor uses this to remove them itself.
|
||||
*/
|
||||
export function adjacentChip(container: Node, offset: number, direction: -1 | 1): HTMLElement | null {
|
||||
export function adjacentChip(
|
||||
container: Node,
|
||||
offset: number,
|
||||
direction: -1 | 1,
|
||||
): HTMLElement | null {
|
||||
let sibling: Node | null | undefined;
|
||||
if (container.nodeType === Node.TEXT_NODE) {
|
||||
// Only adjacent when the caret sits at the text edge (otherwise there are chars to delete first).
|
||||
|
||||
Reference in New Issue
Block a user