feat: insert chat message to notes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
export let className =
|
||||
'w-full rounded-lg px-3.5 py-2 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden h-full';
|
||||
|
||||
export let onBlur = () => {};
|
||||
let textareaElement;
|
||||
|
||||
// Adjust height on mount and after setting the element.
|
||||
@@ -59,4 +60,5 @@
|
||||
on:focus={() => {
|
||||
resize();
|
||||
}}
|
||||
on:blur={onBlur}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user