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
client/text editor/CK editor forms: tweak the color picker dropdown
Adorian Doranacecbfa64aa5
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.cssindex c61042bdd6..17ba6df8f1 100644--- a/apps/client/src/stylesheets/theme-next/notes/text.css+++ b/apps/client/src/stylesheets/theme-next/notes/text.css@@ -7,7 +7,8 @@*/.ck.ck-toolbar,-.ck.ck-block-toolbar-button {+.ck.ck-block-toolbar-button,+.ck.ck-color-selector {--ck-color-toolbar-background: transparent;--ck-color-button-default-background: transparent;@@ -363,13 +364,49 @@ div.ck.ck-collapsible {/* Color palette */:root .ck.ck-color-selector .ck-color-grid {--ck-editor-toolbar-button-on-shadow: none; /* Remove the shadow of the selected color button */- --ck-color-grid-gap: 5px;- --ck-color-grid-tile-border-radius: var(--ck-border-radius);- --ck-color-interactive-focus-border: var(--ck-color-focus-border);+ --ck-color-grid-gap: 8px;+ --ck-color-grid-tile-border-radius: 4px;width: auto;}+/* Color tiles, drawn as the cells of ColorPicker.css */+:root .ck.ck-color-selector .ck-color-grid__tile {+ &:is(.ck-on, :hover, :focus) {+ box-shadow: none;+ }++ &.ck-color-selector__color-tile_bordered {+ box-shadow: inset 0 0 0 1px var(--ck-color-border-control);+ }++ &:hover:not(.ck-on, .ck-disabled) {+ transform: scale(1.2);+ }++ &:focus-visible {+ outline: 2px solid var(--input-focus-outline-color);+ outline-offset: 2px;+ }++ &.ck-on .ck-icon {+ display: none;+ }++ /* The selection ring takes the tile's own color, which only its inline background holds. */+ &.ck-on::after {+ content: "";+ position: absolute;+ inset: -4px;+ border: 2px solid transparent;+ border-radius: 8px;+ background: inherit;+ mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);+ mask-clip: padding-box, border-box;+ mask-composite: exclude;+ }+}+/* Color picker button */:root .ck.ck-color-selector .ck-color-grids-fragment .ck-button.ck-color-selector__color-picker {--ck-color-base-border: transparent; /* Remove the top border */@@ -378,15 +415,6 @@ div.ck.ck-collapsible {border-bottom-right-radius: var(--ck-border-radius);}-/* Current color checkmark */-:root .ck.ck-color-selector .ck-color-grid .ck-icon {- color: white;-}--:root .ck.ck-color-selector .ck-color-grid .ck-icon__fill {- fill: black !important;-}-/* Hex color input box prefix */:root .ck.ck-color-selector .ck-color-picker__hash-view {margin-top: var(--ck-input-label-height);diff --git a/apps/client/src/widgets/type_widgets/text/color_palette.spec.ts b/apps/client/src/widgets/type_widgets/text/color_palette.spec.tsindex 188d21da67..f32c9ab139 100644--- a/apps/client/src/widgets/type_widgets/text/color_palette.spec.ts+++ b/apps/client/src/widgets/type_widgets/text/color_palette.spec.ts@@ -29,8 +29,10 @@ describe("buildFontColorConfig", () => {});describe("buildTableColorConfig", () => {- it("gives table and cell borders and backgrounds the same swatches", () => {+ it("gives table and cell borders and backgrounds the same swatches, four to a row", () => {const { tableProperties, tableCellProperties } = buildTableColorConfig();+ expect(tableProperties.colorGridColumns).toBe(4);+ expect(tableCellProperties.colorGridColumns).toBe(4);for (const colors of [tableProperties.borderColors, tableProperties.backgroundColors,tableCellProperties.borderColors, tableCellProperties.backgroundColorsdiff --git a/apps/client/src/widgets/type_widgets/text/color_palette.ts b/apps/client/src/widgets/type_widgets/text/color_palette.tsindex 637926cf7a..b9e3391f85 100644--- a/apps/client/src/widgets/type_widgets/text/color_palette.ts+++ b/apps/client/src/widgets/type_widgets/text/color_palette.ts@@ -13,12 +13,13 @@ export function buildFontColorConfig() {};}-/** The same swatches for the table and cell properties. */+/** The same swatches and rows for the table and cell properties. */export function buildTableColorConfig() {const colors = buildSwatches();+ const palette = { borderColors: colors, backgroundColors: colors, colorGridColumns: 4 };return {- tableProperties: { borderColors: colors, backgroundColors: colors },- tableCellProperties: { borderColors: colors, backgroundColors: colors }+ tableProperties: palette,+ tableCellProperties: palette};}