Commit 302b9bae authored by rockyl's avatar rockyl

修复独立行为编辑器的bug

parent 8262071b
......@@ -59,7 +59,7 @@ export const editorStore = {
}
return '0x0';
},
behaviorEditable(state){
behaviorEditable: state => () => {
let win = state.processEditorWin;
return !win || win.closed || !win.editable;
},
......
......@@ -32,9 +32,10 @@ export const packageStore = {
},
mutations: {
resetPackageStore(state, sourceState) {
for (let key in sourceState) {
state[key] = sourceState[key];
}
state.packageInfos = sourceState.packageInfos;
state.packages = sourceState.packages;
let builtins = state.processTree.find(item=>item.name === 'normal').children.find(item=>item.name === 'builtin');
builtins.children = sourceState.processTree.find(item=>item.name === 'normal').children.find(item=>item.name === 'builtin').children;
},
updatePackageInfos(state, packageInfos) {
for (let i = 0, li = typeMapping.length; i < li; i++) {
......@@ -209,7 +210,7 @@ export const packageStore = {
for (let packageInfo of state.packageInfos[group]) {
const {package_id, versions} = packageInfo;
if (!dependencies[package_id]) {
dependencies[package_id] = maxSatisfying(versions, '*');
dependencies[package_id] = semverMaxSatisfying(versions, '*');
}
}
}
......
......@@ -14,6 +14,7 @@ $dock-pin-width: 9px;
.editor-wrapper{
flex: 1;
display: flex;
height: 0;
}
.behavior-editor {
flex: 1;
......
......@@ -89,7 +89,7 @@
}
},
addTrigger(command) {
if(this.behaviorEditable){
if(this.behaviorEditable()){
let trigger = {behaviors: []};
switch (command) {
case 'custom-global':
......@@ -126,7 +126,7 @@
}
},
addBehavior(eventName, behaviors) {
if(this.behaviorEditable){
if(this.behaviorEditable()){
const alias = `${this.activeComponent.name}_${eventName}` + (behaviors.length > 0 ? '_' + (behaviors.length + 1) : '');
this.addBehaviorDirect({
......@@ -175,7 +175,7 @@
this.makeProjectDirty();
},
async deleteBehavior(index, behaviors) {
if(this.behaviorEditable){
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'),
......
......@@ -45,6 +45,7 @@
window.onbeforeunload = (e) => {
return this.showBadge ? true : null;
};
this.updateProcessTree();
},
computed: {
...mapState({
......@@ -114,7 +115,8 @@
close() {
window.close();
},
...mapMutations(['clearBehavior', 'resetProjectData', 'resetPackageStore', 'behavior_save'])
...mapMutations(['clearBehavior',
'resetProjectData', 'resetPackageStore', 'behavior_save', 'updateProcessTree'])
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment