feat: ai elements (#1143)

This commit is contained in:
josh 2025-08-28 14:15:36 +01:00 committed by GitHub
parent 66e8227655
commit f09be3f286
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 3558 additions and 500 deletions

View file

@ -5,14 +5,14 @@ import { DOMParser, type Node } from 'prosemirror-model';
import { Decoration, DecorationSet, type EditorView } from 'prosemirror-view';
import { renderToString } from 'react-dom/server';
import { Markdown } from '@/components/markdown';
import { Response } from '@/components/elements/response';
import { documentSchema } from './config';
import { createSuggestionWidget, type UISuggestion } from './suggestions';
export const buildDocumentFromContent = (content: string) => {
const parser = DOMParser.fromSchema(documentSchema);
const stringFromMarkdown = renderToString(<Markdown>{content}</Markdown>);
const stringFromMarkdown = renderToString(<Response>{content}</Response>);
const tempContainer = document.createElement('div');
tempContainer.innerHTML = stringFromMarkdown;
return parser.parse(tempContainer);