A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: Attachment accept type adjustment, editor plug-in insertion position added conditional restrictions
shuai2770ffa9a5cb
diff --git a/ui/src/components/Editor/ToolBars/file.tsx b/ui/src/components/Editor/ToolBars/file.tsxindex 15238379..9e6e7399 100644--- a/ui/src/components/Editor/ToolBars/file.tsx+++ b/ui/src/components/Editor/ToolBars/file.tsx@@ -122,7 +122,9 @@ const Image = ({ editorInstance }) => {<inputtype="file"className="d-none"- accept={authorized_attachment_extensions.join(',.').toLocaleLowerCase()}+ accept={`.${authorized_attachment_extensions+ .join(',.')+ .toLocaleLowerCase()}`}ref={fileInputRef}onChange={onUpload}/>diff --git a/ui/src/components/PluginRender/index.tsx b/ui/src/components/PluginRender/index.tsxindex 9de283f5..002d5a58 100644--- a/ui/src/components/PluginRender/index.tsx+++ b/ui/src/components/PluginRender/index.tsx@@ -20,6 +20,7 @@import React, { FC, ReactNode } from 'react';import PluginKit, { Plugin, PluginType } from '@/utils/pluginKit';+import { writeSettingStore } from '@/stores';/*** Note:Please set at least either of the `slug_name` and `type` attributes, otherwise no plugins will be rendered.*@@ -47,6 +48,9 @@ const Index: FC<Props> = ({}) => {const pluginSlice: Plugin[] = [];const plugins = PluginKit.getPlugins().filter((plugin) => plugin.activated);+ const { authorized_attachment_extensions = [] } = writeSettingStore(+ (state) => state.write,+ );plugins.forEach((plugin) => {if (type && slug_name) {@@ -76,8 +80,10 @@ const Index: FC<Props> = ({}if (type === 'editor') {+ const showAttachFile = authorized_attachment_extensions?.length > 0;+ const pendIndex = showAttachFile ? 16 : 15;const nodes = React.Children.map(children, (child, index) => {- if (index === 15) {+ if (index === pendIndex) {return (<>{child}