@@ -11,7 +11,18 @@ import React, { useCallback, useEffect, useMemo, useState } from "react";
1111import { useParams , useSearchParams } from "react-router-dom" ;
1212import type { editor } from "monaco-editor" ;
1313import { KeyCode , KeyMod } from "monaco-editor" ;
14- import { Button , Dropdown , Grid , Input , Menu , Message , Modal , Tabs , Tooltip } from "@arco-design/web-react" ;
14+ import {
15+ Button ,
16+ Dropdown ,
17+ Grid ,
18+ Input ,
19+ Menu ,
20+ Message ,
21+ Modal ,
22+ type ModalHookReturnType ,
23+ Tabs ,
24+ Tooltip ,
25+ } from "@arco-design/web-react" ;
1526import TabPane from "@arco-design/web-react/es/Tabs/tab-pane" ;
1627import normalTpl from "@App/template/normal.tpl" ;
1728import crontabTpl from "@App/template/crontab.tpl" ;
@@ -53,6 +64,7 @@ type ScriptEditorContextValue = {
5364 scriptClient : typeof scriptClient ;
5465 setScriptList : React . Dispatch < React . SetStateAction < Script [ ] > > ;
5566 handleDeleteEditor : ( uuid : string , needConfirm ?: boolean ) => void ;
67+ modal : ModalHookReturnType ;
5668 t : TFunction < "translation" > ;
5769} ;
5870
@@ -224,6 +236,7 @@ const ScriptEditorScriptListItem = React.memo(({ uuid, status, name }: Pick<Scri
224236 setScriptList,
225237 handleDeleteEditor,
226238 t,
239+ modal,
227240 } = useScriptEditorCtx ( ) ;
228241 const isEnabled = status === SCRIPT_STATUS_ENABLE ;
229242 return (
@@ -339,7 +352,7 @@ const ScriptEditorScriptListItem = React.memo(({ uuid, status, name }: Pick<Scri
339352 onClick = { ( e ) => {
340353 e . stopPropagation ( ) ;
341354 // 删除脚本
342- Modal . confirm ( {
355+ modal . confirm ! ( {
343356 title : t ( "confirm_delete_script" ) ,
344357 content : t ( "confirm_delete_script_content" , { name } ) ,
345358 onOk : ( ) => {
@@ -368,7 +381,6 @@ ScriptEditorScriptListItem.displayName = "ScriptEditorScriptListItem";
368381
369382const ScriptEditorScriptList = React . memo (
370383 ( { scriptList, searchKeyword } : { scriptList : Script [ ] ; searchKeyword : string } ) => {
371- console . log ( 123884 ) ;
372384 const filterScriptList = useMemo ( ( ) => {
373385 return scriptList . filter ( ( script ) => {
374386 if ( ! searchKeyword ) return true ;
@@ -405,6 +417,7 @@ function ScriptEditor() {
405417 const [ visible , setVisible ] = useState < { [ key : string ] : boolean } > ( { } ) ;
406418 const [ searchKeyword , setSearchKeyword ] = useState < string > ( "" ) ;
407419 const [ showSearchInput , setShowSearchInput ] = useState < boolean > ( false ) ;
420+ const [ modal , contextHolder ] = Modal . useModal ( ) ;
408421 const [ editors , setEditors ] = useState <
409422 {
410423 script : Script ;
@@ -930,6 +943,7 @@ function ScriptEditor() {
930943 setScriptList,
931944 handleDeleteEditor,
932945 t,
946+ modal,
933947 } ) ,
934948 [ selectSciptButtonAndTab , editors , hotKeys , scriptCodeDAO , scriptClient , setScriptList , handleDeleteEditor , t ]
935949 ) ;
@@ -946,6 +960,7 @@ function ScriptEditor() {
946960 height : "calc(100% + 20px)" ,
947961 } }
948962 >
963+ { contextHolder }
949964 < ScriptStorage
950965 visible = { visible . scriptStorage }
951966 script = { currentScript }
0 commit comments