From 68c05b5b1d1af506ca7c70529dec03fe5369c668 Mon Sep 17 00:00:00 2001 From: imperosol Date: Tue, 20 Oct 2026 12:52:20 +0200 Subject: [PATCH] fix: add back `.markdown` on EasyMde preview editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A l'origine, l'API retournait le markdown encapsulé dans une div avec la class `.markdown`. Quand on est passé sur notre propre lib WASM pour faire la preview entièrement côté front, on a oublié ce détail. En même temps, on résout ici un petit glitch d'affichage qui fait qu'on avait le background des blocs de codes qui se mettait en dessous de notre propre style. --- core/static/bundled/core/components/easymde-index.ts | 1 + core/static/core/markdown.scss | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/core/static/bundled/core/components/easymde-index.ts b/core/static/bundled/core/components/easymde-index.ts index adc01bb4..54f1a134 100644 --- a/core/static/bundled/core/components/easymde-index.ts +++ b/core/static/bundled/core/components/easymde-index.ts @@ -60,6 +60,7 @@ const loadEasyMde = (textarea: HTMLTextAreaElement) => { }); easymde.codemirror.replaceSelection("\n"); }, + previewClass: ["editor-preview", "markdown"], // default class + our own markdown class previewRender: (plainText) => markdown(plainText), forceSync: true, // Avoid validation error on generic create view imageTexts: { diff --git a/core/static/core/markdown.scss b/core/static/core/markdown.scss index 098d86be..10aeb338 100644 --- a/core/static/core/markdown.scss +++ b/core/static/core/markdown.scss @@ -33,6 +33,15 @@ padding: 1px 2px; } + /** + * Some restyling rules for the cases where our own md css + * conflicts with the easymde editor preview css + */ + &.editor-preview { + pre { + background: unset; + } + } pre code { // code that is not inlined margin: 15px;