Improved copy function with rich text

This commit is contained in:
Scott Idem
2025-04-02 16:36:10 -04:00
parent 56502981d3
commit 304c1e4123
4 changed files with 57 additions and 5 deletions

View File

@@ -339,7 +339,10 @@ export async function db_save_ae_obj_li__journal_entry(
}
let content = obj.content ?? '';
let content_md_html: null|string = marked.parse(content);
// remove the most common zerowidth characters from the start of the file
let content_cleaned: string = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
let content_md_html: null|string = await marked.parse(content_cleaned ?? '') ?? null;
// let content_md_html_alt: null|string = await marked.parse(content_cleaned ?? '', { gfm: false }) ?? null;
try {
const id_random = await db_journals.journal_entry.put({
@@ -378,6 +381,7 @@ export async function db_save_ae_obj_li__journal_entry(
content: obj.content,
content_md_html: content_md_html,
// content_md_html_alt: content_md_html_alt,
content_html: obj.content_html,
content_json: obj.content_json,

View File

@@ -136,12 +136,12 @@ export interface Journal {
}
// Updated 2025-03-15
// Updated 2025-04-02
export interface Journal_Entry {
id: string; // actually "id_random"
journal_entry_id: string;
// journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries.
journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries.
// Essentially this is a change log of journal entries
snapshot_id?: string; // This is the original journal ID. If deleted, then delete all children journal entries.
@@ -183,6 +183,7 @@ export interface Journal_Entry {
content?: null|string;
content_md_html?: null|string; // Markdown converted to HTML based on content
content_md_html_alt?: null|string; // Markdown converted to HTML based on content
content_html?: null|string;
content_json?: null|string;