mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 23:05:51 +01:00
feat(react/floating_buttons): port PNG/SVG export buttons
This commit is contained in:
@@ -94,6 +94,12 @@ const FLOATING_BUTTON_DEFINITIONS: FloatingButtonDefinition[] = [
|
||||
isEnabled: ({ note, noteContext }) =>
|
||||
["mermaid", "canvas", "mindMap"].includes(note?.type ?? "")
|
||||
&& note?.isContentAvailable() && noteContext.viewScope?.viewMode === "default"
|
||||
},
|
||||
{
|
||||
component: ExportImageButtons,
|
||||
isEnabled: ({ note, noteContext }) =>
|
||||
["mermaid", "mindMap"].includes(note?.type ?? "")
|
||||
&& note?.isContentAvailable() && noteContext?.viewScope?.viewMode === "default"
|
||||
}
|
||||
];
|
||||
|
||||
@@ -352,6 +358,24 @@ function CopyImageReferenceButton({ note }: FloatingButtonContext) {
|
||||
)
|
||||
}
|
||||
|
||||
function ExportImageButtons({ triggerEvent }: FloatingButtonContext) {
|
||||
return (
|
||||
<>
|
||||
<FloatingButton
|
||||
icon="bx bxs-file-image"
|
||||
text={t("svg_export_button.button_title")}
|
||||
onClick={() => triggerEvent("exportSvg")}
|
||||
/>
|
||||
|
||||
<FloatingButton
|
||||
icon="bx bxs-file-png"
|
||||
text={t("png_export_button.button_title")}
|
||||
onClick={() => triggerEvent("exportPng")}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function FloatingButton({ className, ...props }: ActionButtonProps) {
|
||||
return <ActionButton
|
||||
className={`floating-button ${className ?? ""}`}
|
||||
|
||||
Reference in New Issue
Block a user