Upgrade linter and formatter to Ultracite (#1224)
This commit is contained in:
parent
b1d254283b
commit
0e320b391d
177 changed files with 6951 additions and 8342 deletions
|
|
@ -1,19 +1,19 @@
|
|||
'use client';
|
||||
"use client";
|
||||
|
||||
import { defaultMarkdownSerializer } from 'prosemirror-markdown';
|
||||
import { DOMParser, type Node } from 'prosemirror-model';
|
||||
import { Decoration, DecorationSet, type EditorView } from 'prosemirror-view';
|
||||
import { renderToString } from 'react-dom/server';
|
||||
import { defaultMarkdownSerializer } from "prosemirror-markdown";
|
||||
import { DOMParser, type Node } from "prosemirror-model";
|
||||
import { Decoration, DecorationSet, type EditorView } from "prosemirror-view";
|
||||
import { renderToString } from "react-dom/server";
|
||||
|
||||
import { Response } from '@/components/elements/response';
|
||||
import { Response } from "@/components/elements/response";
|
||||
|
||||
import { documentSchema } from './config';
|
||||
import { createSuggestionWidget, type UISuggestion } from './suggestions';
|
||||
import { documentSchema } from "./config";
|
||||
import { createSuggestionWidget, type UISuggestion } from "./suggestions";
|
||||
|
||||
export const buildDocumentFromContent = (content: string) => {
|
||||
const parser = DOMParser.fromSchema(documentSchema);
|
||||
const stringFromMarkdown = renderToString(<Response>{content}</Response>);
|
||||
const tempContainer = document.createElement('div');
|
||||
const tempContainer = document.createElement("div");
|
||||
tempContainer.innerHTML = stringFromMarkdown;
|
||||
return parser.parse(tempContainer);
|
||||
};
|
||||
|
|
@ -23,10 +23,10 @@ export const buildContentFromDocument = (document: Node) => {
|
|||
};
|
||||
|
||||
export const createDecorations = (
|
||||
suggestions: Array<UISuggestion>,
|
||||
view: EditorView,
|
||||
suggestions: UISuggestion[],
|
||||
view: EditorView
|
||||
) => {
|
||||
const decorations: Array<Decoration> = [];
|
||||
const decorations: Decoration[] = [];
|
||||
|
||||
for (const suggestion of suggestions) {
|
||||
decorations.push(
|
||||
|
|
@ -34,27 +34,27 @@ export const createDecorations = (
|
|||
suggestion.selectionStart,
|
||||
suggestion.selectionEnd,
|
||||
{
|
||||
class: 'suggestion-highlight',
|
||||
class: "suggestion-highlight",
|
||||
},
|
||||
{
|
||||
suggestionId: suggestion.id,
|
||||
type: 'highlight',
|
||||
},
|
||||
),
|
||||
type: "highlight",
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
decorations.push(
|
||||
Decoration.widget(
|
||||
suggestion.selectionStart,
|
||||
(view) => {
|
||||
const { dom } = createSuggestionWidget(suggestion, view);
|
||||
(currentView) => {
|
||||
const { dom } = createSuggestionWidget(suggestion, currentView);
|
||||
return dom;
|
||||
},
|
||||
{
|
||||
suggestionId: suggestion.id,
|
||||
type: 'widget',
|
||||
},
|
||||
),
|
||||
type: "widget",
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue