diff --git a/src/views/articleeditor/Editor.tsx b/src/views/articleeditor/Editor.tsx index 5f011ae..a68d60f 100644 --- a/src/views/articleeditor/Editor.tsx +++ b/src/views/articleeditor/Editor.tsx @@ -8,6 +8,20 @@ import axios from "../../axios"; import "highlight.js/styles/github-dark.css"; import Header from "../mission/statement/Header"; +import { defaultSchema } from "hast-util-sanitize"; + +const schema = { + ...defaultSchema, + attributes: { + ...defaultSchema.attributes, + div: [ + ...(defaultSchema.attributes?.div || []), + ["style"] // разрешаем атрибут style на div + ] + } +}; + + interface MarkdownEditorProps { defaultValue?: string; onChange: (value: string) => void; @@ -125,6 +139,17 @@ print(greet("Мир")) ![Markdown Logo](https://upload.wikimedia.org/wikipedia/commons/4/48/Markdown-mark.svg) +или + +\"img\"/ + +или если нужно выравнивание по центру + +
+ \"img\"/ +
+ + --- ## 🧠 8. Цитаты и вложенность @@ -227,7 +252,7 @@ print(greet("Мир")) const cursorPos = (e.target as HTMLTextAreaElement).selectionStart; const newText = markdown.slice(0, cursorPos) + - `![image](${imageUrl})` + + `\"img\"/` + markdown.slice(cursorPos); setMarkdown(newText); @@ -253,7 +278,7 @@ print(greet("Мир"))
{markdown}