mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 15:26:59 +02:00
chore: address requested changes
This commit is contained in:
@@ -180,6 +180,10 @@ function createMockExpressResponse() {
|
||||
res._headers[name] = value;
|
||||
return res;
|
||||
},
|
||||
removeHeader(name: string) {
|
||||
delete res._headers[name];
|
||||
return res;
|
||||
},
|
||||
status(code: number) {
|
||||
res._status = code;
|
||||
return res;
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function FormRadioGroup({ values, ...restProps }: FormRadioProps)
|
||||
if (!el) return null;
|
||||
const { value, label, inlineDescription } = el;
|
||||
return (
|
||||
<div className="form-checkbox">
|
||||
<div className="form-checkbox" key={value}>
|
||||
<FormRadio
|
||||
value={value}
|
||||
label={label} inlineDescription={inlineDescription}
|
||||
@@ -40,7 +40,7 @@ export function FormInlineRadioGroup({ values, ...restProps }: FormRadioProps) {
|
||||
{values.map((el) => {
|
||||
if (!el) return null;
|
||||
const { value, label, inlineDescription } = el;
|
||||
return <FormRadio value={value} label={label} inlineDescription={inlineDescription} {...restProps} />;
|
||||
return <FormRadio key={value} value={value} label={label} inlineDescription={inlineDescription} {...restProps} />;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -4,12 +4,12 @@ import { RenderMarkdownResponse, ToMarkdownResponse } from "@triliumnext/commons
|
||||
import type { Request } from "express";
|
||||
|
||||
import markdown from "../../services/export/markdown.js";
|
||||
import { markdownImportService } from "../..";
|
||||
import { markdownImportService, ValidationError } from "../..";
|
||||
|
||||
function renderMarkdown(req: Request) {
|
||||
const { markdownContent } = req.body;
|
||||
if (!markdownContent || typeof markdownContent !== 'string') {
|
||||
throw new Error('markdownContent parameter is required and must be a string');
|
||||
if (typeof markdownContent !== 'string') {
|
||||
throw new ValidationError('markdownContent parameter is required and must be a string');
|
||||
}
|
||||
return {
|
||||
htmlContent: markdownImportService.renderToHtml(markdownContent, "")
|
||||
@@ -18,8 +18,8 @@ function renderMarkdown(req: Request) {
|
||||
|
||||
function toMarkdown(req: Request) {
|
||||
const { htmlContent } = req.body;
|
||||
if (!htmlContent || typeof htmlContent !== 'string') {
|
||||
throw new Error('htmlContent parameter is required and must be a string');
|
||||
if (typeof htmlContent !== 'string') {
|
||||
throw new ValidationError('htmlContent parameter is required and must be a string');
|
||||
}
|
||||
return {
|
||||
markdownContent: markdown.toMarkdown(htmlContent)
|
||||
|
||||
Reference in New Issue
Block a user