add skip metadata flag to note

This commit is contained in:
Ren Amamiya
2023-07-08 16:13:55 +07:00
parent 70596e2a1d
commit c820a0adfd
3 changed files with 12 additions and 7 deletions

View File

@@ -7,6 +7,8 @@ import reactStringReplace from 'react-string-replace';
import { MentionUser } from '@shared/notes/mentions/user';
import { LumeEvent } from '@utils/types';
function isJsonString(str: string[][] | string) {
try {
if (typeof str === 'string') JSON.parse(str);
@@ -16,24 +18,24 @@ function isJsonString(str: string[][] | string) {
return true;
}
export function parser(event: Event) {
export function parser(event: LumeEvent) {
if (isJsonString(event.tags)) {
event['tags'] = destr(event.tags);
}
const references = parseReferences(event);
const references = parseReferences(event as Event);
const urls = getUrls(event.content);
const content: {
original: string;
parsed: string | ReactNode[];
parsed: ReactNode[];
notes: string[];
images: string[];
videos: string[];
links: string[];
} = {
original: event.content,
parsed: event.content,
parsed: [event.content],
notes: [],
images: [],
videos: [],