A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: improve codeblock scrollbar styling (#8548)
01zulfi27f781cc639c
diff --git a/packages/editor/src/extensions/code-block/component.tsx b/packages/editor/src/extensions/code-block/component.tsxindex c7e8cfce7..12e924b1b 100644--- a/packages/editor/src/extensions/code-block/component.tsx+++ b/packages/editor/src/extensions/code-block/component.tsx@@ -30,6 +30,7 @@ import { CodeBlockAttributes } from "./code-block.js";import Languages from "./languages.json";import { useThemeEngineStore } from "@notesnook/theme";import { strings } from "@notesnook/intl";+import SimpleBar from "simplebar-react";export function CodeblockComponent(props: ReactNodeViewProps<CodeBlockAttributes>@@ -58,45 +59,53 @@ export function CodeblockComponent(overflow: "hidden"}}>- <Text- ref={(ref) => {- elementRef.current = ref ?? undefined;- forwardRef?.(ref);+ <SimpleBar+ style={{+ backgroundColor: "var(--background-secondary)"}}- autoCorrect="off"- autoCapitalize="none"- css={theme.codeBlockCSS}- sx={{- pre: {- fontFamily: "inherit !important",- tabSize: "inherit !important",- // background: "transparent !important",- padding: "10px !important",- margin: "0px !important",- width: "100%",- borderRadius: `0px !important`,+ >+ <div>+ <Text+ ref={(ref) => {+ elementRef.current = ref ?? undefined;+ forwardRef?.(ref);+ }}+ autoCorrect="off"+ autoCapitalize="none"+ css={theme.codeBlockCSS}+ sx={{+ pre: {+ fontFamily: "inherit !important",+ tabSize: "inherit !important",+ // background: "transparent !important",+ padding: "10px !important",+ margin: "0px !important",+ width: "100%",+ borderRadius: `0px !important`,- "::selection,*::selection": {- bg: "background-selected",- color: "inherit"- },- "::-moz-selection,*::-moz-selection": {- bg: "background-selected",- color: "inherit"- }- },- fontFamily: "monospace",- whiteSpace: "pre", // TODO !important- tabSize: 1,- position: "relative",- lineHeight: "20px",- // bg: "var(--background-secondary)",- // color: "white",- overflowX: "hidden",- display: "flex"- }}- spellCheck={false}- />+ "::selection,*::selection": {+ bg: "background-selected",+ color: "inherit"+ },+ "::-moz-selection,*::-moz-selection": {+ bg: "background-selected",+ color: "inherit"+ }+ },+ fontFamily: "monospace",+ whiteSpace: "pre", // TODO !important+ tabSize: 1,+ position: "relative",+ lineHeight: "20px",+ // bg: "var(--background-secondary)",+ // color: "white",+ // overflowX: "hidden",+ display: "flex"+ }}+ spellCheck={false}+ />+ </div>+ </SimpleBar><Flexref={toolbarRef}contentEditable={false}diff --git a/packages/editor/styles/styles.css b/packages/editor/styles/styles.cssindex ea26f7051..71601cb82 100644--- a/packages/editor/styles/styles.css+++ b/packages/editor/styles/styles.css@@ -956,3 +956,10 @@ del.diffdel {.simplebar-content:before {content: "" !important;}+.simplebar-content:after {+ content: "" !important;+}++pre[class*="language-"] {+ overflow: initial !important;+}