feat: insert chat message to notes

This commit is contained in:
Timothy Jaeryang Baek
2025-07-07 21:22:07 +04:00
parent a3c2018a4a
commit ade4b0d691
6 changed files with 91 additions and 32 deletions
@@ -204,6 +204,23 @@
focus();
};
export const insertContent = (content) => {
if (!editor) return;
const { state, view } = editor;
const { schema, tr } = state;
// If content is a string, convert it to a ProseMirror node
const htmlContent = marked.parse(content, {
breaks: true,
gfm: true
});
// insert the HTML content at the current selection
editor.commands.insertContent(htmlContent);
focus();
};
export const replaceVariables = (variables) => {
if (!editor) return;
const { state, view } = editor;