Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-editor
Commits
f6a2ccb4
Commit
f6a2ccb4
authored
Dec 18, 2019
by
任建锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加复制粘贴到不同视图
parent
385306d8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
10 deletions
+54
-10
en.json
src/locales/en.json
+2
-0
zh-CN.json
src/locales/zh-CN.json
+2
-0
project.js
src/store/modules/project.js
+33
-9
Views.vue
src/views/Editor/Views.vue
+17
-1
No files found.
src/locales/en.json
View file @
f6a2ccb4
...
...
@@ -9,6 +9,8 @@
"Save And Close"
:
"Save And Close"
,
"Reset"
:
"Reset"
,
"Copy"
:
"Copy"
,
"Paste same level"
:
"粘贴到同级"
,
"Paste child"
:
"粘贴到子级"
,
"Exit"
:
"Exit"
,
"Props"
:
"Props"
,
"Behavior"
:
"Behavior"
,
...
...
src/locales/zh-CN.json
View file @
f6a2ccb4
...
...
@@ -9,6 +9,8 @@
"Save And Close"
:
"保存并关闭"
,
"Reset"
:
"重置"
,
"Copy"
:
"复制"
,
"Paste same level"
:
"粘贴到同级"
,
"Paste child"
:
"粘贴到子级"
,
"Exit"
:
"退出"
,
"Props"
:
"属性"
,
"Behavior"
:
"行为"
,
...
...
src/store/modules/project.js
View file @
f6a2ccb4
...
...
@@ -41,11 +41,12 @@ function setUUIDForAllChildren(node){
for
(
let
i
=
0
;
i
<
node
.
children
.
length
;
i
++
){
node
.
children
[
i
]
=
copyBaseRoot
(
node
.
children
[
i
])
setUUIDForAllChildren
(
node
.
children
[
i
])
}
}
}
let
copyNodeCatch
=
null
;
function
copyBaseRoot
(
node
){
let
_node
=
JSON
.
parse
(
JSON
.
stringify
(
node
));
...
...
@@ -322,8 +323,30 @@ export const projectStore = {
copyNode
(
state
,
{
node
,
parentNode
})
{
let
_node1
=
node
copyNodeCatch
=
_node1
;
//localStorage.copyNodeCatch=_node1;
// let _node=copyBaseRoot(_node1);
// setUUIDForAllChildren(_node)
// if (parentNode) {
// if (!parentNode.children) {
// Vue.set(parentNode, 'children', []);
// }
// parentNode.children.push(_node);
// } else {
// state.data.views.push(_node);
// }
},
pasteNode
(
state
,
{
node
,
parentNode
,
pasteState
})
{
let
_node1
=
copyNodeCatch
;
console
.
log
(
copyNodeCatch
)
if
(
_node1
){
let
_node
=
copyBaseRoot
(
_node1
);
setUUIDForAllChildren
(
_node
)
if
(
pasteState
==
1
){
parentNode
=
parentNode
;
}
else
{
parentNode
=
node
;
}
if
(
parentNode
)
{
if
(
!
parentNode
.
children
)
{
Vue
.
set
(
parentNode
,
'children'
,
[]);
...
...
@@ -332,6 +355,7 @@ export const projectStore = {
}
else
{
state
.
data
.
views
.
push
(
_node
);
}
}
},
importAssets
(
state
,
assets
)
{
state
.
data
.
assets
.
push
(...
assets
);
...
...
src/views/Editor/Views.vue
View file @
f6a2ccb4
...
...
@@ -41,6 +41,8 @@
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
command=
"delete"
>
{{
$t
(
'Delete'
)
}}
</el-dropdown-item>
<el-dropdown-item
command=
"copy"
>
{{
$t
(
'Copy'
)
}}
</el-dropdown-item>
<el-dropdown-item
command=
"paste"
>
{{
$t
(
'Paste same level'
)
}}
</el-dropdown-item>
<el-dropdown-item
command=
"pasteChild"
>
{{
$t
(
'Paste child'
)
}}
</el-dropdown-item>
<el-dropdown-item
command=
"export"
divided
v-if=
"!node.parent.parent"
>
{{
$t
(
'Export'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-for=
"(type, key, index) in $t('view_node_menu')"
...
...
@@ -173,6 +175,20 @@
parentNode
:
node
.
parent
.
data
});
break
;
case
'paste'
:
this
.
pasteNode
({
node
:
data
,
parentNode
:
node
.
parent
.
data
,
pasteState
:
1
});
break
;
case
'pasteChild'
:
this
.
pasteNode
({
node
:
data
,
parentNode
:
node
.
parent
.
data
,
pasteState
:
2
});
break
;
case
'export'
:
this
.
exportView
(
data
);
break
;
...
...
@@ -188,7 +204,7 @@
break
;
}
},
...
mapMutations
([
'copyNode'
,
'deleteNode'
,
'addNode'
]),
...
mapMutations
([
'copyNode'
,
'
pasteNode'
,
'
deleteNode'
,
'addNode'
]),
...
mapActions
([
'exportView'
,
'importView'
])
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment