Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: make sure code blocks follow the theme

thecodrr677b54dea3e8
diff --git a/apps/web/src/components/editor/editor.css b/apps/web/src/components/editor/editor.css
index 5ef22352f..407889ee9 100644
--- a/apps/web/src/components/editor/editor.css
+++ b/apps/web/src/components/editor/editor.css
@@ -132,8 +132,8 @@ h6::before {
}
pre.codeblock {
- color: #24292e;
- background-color: #f6f8fa;
+ color: var(--text);
+ background-color: var(--bgSecondary);
line-height: 1.2;
padding: 15px;
border: 1px solid var(--border);
diff --git a/apps/web/src/components/editor/plugins/code/plugin.js b/apps/web/src/components/editor/plugins/code/plugin.js
index dd08ee74d..44bdab2f4 100644
--- a/apps/web/src/components/editor/plugins/code/plugin.js
+++ b/apps/web/src/components/editor/plugins/code/plugin.js
@@ -16,11 +16,7 @@ import tinymce from "tinymce/tinymce";
if (innerText.length <= 0) {
replaceContent(
editor,
- (html) =>
- `<p><code class='codeblock'>${html.replace(
- /\n/gm,
- "<br>"
- )}</code></p>`
+ (html) => `<p>${html.replace(/\n/gm, "<br>")}</p>`
);
} else {
editor.execCommand("mceInsertNewLine", false, { shiftKey: true });
@@ -35,7 +31,7 @@ import tinymce from "tinymce/tinymce";
editor.execCommand(
"mceInsertContent",
false,
- `<pre class='codeblock'><code>${content}</code></pre>`
+ `<pre class='codeblock'>${content}</pre>`
);
});
editor.selection.setRng(rng);
@@ -44,10 +40,7 @@ import tinymce from "tinymce/tinymce";
replaceContent(
editor,
(html) =>
- `<pre class='codeblock'><code>${html.replace(
- /\n/gm,
- "<br>"
- )}</code></pre>`
+ `<pre class='codeblock'>${html.replace(/\n/gm, "<br>")}</pre>`
);
}
}