Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/pages/options/routes/script/ScriptEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
});
callbackEditor(node.editor);
return node.editor.dispose.bind(node.editor);
}, [node?.editor]);

Check warning on line 83 in src/pages/options/routes/script/ScriptEditor.tsx

View workflow job for this annotation

GitHub Actions / Run tests

React Hook useEffect has missing dependencies: 'callbackEditor', 'getScript', 'hotKeys', 'id', 'node', and 'onChange'. Either include them or remove the dependency array. If 'callbackEditor' changes too often, find the parent component that defines it and wrap that definition in useCallback

return <CodeEditor key={id} id={id} ref={ref} className={className} code={code} diffCode="" editable />;
};
Expand Down Expand Up @@ -914,10 +914,7 @@
)}
{filteredScriptList.map((script) => {
const editor = editorFindItem(script.uuid);
const colorRGB = !editor ? "173,173,173" : editor.isChanged ? "230,155,31" : "199,199,199";
const alpha = script.status === 2 ? 0.8 : 1.0;
const colorRGBA = `rgba(${colorRGB},${alpha})`;
const delBtnRGBA = `rgba(173,173,173,${alpha})`;
return (
<div key={`s_${script.uuid}`} className="tw-relative tw-group">
<Button
Expand All @@ -927,8 +924,18 @@
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
color: `${colorRGBA}`,
backgroundColor: selectedScript === script.uuid ? "#414958" : editor ? "#474747" : "#333333",
opacity: alpha,
color: !editor
? "var(--color-text-3)"
: editor.isChanged
? "rgb(var(--warning-6))"
: "var(--color-text-2)",
backgroundColor:
selectedScript === script.uuid
? "var(--editor-bg-selected)"
: editor
? "var(--editor-bg-open)"
: "var(--editor-bg-default)",
paddingRight: "32px", // 为删除按钮留出空间
}}
onClick={() => {
Expand All @@ -950,7 +957,7 @@
minWidth: "20px",
border: "none",
background: "transparent",
color: `${delBtnRGBA}`,
color: "var(--color-text-3)",
boxShadow: "none",
}}
onClick={(e) => {
Expand Down
13 changes: 13 additions & 0 deletions src/pages/options/routes/script/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
white-space: nowrap;
}

/* ScriptEditor 脚本列表颜色变量 */
body {
--editor-bg-selected: #D4D7DE;
--editor-bg-open: #EBEBEB;
--editor-bg-default: #F5F5F5;
}

body[arco-theme='dark'] {
--editor-bg-selected: #414958;
--editor-bg-open: #474747;
--editor-bg-default: #333333;
}

.script-code-editor {
margin: 0;
padding: 0;
Expand Down
Loading