From 04dbc5eeb153f876d53e7d08053b0684d50d9c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9=20=D0=9B=D0=B0?= =?UTF-8?q?=D0=B2=D1=88=D0=BE=D0=BD=D0=BE=D0=BA?= <114582703+valavshonok@users.noreply.github.com> Date: Tue, 4 Nov 2025 13:17:59 +0300 Subject: [PATCH] add css in mdedfitor --- src/views/articleeditor/Editor.tsx | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) 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}