noapi
This commit is contained in:
parent
35cae9415d
commit
35febd9ac4
|
@ -1,38 +0,0 @@
|
|||
// api/convert.js
|
||||
import { Editor } from '@tiptap/core'
|
||||
import { base, custom } from 'src/lib/editorOptions'
|
||||
|
||||
// Добавьте другие расширения при необходимости
|
||||
|
||||
export default function handler(req, res) {
|
||||
// Разрешаем только метод POST
|
||||
if (req.method !== 'POST') {
|
||||
res.status(405).json({ error: 'Method not allowed' })
|
||||
return
|
||||
}
|
||||
|
||||
// Получаем HTML из тела запроса
|
||||
const { html } = req.body
|
||||
|
||||
if (!html) {
|
||||
res.status(400).json({ error: 'No HTML content provided' })
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const editor = new Editor({ extensions: [...base, ...custom] })
|
||||
|
||||
editor.commands.setContent(html, false, {
|
||||
parseOptions: {
|
||||
preserveWhitespace: 'full'
|
||||
}
|
||||
})
|
||||
|
||||
const jsonOutput = editor.getJSON()
|
||||
|
||||
res.status(200).json(jsonOutput)
|
||||
} catch (error) {
|
||||
console.error('Ошибка при конвертации:', error)
|
||||
res.status(500).json({ error: 'Internal Server Error' })
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.1/schema.json",
|
||||
"files": {
|
||||
"include": ["*.tsx", "*.ts", "*.js", "*.json"],
|
||||
"ignore": ["./dist", "./node_modules", ".husky", "docs", "gen", "*.gen.ts", "*.d.ts"]
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
"prosemirror-trailing-node": "^2.0.9",
|
||||
"prosemirror-view": "^1.34.2",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "1.76.0",
|
||||
"sass": "^1.78.0",
|
||||
"solid-js": "^1.8.22",
|
||||
"solid-popper": "^0.3.0",
|
||||
"solid-tiptap": "^0.7.0",
|
||||
|
@ -145,6 +145,7 @@
|
|||
},
|
||||
"trustedDependencies": ["@biomejs/biome", "esbuild", "protobufjs"],
|
||||
"dependencies": {
|
||||
"@vercel/functions": "^1.4.1",
|
||||
"form-data": "^4.0.0",
|
||||
"idb": "^8.0.0",
|
||||
"mailgun.js": "^10.2.3"
|
||||
|
|
Loading…
Reference in New Issue
Block a user