Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6e076d4

Browse files
feat: add image usage for markdown component
1 parent 4f56d76 commit 6e076d4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

‎client/web/plugins/com.msgbyte.mdpanel/src/group/MarkdownPanel.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ const MarkdownEditorRender: React.FC<{ dataMap: Record<string, string> }> =
4242
}, [text]);
4343

4444
return (
45-
<MarkdownEditor value={text} onChange={(val: string) => setText(val)} />
45+
<MarkdownEditor
46+
value={text}
47+
onChange={(val: string) => setText(val)}
48+
imageUsage="group"
49+
/>
4650
);
4751
});
4852
MarkdownEditorRender.displayName = 'MarkdownEditorRender';

‎client/web/src/components/Markdown/editor.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { Editor, EditorProps } from '@bytemd/react';
3-
import { uploadFile } from 'tailchat-shared';
3+
import { uploadFile,UploadFileUsage } from 'tailchat-shared';
44
import { Markdown } from '../Markdown';
55
import { createRoot } from 'react-dom/client';
66
import gfm from '@bytemd/plugin-gfm';
@@ -20,6 +20,7 @@ const overridePreview: EditorProps['overridePreview'] = (el, props) => {
2020
interface MarkdownEditorProps {
2121
value: string;
2222
onChange: (val: string) => void;
23+
imageUsage?: UploadFileUsage;
2324
}
2425
export const MarkdownEditor: React.FC<MarkdownEditorProps> = React.memo(
2526
(props) => {
@@ -31,7 +32,9 @@ export const MarkdownEditor: React.FC<MarkdownEditorProps> = React.memo(
3132
uploadImages={(files) => {
3233
return Promise.all(
3334
files.map((f) =>
34-
uploadFile(f).then((file) => {
35+
uploadFile(f, {
36+
usage: props.imageUsage || 'unknown',
37+
}).then((file) => {
3538
return {
3639
url: file.url,
3740
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /