Skip to content

Commit

Permalink
重置配置
Browse files Browse the repository at this point in the history
  • Loading branch information
027xiguapi committed Jul 23, 2024
1 parent 8c5f320 commit d33d1c6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

.App-body fieldset .item textarea {
padding: 5px;
width: 140px;
}

/*开关*/
Expand Down
20 changes: 18 additions & 2 deletions options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import SortableItem from "~component/sortableItem"
import "./index.css"

export default function IndexOptions() {
const [items, setItems] = useStorage("app-items", [
const itemsInit = [
{
id: "1",
value: "csdn",
Expand Down Expand Up @@ -53,11 +53,18 @@ export default function IndexOptions() {
},
{
id: "6",
value: "51cto",
label: "51CTO",
isShow: true,
},
{
id: "7",
value: "custom",
label: "自定义",
isShow: true,
}
])
]
const [items, setItems] = useStorage("app-items", itemsInit)

const sensors = useSensors(
useSensor(PointerSensor),
Expand Down Expand Up @@ -86,6 +93,12 @@ export default function IndexOptions() {
setItems([...items])
}

function handleReset() {
if (confirm('确认重置配置?')) {
setItems([...itemsInit])
}
}

return (
<div className="App options">
<div className="App-header">
Expand All @@ -105,6 +118,9 @@ export default function IndexOptions() {
</DndContext>
</div>
<div className="App-link">
<div className="item">
<button className="reset" onClick={handleReset}>重置</button>
</div>
<div className="item">
<a
className="btn"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-box",
"displayName": "codebox-免登录一键复制代码(CSDN/知乎/脚本之家/博客园)",
"version": "0.2.1",
"version": "0.2.2",
"description": "本浏览器插件可以用于CSDN/知乎/脚本之家/博客园等网站,实现无需登录一键复制代码;支持选中代码;或者代码右上角按钮的一键复制;解除关注博主即可阅读全文提示;去除登录弹窗;去除跳转APP弹窗;页面自定义样式.",
"author": "027xiguapi. <458813868@qq.com>",
"scripts": {
Expand Down

0 comments on commit d33d1c6

Please sign in to comment.