Skip to content

Commit

Permalink
fix: #252 disable support custom style in markdown render
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Sep 1, 2024
1 parent 5cc71d0 commit c33dbd2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/shared/i18n/langs/en-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"k5be1a5b0": "Delete role group",
"k5bec387": "Unable to get group information",
"k5ce4e16d": "Clear",
"k5d1e4cd8": "Custom styles are not supported",
"k5d2a6631": "Allow to manage channels",
"k5f91e72c": "Built Plugins",
"k5fc9ccb6": "Operation too frequently",
Expand Down
1 change: 1 addition & 0 deletions client/shared/i18n/langs/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"k5be1a5b0": "删除身份组",
"k5bec387": "无法获取到群组信息",
"k5ce4e16d": "清除",
"k5d1e4cd8": "不支持自定义样式",
"k5d2a6631": "允许管理频道",
"k5f91e72c": "内置插件",
"k5fc9ccb6": "操作过于频繁",
Expand Down
2 changes: 2 additions & 0 deletions client/web/src/components/Markdown/render.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.tailchat-markdown {
min-height: 24px;

* {
user-select: text;
}
Expand Down
4 changes: 3 additions & 1 deletion client/web/src/components/Markdown/render.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { makeAbsoluteUrl } from '@/utils/url-helper';
import React, { useCallback, useMemo } from 'react';
import { isValidStr, parseUrlStr } from 'tailchat-shared';
import { isValidStr, parseUrlStr, useTranslation } from 'tailchat-shared';
import { Loadable } from '../Loadable';
import { Image } from 'tailchat-design';
import remarkGfm from 'remark-gfm';
Expand All @@ -15,6 +15,7 @@ export const Markdown: React.FC<{
raw: string;
baseUrl?: string;
}> = React.memo(({ raw, baseUrl }) => {
const { t } = useTranslation();
const transformUrl = useCallback(
(url: string) => {
url = parseUrlStr(url);
Expand Down Expand Up @@ -43,6 +44,7 @@ export const Markdown: React.FC<{
preview={true}
/>
),
style: () => <div>{t('不支持自定义样式')}</div>,
}),
[]
);
Expand Down

0 comments on commit c33dbd2

Please sign in to comment.