Skip to content

Commit c2ca896

Browse files
committed
🐛 修复脚本排序问题 #425
1 parent 859a516 commit c2ca896

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scriptcat",
3-
"version": "0.17.1",
3+
"version": "0.18.0",
44
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
55
"author": "CodFrm",
66
"license": "GPLv3",

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "__MSG_scriptcat__",
4-
"version": "0.17.1",
4+
"version": "0.18.0",
55
"author": "CodFrm",
66
"description": "__MSG_scriptcat_description__",
77
"options_ui": {

src/pages/options/routes/ScriptList.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ import {
9191
import { message, systemConfig } from "@App/pages/store/global";
9292
import { ValueClient } from "@App/app/service/service_worker/client";
9393
import { loadScriptFavicons } from "@App/pages/store/utils";
94+
import { store } from "@App/pages/store/store";
9495

9596
type ListType = ScriptLoading;
9697

@@ -636,7 +637,7 @@ function ScriptList() {
636637
if (active.id !== over.id) {
637638
let oldIndex = 0;
638639
let newIndex = 0;
639-
scriptList.forEach((item, index) => {
640+
store.getState().script.scripts.forEach((item, index) => {
640641
if (item.uuid === active.id) {
641642
oldIndex = index;
642643
} else if (item.uuid === over.id) {
@@ -647,7 +648,10 @@ function ScriptList() {
647648
}
648649
}}
649650
>
650-
<SortableContext items={scriptList.map((s) => ({ ...s, id: s.uuid }))} strategy={verticalListSortingStrategy}>
651+
<SortableContext
652+
items={store.getState().script.scripts.map((s) => ({ ...s, id: s.uuid }))}
653+
strategy={verticalListSortingStrategy}
654+
>
651655
<table ref={ref} {...props} />
652656
</SortableContext>
653657
</DndContext>

src/pages/store/features/script.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
SCRIPT_RUN_STATUS,
66
SCRIPT_STATUS_DISABLE,
77
SCRIPT_STATUS_ENABLE,
8-
ScriptDAO,
98
} from "@App/app/repo/scripts";
109
import { arrayMove } from "@dnd-kit/sortable";
1110
import {
@@ -19,8 +18,6 @@ import {
1918
ValueClient,
2019
} from "@App/app/service/service_worker/client";
2120
import { message } from "../global";
22-
import { extractFavicons } from "@App/pkg/utils/favicon";
23-
import { store } from "../store";
2421

2522
export const scriptClient = new ScriptClient(message);
2623
export const subscribeClient = new SubscribeClient(message);

0 commit comments

Comments
 (0)