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
8262071b
Commit
8262071b
authored
May 13, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
独立编辑加锁
parent
fdaf0b39
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
41 deletions
+64
-41
editor.js
src/store/modules/editor.js
+10
-2
Editor.vue
src/views/Editor.vue
+7
-5
BehaviorTab.vue
src/views/Editor/Inspector/BehaviorTab.vue
+47
-34
No files found.
src/store/modules/editor.js
View file @
8262071b
...
...
@@ -30,6 +30,7 @@ export const editorStore = {
svgaCache
:
{},
svgaLoadingQueue
:
{},
assetSizeCache
:
{},
processEditorWin
:
null
,
},
mutations
:
{
updateEnv
(
state
,
env
)
{
...
...
@@ -46,15 +47,22 @@ export const editorStore = {
state
.
codeSyncServeConfig
=
config
;
localStorage
.
setItem
(
storeKey
,
JSON
.
stringify
(
state
.
codeSyncServeConfig
));
},
updateProcessEditorWin
(
state
,
win
)
{
state
.
processEditorWin
=
win
;
}
},
getters
:
{
assetSize
:
state
=>
url
=>
{
let
size
=
state
.
assetSizeCache
[
url
];
if
(
size
)
{
if
(
size
)
{
return
`
${
size
.
width
}
x
${
size
.
height
}
`
}
return
'0x0'
;
}
},
behaviorEditable
(
state
){
let
win
=
state
.
processEditorWin
;
return
!
win
||
win
.
closed
||
!
win
.
editable
;
},
},
actions
:
{
async
updateEnv
({
state
,
commit
})
{
...
...
src/views/Editor.vue
View file @
8262071b
...
...
@@ -96,7 +96,7 @@
},
async
mounted
()
{
if
(
!
window
.
saveProcesses
)
{
window
.
saveProcesses
=
(
processes
)
=>
{
window
.
saveProcesses
=
(
processes
)
=>
{
this
.
overwriteProcesses
({
processes
});
this
.
$message
({
message
:
this
.
$t
(
'Save behavior successfully'
),
...
...
@@ -408,10 +408,12 @@
let
processEditorUrl
=
location
.
href
.
substr
(
0
,
location
.
href
.
indexOf
(
'#'
))
+
'#/process-editor'
;
let
processEditorWin
=
this
.
processEditorWin
=
open
(
processEditorUrl
,
'Process Editor'
,
'width=800, height=600'
);
if
(
processEditorWin
.
reset
)
{
if
(
processEditorWin
.
editable
()){
this
.
updateProcessEditorWin
(
processEditorWin
);
if
(
processEditorWin
.
editable
)
{
if
(
processEditorWin
.
editable
())
{
this
.
showStandaloneEditor
(
path
,
index
);
}
else
{
}
else
{
this
.
$message
({
message
:
this
.
$t
(
'A behavior is being edited. Please save it first'
),
type
:
'warning'
...
...
@@ -434,7 +436,7 @@
handleBehaviorsChange
()
{
this
.
makeProjectDirty
();
},
...
mapMutations
([
'makeProjectDirty'
,
'overwriteProcesses'
]),
...
mapMutations
([
'makeProjectDirty'
,
'overwriteProcesses'
,
'updateProcessEditorWin'
]),
...
mapActions
([
'loadPackages'
,
'localVersionExist'
,
...
...
src/views/Editor/Inspector/BehaviorTab.vue
View file @
8262071b
...
...
@@ -73,7 +73,7 @@
}
},
computed
:
{
...
mapGetters
([
'activeComponent'
,
'componentList'
])
...
mapGetters
([
'activeComponent'
,
'componentList'
,
'behaviorEditable'
])
},
methods
:
{
getBehavior
(
behavior
)
{
...
...
@@ -89,20 +89,24 @@
}
},
addTrigger
(
command
)
{
let
trigger
=
{
behaviors
:
[]};
switch
(
command
)
{
case
'custom-global'
:
case
'custom-private'
:
trigger
.
custom
=
true
;
break
;
}
if
(
this
.
behaviorEditable
){
let
trigger
=
{
behaviors
:
[]};
switch
(
command
)
{
case
'custom-global'
:
case
'custom-private'
:
trigger
.
custom
=
true
;
break
;
}
if
(
command
===
'custom-private'
)
{
trigger
.
private
=
true
;
}
if
(
command
===
'custom-private'
)
{
trigger
.
private
=
true
;
}
this
.
addBehavior
(
command
,
trigger
.
behaviors
);
this
.
$set
(
this
.
activeComponent
.
events
,
command
,
trigger
);
this
.
addBehavior
(
command
,
trigger
.
behaviors
);
this
.
$set
(
this
.
activeComponent
.
events
,
command
,
trigger
);
}
else
{
this
.
$message
(
'独立过程编辑器正在使用中,不可编辑'
)
}
},
toggleCollapse
(
trigger
)
{
this
.
$set
(
trigger
,
'collapse'
,
!
trigger
.
collapse
);
...
...
@@ -122,13 +126,17 @@
}
},
addBehavior
(
eventName
,
behaviors
)
{
const
alias
=
`
${
this
.
activeComponent
.
name
}
_
${
eventName
}
`
+
(
behaviors
.
length
>
0
?
'_'
+
(
behaviors
.
length
+
1
)
:
''
);
if
(
this
.
behaviorEditable
){
const
alias
=
`
${
this
.
activeComponent
.
name
}
_
${
eventName
}
`
+
(
behaviors
.
length
>
0
?
'_'
+
(
behaviors
.
length
+
1
)
:
''
);
this
.
addBehaviorDirect
({
alias
,
behaviors
,
});
this
.
addBehaviorDirect
({
alias
,
behaviors
,
});
this
.
makeProjectDirty
();
this
.
makeProjectDirty
();
}
else
{
this
.
$message
(
'独立过程编辑器正在使用中,不可编辑'
)
}
},
editTriggerName
(
name
)
{
this
.
$prompt
(
this
.
$t
(
'Input event name'
),
this
.
$t
(
'Rename event'
),
{
...
...
@@ -167,24 +175,29 @@
this
.
makeProjectDirty
();
},
async
deleteBehavior
(
index
,
behaviors
)
{
let
deleteMeta
=
false
;
await
this
.
$confirm
(
this
.
$t
(
'Are you sure to delete it
\'
s process?'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'Delete'
),
cancelButtonText
:
this
.
$t
(
'Not delete'
),
distinguishCancelAndClose
:
true
,
type
:
'warning'
}).
then
(()
=>
{
deleteMeta
=
true
;
this
.
makeProjectDirty
();
}).
catch
(
action
=>
{
if
(
this
.
behaviorEditable
){
let
deleteMeta
=
false
;
await
this
.
$confirm
(
this
.
$t
(
'Are you sure to delete it
\'
s process?'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'Delete'
),
cancelButtonText
:
this
.
$t
(
'Not delete'
),
distinguishCancelAndClose
:
true
,
type
:
'warning'
}).
then
(()
=>
{
deleteMeta
=
true
;
this
.
makeProjectDirty
();
}).
catch
(
action
=>
{
});
});
this
.
deleteBehaviorDirect
({
behaviors
,
index
,
deleteMeta
,
})
}
else
{
this
.
$message
(
'独立过程编辑器正在使用中,不可编辑'
)
}
this
.
deleteBehaviorDirect
({
behaviors
,
index
,
deleteMeta
,
})
},
...
mapActions
([
'modifyActiveView'
,
...
...
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