mirror of
https://github.com/zadam/trilium.git
synced 2026-05-07 16:45:30 +02:00
feat(standalone): hide share export
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import "./export.css";
|
||||
|
||||
import { useState } from "preact/hooks";
|
||||
|
||||
import froca from "../../services/froca";
|
||||
import { t } from "../../services/i18n";
|
||||
import open from "../../services/open";
|
||||
import toastService, { type ToastOptionsWithRequiredId } from "../../services/toast";
|
||||
import tree from "../../services/tree";
|
||||
import utils, { isStandalone } from "../../services/utils";
|
||||
import ws from "../../services/ws";
|
||||
import Button from "../react/Button";
|
||||
import FormRadioGroup from "../react/FormRadioGroup";
|
||||
import Modal from "../react/Modal";
|
||||
import "./export.css";
|
||||
import ws from "../../services/ws";
|
||||
import toastService, { type ToastOptionsWithRequiredId } from "../../services/toast";
|
||||
import utils from "../../services/utils";
|
||||
import open from "../../services/open";
|
||||
import froca from "../../services/froca";
|
||||
import { useTriliumEvent } from "../react/hooks";
|
||||
import Modal from "../react/Modal";
|
||||
|
||||
interface ExportDialogProps {
|
||||
branchId?: string | null;
|
||||
@@ -79,7 +81,7 @@ export default function ExportDialog() {
|
||||
values={[
|
||||
{ value: "html", label: t("export.format_html_zip") },
|
||||
{ value: "markdown", label: t("export.format_markdown") },
|
||||
{ value: "share", label: t("export.share-format") },
|
||||
!isStandalone && { value: "share", label: t("export.share-format") },
|
||||
{ value: "opml", label: t("export.format_opml") }
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
import type { ComponentChildren } from "preact";
|
||||
|
||||
import { useUniqueName } from "./hooks";
|
||||
|
||||
interface FormRadioProps {
|
||||
name: string;
|
||||
currentValue?: string;
|
||||
values: {
|
||||
values: ({
|
||||
value: string;
|
||||
label: string | ComponentChildren;
|
||||
inlineDescription?: string | ComponentChildren;
|
||||
}[];
|
||||
} | false)[];
|
||||
onChange(newValue: string): void;
|
||||
}
|
||||
|
||||
export default function FormRadioGroup({ values, ...restProps }: FormRadioProps) {
|
||||
return (
|
||||
<div role="group">
|
||||
{(values || []).map(({ value, label, inlineDescription }) => (
|
||||
<div className="form-checkbox">
|
||||
<FormRadio
|
||||
value={value}
|
||||
label={label} inlineDescription={inlineDescription}
|
||||
labelClassName="form-check-label"
|
||||
{...restProps}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
{(values || []).map((el) => {
|
||||
if (!el) return null;
|
||||
const { value, label, inlineDescription } = el;
|
||||
return (
|
||||
<div className="form-checkbox">
|
||||
<FormRadio
|
||||
value={value}
|
||||
label={label} inlineDescription={inlineDescription}
|
||||
labelClassName="form-check-label"
|
||||
{...restProps}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -32,9 +37,13 @@ export default function FormRadioGroup({ values, ...restProps }: FormRadioProps)
|
||||
export function FormInlineRadioGroup({ values, ...restProps }: FormRadioProps) {
|
||||
return (
|
||||
<div role="group">
|
||||
{values.map(({ value, label }) => (<FormRadio value={value} label={label} {...restProps} />))}
|
||||
{values.map((el) => {
|
||||
if (!el) return null;
|
||||
const { value, label, inlineDescription } = el;
|
||||
return <FormRadio value={value} label={label} inlineDescription={inlineDescription} {...restProps} />;
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function FormRadio({ name, value, label, currentValue, onChange, labelClassName, inlineDescription }: Omit<FormRadioProps, "values"> & { value: string, label: ComponentChildren, inlineDescription?: ComponentChildren, labelClassName?: string }) {
|
||||
@@ -50,7 +59,7 @@ function FormRadio({ name, value, label, currentValue, onChange, labelClassName,
|
||||
/>
|
||||
{inlineDescription ?
|
||||
<><strong>{label}</strong> - {inlineDescription}</>
|
||||
: label}
|
||||
: label}
|
||||
</label>
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user