Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): draw a full caret in every empty CodeMirror field

Elian Doranbbd39b3f0ecd
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 729dcf4b58..7d107ead05 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -632,6 +632,21 @@ body .cm-editor .cm-placeholder {
color: #999 !important;
}
+.cm-editor .cm-placeholder {
+ /* Out of flow, so the caret takes its height from the line rather than from the hint. */
+ position: absolute;
+}
+
+/* Firefox draws the caret against the spacer CodeMirror puts before the placeholder widget,
+ short (https://bugzilla.mozilla.org/show_bug.cgi?id=904846). The spacer must stay in layout:
+ CodeMirror measures a position next to a widget from its rect, and a hidden one reads as
+ zeros, which hides the completion popup as off-screen. */
+@supports (-moz-appearance: none) {
+ .cm-editor .cm-widgetBuffer:has(+ .cm-placeholder) {
+ vertical-align: baseline;
+ }
+}
+
#sql-console-query {
height: 150px;
width: 100%;
diff --git a/apps/client/src/widgets/ribbon/SearchStringEditor.css b/apps/client/src/widgets/ribbon/SearchStringEditor.css
index e980f5e2e7..0d9ee53088 100644
--- a/apps/client/src/widgets/ribbon/SearchStringEditor.css
+++ b/apps/client/src/widgets/ribbon/SearchStringEditor.css
@@ -97,23 +97,12 @@
}
.cm-placeholder {
- /* Out of flow, so the caret takes its height from the line rather than from the hint. */
- position: absolute;
color: var(--input-placeholder-color, var(--muted-text-color));
font-family: var(--main-font-family);
+ /* The hint names several keys, and the field is one line tall. */
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
-
- /* Firefox draws the caret against the spacer CodeMirror puts before the placeholder widget,
- short (https://bugzilla.mozilla.org/show_bug.cgi?id=904846). The spacer must stay in layout:
- CodeMirror measures a position next to a widget from its rect, and a hidden one reads as
- zeros, which hides the completion popup as off-screen. */
- @supports (-moz-appearance: none) {
- .cm-widgetBuffer:has(+ .cm-placeholder) {
- vertical-align: baseline;
- }
- }
}