feat: ai elements (#1143)
This commit is contained in:
parent
66e8227655
commit
f09be3f286
38 changed files with 3558 additions and 500 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue