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