feat(layout/inline-title): support code

This commit is contained in:
Elian Doran 2025-12-13 11:51:57 +02:00
parent 61d3141bce
commit cef14a3b19
No known key found for this signature in database
3 changed files with 13 additions and 9 deletions

View File

@ -20,6 +20,10 @@
} }
} }
.note-split.type-code:not(.mime-text-x-sqlite) .inline-title {
background-color: var(--main-background-color);
}
body.prefers-centered-content .inline-title { body.prefers-centered-content .inline-title {
margin-inline: auto; margin-inline: auto;
} }

View File

@ -1,17 +1,22 @@
import "./InlineTitle.css"; import "./InlineTitle.css";
import { NoteType } from "@triliumnext/commons";
import clsx from "clsx"; import clsx from "clsx";
import { ComponentChild } from "preact";
import { useEffect, useRef, useState } from "preact/hooks"; import { useEffect, useRef, useState } from "preact/hooks";
import { Trans } from "react-i18next";
import FNote from "../../entities/fnote"; import FNote from "../../entities/fnote";
import { formatDateTime } from "../../utils/formatters";
import NoteIcon from "../note_icon"; import NoteIcon from "../note_icon";
import NoteTitleWidget from "../note_title"; import NoteTitleWidget from "../note_title";
import { useNoteContext, useStaticTooltip } from "../react/hooks"; import { useNoteContext, useStaticTooltip } from "../react/hooks";
import { ComponentChild } from "preact";
import { joinElements } from "../react/react_utils"; import { joinElements } from "../react/react_utils";
import { useNoteMetadata } from "../ribbon/NoteInfoTab"; import { useNoteMetadata } from "../ribbon/NoteInfoTab";
import { formatDateTime } from "../../utils/formatters";
import { Trans } from "react-i18next"; const supportedNoteTypes = new Set<NoteType>([
"text", "code"
]);
export default function InlineTitle() { export default function InlineTitle() {
const { note, parentComponent } = useNoteContext(); const { note, parentComponent } = useNoteContext();
@ -60,7 +65,7 @@ export default function InlineTitle() {
function shouldShow(note: FNote | null | undefined) { function shouldShow(note: FNote | null | undefined) {
if (!note) return false; if (!note) return false;
return note.type === "text"; return supportedNoteTypes.has(note.type);
} }
export function NoteTitleDetails() { export function NoteTitleDetails() {

View File

@ -59,11 +59,6 @@ body.experimental-feature-new-layout {
} }
} }
} }
.note-split.type-code:not(.mime-text-x-sqlite) .title-details {
background-color: var(--main-background-color);
}
} }
body.experimental-feature-floating-titlebar { body.experimental-feature-floating-titlebar {