Skip to content

Build your personal knowledge base with Trilium Notes

text editor/Mermaid widget: fix an issue when the default content is seen as a placeholder

Adorian Doran0d7c5eb75372
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 4a4d5d750d..e0875a9c6e 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -1311,8 +1311,12 @@ body.mobile .modal-content-with-sidebar > .modal-main > .modal-header > .modal-t
display: flex; /* see https://github.com/zadam/trilium/issues/1590 */
}
-.include-note.ck-placeholder::before {
- /* remove placeholder in otherwise empty note */
+/* CKEditor counts only non-UIElements as content (see `hasContent` in the
+ engine), so a widget rendered entirely from UIElements — an include note, a
+ Mermaid diagram, etc. — looks "empty" to it. When such a widget is the first
+ block, it can wrongly become the editor's placeholder host, overlaying the
+ placeholder text on top of the widget. Suppress it for any widget. */
+.ck-widget.ck-placeholder::before {
content: "" !important;
}
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
index d0941e3c61..424b44550d 100644
--- a/apps/client/src/stylesheets/theme-next/notes/text.css
+++ b/apps/client/src/stylesheets/theme-next/notes/text.css
@@ -594,6 +594,13 @@ button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel).ck
opacity: .5;
}
+/* A widget that CKEditor wrongly flags as the placeholder host (see the
+ `.ck-widget.ck-placeholder` note in style.css) must not be dimmed — its
+ content is real. The overlaid placeholder text is suppressed there. */
+.note-detail-editable-text-editor > .ck-widget.ck-placeholder {
+ opacity: 1;
+}
+
/*
* Code Blocks
*/