fix(vditor): file collection is not empty

This commit is contained in:
chenos 2024-04-28 16:16:57 +08:00
parent 674093e84c
commit 97d9136230
2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ export const Edit = withDynamicSchemaProps((props) => {
const { wrapSSR, hashId, componentCls: containerClassName } = useStyle();
useEffect(() => {
const uploadFileCollection = fileCollection ?? 'attachments';
const uploadFileCollection = fileCollection || 'attachments';
const toolbarConfig = toolbar ?? defaultToolbar;
const vditor = new Vditor(containerRef.current, {
value: value ?? '',
@ -51,7 +51,7 @@ export const Edit = withDynamicSchemaProps((props) => {
onChange(value);
},
upload: {
url: app.getApiUrl(`${uploadFileCollection ?? 'attachments'}:create`),
url: app.getApiUrl(`${uploadFileCollection}:create`),
headers: apiClient.getHeaders(),
multiple: false,
fieldName: 'file',

View File

@ -16,7 +16,7 @@ export class PluginFieldMarkdownVditorClient extends Plugin {
getCDN() {
if (process.env.NODE_ENV !== 'production') {
// 开发模式下使用远程 cdn
return 'https://cdn.jsdelivr.net/npm/vditor@3.10.4';
return 'https://unpkg.com/vditor@3.10.4';
}
// 生产环境,使用本地链接,支持内网
// 需要支持子目录,比如应用部署在 /xxx/ 目录下