diff --git a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx b/web/app/components/plugins/marketplace/search-box/tags-filter.tsx index edf50dc874..35676d75f2 100644 --- a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx +++ b/web/app/components/plugins/marketplace/search-box/tags-filter.tsx @@ -1,6 +1,7 @@ 'use client' import { useState } from 'react' +import type { ReactElement } from 'react' import { RiArrowDownSLine, RiCloseCircleFill, @@ -22,12 +23,18 @@ type TagsFilterProps = { onTagsChange: (tags: string[]) => void size: 'small' | 'large' locale?: string + emptyTrigger?: ReactElement + className?: string + triggerClassName?: string } const TagsFilter = ({ tags, onTagsChange, size, locale, + emptyTrigger, + className, + triggerClassName, }: TagsFilterProps) => { const { t } = useMixedTranslation(locale) const [open, setOpen] = useState(false) @@ -62,17 +69,23 @@ const TagsFilter = ({ size === 'small' && 'h-7 py-0.5 pl-1 pr-1.5 ', selectedTagsLength && 'text-text-secondary', open && 'bg-state-base-hover', + className, )}> -
- -
+ { + !emptyTrigger && ( +
+ +
+ ) + }
{ - !selectedTagsLength && t('pluginTags.allTags') + !selectedTagsLength && (emptyTrigger || t('pluginTags.allTags')) } { !!selectedTagsLength && tags.map(tag => tagsMap[tag].label).slice(0, 2).join(',') @@ -94,7 +107,7 @@ const TagsFilter = ({ ) } { - !selectedTagsLength && ( + !selectedTagsLength && !emptyTrigger && ( ) } diff --git a/web/app/components/workflow/block-selector/main.tsx b/web/app/components/workflow/block-selector/main.tsx index e1bcd84c24..38cb8bdb63 100644 --- a/web/app/components/workflow/block-selector/main.tsx +++ b/web/app/components/workflow/block-selector/main.tsx @@ -28,12 +28,11 @@ import { PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' import Input from '@/app/components/base/input' -// import SearchBox from '@/app/components/plugins/marketplace/search-box' import cn from '@/utils/classnames' - import { Plus02, } from '@/app/components/base/icons/src/vender/line/general' +import ToolSearchInputTag from './tool-search-input-tag' export type NodeSelectorProps = { open?: boolean @@ -164,31 +163,31 @@ const NodeSelector: FC = ({ }
- setSearchText(e.target.value)} - onClear={() => setSearchText('')} - /> +
e.stopPropagation()}> + setSearchText(e.target.value)} + onClear={() => setSearchText('')} + /> + { + activeTab === TabsEnum.Tools && ( + <> +
+ + + ) + } +
- {/*
e.stopPropagation()}> - {activeTab === TabsEnum.Blocks && ( - )} - {activeTab === TabsEnum.Tools && ( - - )} -
*/} void +} +const ToolSearchInputTag = ({ + tags, + onTagsChange, +}: ToolSearchInputTagProps) => { + return ( + + + + } + /> + ) +} + +export default memo(ToolSearchInputTag) diff --git a/web/app/components/workflow/note-node/index.tsx b/web/app/components/workflow/note-node/index.tsx index aa8793f916..8ba842ecbe 100644 --- a/web/app/components/workflow/note-node/index.tsx +++ b/web/app/components/workflow/note-node/index.tsx @@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next' import { useClickAway } from 'ahooks' import type { NodeProps } from 'reactflow' import NodeResizer from '../nodes/_base/components/node-resizer' +import { useWorkflowHistoryStore } from '../workflow-history-store' import { useNodeDataUpdate, useNodesInteractions, @@ -58,6 +59,8 @@ const NoteNode = ({ handleNodeDataUpdateWithSyncDraft({ id, data: { selected: false } }) }, ref) + const { setShortcutsEnabled } = useWorkflowHistoryStore() + return (
diff --git a/web/app/components/workflow/note-node/note-editor/editor.tsx b/web/app/components/workflow/note-node/note-editor/editor.tsx index e10ca7b0fd..c91988c532 100644 --- a/web/app/components/workflow/note-node/note-editor/editor.tsx +++ b/web/app/components/workflow/note-node/note-editor/editor.tsx @@ -13,7 +13,6 @@ import { ListPlugin } from '@lexical/react/LexicalListPlugin' import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary' import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin' import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin' -import { useWorkflowHistoryStore } from '../../workflow-history-store' import LinkEditorPlugin from './plugins/link-editor-plugin' import FormatDetectorPlugin from './plugins/format-detector-plugin' // import TreeView from '@/app/components/base/prompt-editor/plugins/tree-view' @@ -23,26 +22,26 @@ type EditorProps = { placeholder?: string onChange?: (editorState: EditorState) => void containerElement: HTMLDivElement | null + setShortcutsEnabled?: (v: boolean) => void } const Editor = ({ placeholder = 'write you note...', onChange, containerElement, + setShortcutsEnabled, }: EditorProps) => { const handleEditorChange = useCallback((editorState: EditorState) => { onChange?.(editorState) }, [onChange]) - const { setShortcutsEnabled } = useWorkflowHistoryStore() - return (
setShortcutsEnabled(false)} - onBlur={() => setShortcutsEnabled(true)} + onFocus={() => setShortcutsEnabled?.(false)} + onBlur={() => setShortcutsEnabled?.(true)} spellCheck={false} className='h-full w-full text-text-secondary caret-primary-600 outline-none' /> diff --git a/web/app/components/workflow/workflow-preview/index.tsx b/web/app/components/workflow/workflow-preview/index.tsx index d25b30aa10..fad7a033af 100644 --- a/web/app/components/workflow/workflow-preview/index.tsx +++ b/web/app/components/workflow/workflow-preview/index.tsx @@ -38,7 +38,6 @@ import type { Node, } from '@/app/components/workflow/types' import { CUSTOM_NOTE_NODE } from '@/app/components/workflow/note-node/constants' -import { WorkflowHistoryProvider } from '@/app/components/workflow/workflow-history-store' import CustomNode from './components/nodes' import CustomEdge from './components/custom-edge' import ZoomInOut from './components/zoom-in-out' @@ -137,9 +136,7 @@ const WorkflowPreview = ({ const WorkflowPreviewWrapper = (props: WorkflowPreviewProps) => { return ( - - - + ) }