Skip to content

Build your personal knowledge base with Trilium Notes

client/text editor/CK editor forms: fix an issue

Adorian Doran48ae9eda900e
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
index 163021f64d..d1e8d791ce 100644
--- a/apps/client/src/stylesheets/theme-next/notes/text.css
+++ b/apps/client/src/stylesheets/theme-next/notes/text.css
@@ -405,6 +405,10 @@ div.ck.ck-collapsible {
mask-clip: padding-box, border-box;
mask-composite: exclude;
}
+
+ &.ck-color-selector__color-tile_bordered.ck-on::after {
+ background: var(--main-text-color);
+ }
}
/* Color picker button */
@@ -608,6 +612,21 @@ div.ck-template-form .ck-search__info span:nth-child(2) {
border-top: none;
}
+/* Anchors, drawn as a menu item (menus.css, Menu.css) */
+:root .ck.ck-link-form .ck-link-form__providers-list .ck-link__button {
+ border-color: transparent;
+ color: var(--menu-text-color);
+
+ &:is(:hover, :focus-visible):not(.ck-disabled) {
+ background: var(--hover-item-background-color);
+ color: var(--hover-item-text-color);
+ }
+
+ > .ck-icon {
+ color: var(--menu-item-arrow-color);
+ }
+}
+
/* Math popup */
.ck-math-form .ck-labeled-field-view {
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.ts
index f32c9ab139..224f3951e1 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
@@ -12,6 +12,7 @@ const LABELS = [
"Red", "Orange", "Yellow", "Light green", "Green", "Aquamarine", "Turquoise",
"Light blue", "Blue", "Purple", "text-editor.colors.pink"
];
+const BORDERED = [ "Black", "White" ];
describe("buildFontColorConfig", () => {
it("lists four greys, then every note color hue, four to a row", () => {
@@ -19,6 +20,7 @@ describe("buildFontColorConfig", () => {
expect(palette.columns).toBe(4);
expect(palette.colors.map(({ label }) => label)).toEqual(LABELS);
expect(palette.colors.map(({ color }) => color)).toEqual(SOURCES);
+ expect(borderedLabels(palette.colors)).toEqual(BORDERED);
}
});
@@ -39,6 +41,14 @@ describe("buildTableColorConfig", () => {
]) {
expect(colors.map(({ label }) => label)).toEqual(LABELS);
expect(colors.map(({ color }) => color)).toEqual(SOURCES);
+ expect(borderedLabels(colors)).toEqual(BORDERED);
}
});
});
+
+/** The labels of the swatches CKEditor draws with an edge. */
+function borderedLabels(colors: { label: string }[]) {
+ return colors
+ .filter((swatch) => "hasBorder" in swatch && swatch.hasBorder)
+ .map(({ label }) => label);
+}
diff --git a/apps/client/src/widgets/type_widgets/text/color_palette.ts b/apps/client/src/widgets/type_widgets/text/color_palette.ts
index b9e3391f85..19d9d30fb6 100644
--- a/apps/client/src/widgets/type_widgets/text/color_palette.ts
+++ b/apps/client/src/widgets/type_widgets/text/color_palette.ts
@@ -3,7 +3,7 @@ import { DEFAULT_COLOR_PALETTE } from "../../react/ColorPicker.js";
/**
* The swatches of the Font Color and Font Background Color dropdowns: four greys, then the hues of
- * the note color palette.
+ * the note color palette. Black and white have an edge, since either can match a menu's background.
*/
export function buildFontColorConfig() {
const colors = buildSwatches();
@@ -24,10 +24,10 @@ export function buildTableColorConfig() {
}
const GREYS = [
- { color: "#000000", label: "Black" },
+ { color: "#000000", label: "Black", hasBorder: true },
{ color: "#555555", label: "Dim grey" },
{ color: "#aaaaaa", label: "Light grey" },
- { color: "#ffffff", label: "White" }
+ { color: "#ffffff", label: "White", hasBorder: true }
];
/** The names of the `DEFAULT_COLOR_PALETTE` hues, which CKEditor translates on its own. */