Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(table): stop stretching the colour editor to the row's height
Elian Dorand7cad1741bdd
diff --git a/apps/client/src/widgets/collections/table/columns.css b/apps/client/src/widgets/collections/table/columns.cssindex ea6ac872ee..2b377c26f8 100644--- a/apps/client/src/widgets/collections/table/columns.css+++ b/apps/client/src/widgets/collections/table/columns.css@@ -63,24 +63,3 @@inset-block-start: auto;inset-block-end: 0;}--/*- * The colour picker and the button emptying it, framed as the one group they are — the same group,- * dressed the same way, that the promoted field and the attribute editor show. It sits within the cell- * rather than standing over it, as the select editor does: a swatch and a button ask for no more room- * than a cell has.- *- * All this adds is where it sits: an editing cell gives up its padding and is a line tall, so the pair- * is centred in what is left rather than hanging from the top of it.- */-.table-color-editor.input-group {- height: 100%;- align-items: center;- padding-inline-start: 4px;-- /* A row is only as tall as the text in it, which a column of colours need not be taller than: the- swatch gives up its squareness rather than being cut off by the cell. */- > .label-color-picker {- max-height: 100%;- }-}diff --git a/apps/client/src/widgets/collections/table/columns.tsx b/apps/client/src/widgets/collections/table/columns.tsxindex b033d0714e..8136bc24f3 100644--- a/apps/client/src/widgets/collections/table/columns.tsx+++ b/apps/client/src/widgets/collections/table/columns.tsx@@ -494,14 +494,25 @@ function ColorEditor({ cell, success }: EditorOpts) {}, [ success ]);return (- <div ref={containerRef} className="input-group table-color-editor">- <LabelValueInput- labelType="color"- value={cell.getValue() ?? ""}- // Nothing is what the clear button hands back, and only it — a picker always names a- // colour. There being nothing to follow a clear with, it finishes the edit itself.- onCommit={(value) => !value && success("")}- />+ // Standing over the cell as the multi-valued editor does, and by the same class — not for+ // room, a swatch and a button asking for less than a cell has, but because a cell has+ // however much its row does: in a row grown taller by another cell's wrapped lines, an+ // editor laid within is stretched into the full editing frame, the pair afloat mid-panel.+ <div ref={containerRef} className="table-values-editor table-color-editor">+ {/* Framed as the editor's other fields are, so the pair reads as a field on the+ editor's surface rather than adrift on it. */}+ <div className="tn-field">+ <div className="input-group">+ <LabelValueInput+ labelType="color"+ value={cell.getValue() ?? ""}+ // Nothing is what the clear button hands back, and only it — a picker always+ // names a colour. There being nothing to follow a clear with, it finishes+ // the edit itself.+ onCommit={(value) => !value && success("")}+ />+ </div>+ </div></div>);}