diff --git a/apps/renderer/src/modules/editor/css-editor.tsx b/apps/renderer/src/modules/editor/css-editor.tsx index f3e1c1983..c3777c557 100644 --- a/apps/renderer/src/modules/editor/css-editor.tsx +++ b/apps/renderer/src/modules/editor/css-editor.tsx @@ -1,8 +1,9 @@ +import { TextArea } from "@follow/components/ui/input/TextArea.js" import { useInputComposition, useIsDark } from "@follow/hooks" import { nextFrame } from "@follow/utils/dom" import { cn } from "@follow/utils/utils" import { createPlainShiki } from "plain-shiki" -import { useLayoutEffect, useRef } from "react" +import { useLayoutEffect, useMemo, useRef } from "react" import css from "shiki/langs/css.mjs" import githubDark from "shiki/themes/github-dark.mjs" import githubLight from "shiki/themes/github-light.mjs" @@ -13,6 +14,7 @@ import { shiki } from "~/components/ui/code-highlighter/shiki/shared" shiki.loadLanguageSync(css) shiki.loadThemeSync(githubDark) shiki.loadThemeSync(githubLight) + export const CSSEditor: Component<{ onChange: (value: string) => void defaultValue?: string @@ -74,6 +76,26 @@ export const CSSEditor: Component<{ onChange(ref.current?.textContent ?? "") }) + const isSupportPlainTextOnly = useIsSupportPlainTextOnly() + if (!isSupportPlainTextOnly) { + return ( +
+
+ + Your browser does not support highlight CSS. +
+
+
+