mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
不允许拖动到另一个脚本上。
This commit is contained in:
parent
43bdafca7a
commit
09d0caea64
@ -1020,5 +1020,6 @@
|
||||
"Folder Name": "文件夹名称",
|
||||
"New folder": "新文件夹",
|
||||
"Create Folder": "新建文件夹",
|
||||
"Input New Name": "输入新名称"
|
||||
"Input New Name": "输入新名称",
|
||||
"It is not allowed to drop on another script.": "不允许拖动到另一个脚本上。"
|
||||
}
|
||||
@ -271,13 +271,21 @@ class ScriptPanel extends React.Component {
|
||||
handleDrop(current, newParent, newIndex) {
|
||||
let scripts = this.state.scripts;
|
||||
|
||||
if (newParent) {
|
||||
let parent = scripts[newParent];
|
||||
if (parent.type !== 'folder') {
|
||||
app.toast(_t('It is not allowed to drop on another script.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let currentScript = scripts[current];
|
||||
currentScript.pid = newParent;
|
||||
|
||||
// 排序
|
||||
scripts = Object.values(scripts);
|
||||
|
||||
if(!newParent) {
|
||||
if (!newParent) {
|
||||
scripts = scripts.filter(n => !n.pid && n !== currentScript);
|
||||
} else {
|
||||
scripts = scripts.filter(n => n.pid === newParent && n !== currentScript);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user