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
style/text editor/collapsible block: tweak appearance
Adorian Doran634475820014
diff --git a/packages/ckeditor5-collapsible/theme/collapsible.css b/packages/ckeditor5-collapsible/theme/collapsible.cssindex 3e3c419689..2816ca5c3e 100644--- a/packages/ckeditor5-collapsible/theme/collapsible.css+++ b/packages/ckeditor5-collapsible/theme/collapsible.css@@ -48,10 +48,16 @@position: relative;left: calc(0px - var(--_content-indent ) / 2);width: calc(100% + var(--_content-indent));+ padding-left: var(--_arrow-gap);cursor: pointer;font-weight: 500;outline: none;-+ list-style: none; /* native marker replaced by the custom arrow below */++ &::-webkit-details-marker {+ display: none;+ }+&::after {display: block;content: "";@@ -83,10 +89,44 @@}/*- * Editor-only tweaks: summary acts like a regular editable text block, the- * native disclosure marker is hidden, and the custom arrow (a CKEditor UI- * element inserted by the editing downcast) is the only collapse affordance.- * The data/published view is untouched.+ * Custom arrow, shared by every view. In the editor it is a real <span> (inserted by the+ * editing downcast) because it needs click and keyboard handlers; elsewhere that span+ * doesn't exist — the arrow is deliberately not part of the saved HTML — so the data view+ * (read-only text notes, markdown preview) draws it on the summary instead and lets the+ * native <details> toggle do the work. Both share the geometry and the glyph below.+ */+.ck-content details.trilium-collapsible > summary > .trilium-collapsible-arrow,+.ck-content:not(.ck-editor__editable) details.trilium-collapsible > summary::before {+ position: absolute;+ left: 0;+ top: -0.05em;+ width: 1lh;+ height: 1lh;+ display: flex;+ justify-content: center;+ align-items: center;+ font-family: boxicons;+ cursor: pointer;+ user-select: none;+ /* Scaled rather than sized with font-size, so the box keeps the summary's line metrics+ * and the arrow stays centred on the first line of the title. */+ transform: scale(1.3);+ transition: transform 0.15s ease;+}++.ck-content details.trilium-collapsible > summary > .trilium-collapsible-arrow::before,+.ck-content:not(.ck-editor__editable) details.trilium-collapsible > summary::before {+ content: "\ea50";+}++.ck-content details.trilium-collapsible[open] > summary > .trilium-collapsible-arrow,+.ck-content:not(.ck-editor__editable) details.trilium-collapsible[open] > summary::before {+ transform: scale(1.3) rotate(90deg);+}++/*+ * Editor-only tweaks: summary acts like a regular editable text block, and the arrow is the+ * only collapse affordance (clicking the summary text places a caret instead of toggling).*/.ck-editor__editable details.trilium-collapsible {@@ -107,15 +147,8 @@> summary {cursor: text;- list-style: none;- position: relative;- padding-left: var(--_arrow-gap);padding-right: calc(var(--_inline-padding) + 1lh); /* extra space for the handle on the right */- &::-webkit-details-marker {- display: none;- }-/* Block selection handle (mirror of the table widget's drag handle).* Click selects the whole <details>; movement uses Alt+↑/↓ from there.* Sits in the details' top-left padding area, visible on hover. */@@ -143,37 +176,6 @@color: var(--muted-text-color, currentColor);}}--- /* The arrow lands wherever in DOM the conversion mapper ends up putting it,- * but we pin it visually to the left edge of the summary with absolute- * positioning so the title text always reads left-to-right with the arrow first. */- > .trilium-collapsible-arrow {- position: absolute;- left: 0;- top: -0.05em;- cursor: pointer;- user-select: none;- transition: transform 0.15s ease;- width: 1lh;- height: 1lh;-- &::before {- position: absolute;- inset: 0;- content: "";- display: flex;- justify-content: center;- align-items: center;- align-content: center;- font-size: 1.3em;- font-family: boxicons;- }- }- }-- &[open] > summary > .trilium-collapsible-arrow {- transform: rotate(90deg);}&:hover > summary > .trilium-collapsible-handle,