mirror of
https://github.com/zadam/trilium.git
synced 2026-03-22 08:13:46 +01:00
feat(mermaid): use custom placeholder
This commit is contained in:
parent
2c6bdc79af
commit
5f1486cf6a
@ -2204,6 +2204,7 @@
|
||||
"more_info": "Learn more"
|
||||
},
|
||||
"mermaid": {
|
||||
"placeholder": "Type the content of your Mermaid diagram or use one of the sample diagrams below.",
|
||||
"sample_diagrams": "Sample diagrams:",
|
||||
"sample_flowchart": "Flowchart",
|
||||
"sample_class": "Class",
|
||||
|
||||
@ -19,7 +19,7 @@ interface NoteContentSwitcherProps {
|
||||
export default function NoteContentSwitcher({ text, note, templates }: NoteContentSwitcherProps) {
|
||||
const blob = useNoteSavedData(note?.noteId);
|
||||
|
||||
return (blob?.length === 0 &&
|
||||
return (blob?.trim().length === 0 &&
|
||||
<div className="note-content-switcher">
|
||||
{text}{" "}
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ export interface EditableCodeProps extends TypeWidgetProps, Omit<CodeEditorProps
|
||||
onContentChanged?: (content: string) => void;
|
||||
/** Invoked after the content of the note has been uploaded to the server, using a spaced update. */
|
||||
dataSaved?: () => void;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export function ReadOnlyCode({ note, viewScope, ntxId, parentComponent }: TypeWidgetProps) {
|
||||
@ -74,7 +75,7 @@ function formatViewSource(note: FNote, content: string) {
|
||||
return content;
|
||||
}
|
||||
|
||||
export function EditableCode({ note, ntxId, noteContext, debounceUpdate, parentComponent, updateInterval, noteType = "code", onContentChanged, dataSaved, ...editorProps }: EditableCodeProps) {
|
||||
export function EditableCode({ note, ntxId, noteContext, debounceUpdate, parentComponent, updateInterval, noteType = "code", onContentChanged, dataSaved, placeholder, ...editorProps }: EditableCodeProps) {
|
||||
const editorRef = useRef<VanillaCodeMirror>(null);
|
||||
const containerRef = useRef<HTMLPreElement>(null);
|
||||
const [ vimKeymapEnabled ] = useTriliumOptionBool("vimKeymapEnabled");
|
||||
@ -115,7 +116,7 @@ export function EditableCode({ note, ntxId, noteContext, debounceUpdate, parentC
|
||||
editorRef={editorRef} containerRef={containerRef}
|
||||
mime={mime ?? "text/plain"}
|
||||
className="note-detail-code-editor"
|
||||
placeholder={t("editable_code.placeholder")}
|
||||
placeholder={placeholder ?? t("editable_code.placeholder")}
|
||||
vimKeybindings={vimKeymapEnabled}
|
||||
tabIndex={300}
|
||||
onContentChanged={() => {
|
||||
|
||||
@ -117,6 +117,7 @@ export default function SvgSplitEditor({ ntxId, note, attachmentName, renderSvg,
|
||||
error={error}
|
||||
onContentChanged={onContentChanged}
|
||||
dataSaved={onSave}
|
||||
placeholder={t("mermaid.placeholder")}
|
||||
previewContent={(
|
||||
<RawHtmlBlock
|
||||
className="render-container"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user