Commit 302b9bae authored by rockyl's avatar rockyl

修复独立行为编辑器的bug

parent 8262071b
...@@ -59,7 +59,7 @@ export const editorStore = { ...@@ -59,7 +59,7 @@ export const editorStore = {
} }
return '0x0'; return '0x0';
}, },
behaviorEditable(state){ behaviorEditable: state => () => {
let win = state.processEditorWin; let win = state.processEditorWin;
return !win || win.closed || !win.editable; return !win || win.closed || !win.editable;
}, },
......
...@@ -32,9 +32,10 @@ export const packageStore = { ...@@ -32,9 +32,10 @@ export const packageStore = {
}, },
mutations: { mutations: {
resetPackageStore(state, sourceState) { resetPackageStore(state, sourceState) {
for (let key in sourceState) { state.packageInfos = sourceState.packageInfos;
state[key] = sourceState[key]; 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) { updatePackageInfos(state, packageInfos) {
for (let i = 0, li = typeMapping.length; i < li; i++) { for (let i = 0, li = typeMapping.length; i < li; i++) {
...@@ -209,7 +210,7 @@ export const packageStore = { ...@@ -209,7 +210,7 @@ export const packageStore = {
for (let packageInfo of state.packageInfos[group]) { for (let packageInfo of state.packageInfos[group]) {
const {package_id, versions} = packageInfo; const {package_id, versions} = packageInfo;
if (!dependencies[package_id]) { if (!dependencies[package_id]) {
dependencies[package_id] = maxSatisfying(versions, '*'); dependencies[package_id] = semverMaxSatisfying(versions, '*');
} }
} }
} }
......
...@@ -14,6 +14,7 @@ $dock-pin-width: 9px; ...@@ -14,6 +14,7 @@ $dock-pin-width: 9px;
.editor-wrapper{ .editor-wrapper{
flex: 1; flex: 1;
display: flex; display: flex;
height: 0;
} }
.behavior-editor { .behavior-editor {
flex: 1; flex: 1;
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
} }
}, },
addTrigger(command) { addTrigger(command) {
if(this.behaviorEditable){ if(this.behaviorEditable()){
let trigger = {behaviors: []}; let trigger = {behaviors: []};
switch (command) { switch (command) {
case 'custom-global': case 'custom-global':
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
} }
}, },
addBehavior(eventName, behaviors) { addBehavior(eventName, behaviors) {
if(this.behaviorEditable){ if(this.behaviorEditable()){
const alias = `${this.activeComponent.name}_${eventName}` + (behaviors.length > 0 ? '_' + (behaviors.length + 1) : ''); const alias = `${this.activeComponent.name}_${eventName}` + (behaviors.length > 0 ? '_' + (behaviors.length + 1) : '');
this.addBehaviorDirect({ this.addBehaviorDirect({
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
this.makeProjectDirty(); this.makeProjectDirty();
}, },
async deleteBehavior(index, behaviors) { async deleteBehavior(index, behaviors) {
if(this.behaviorEditable){ if(this.behaviorEditable()){
let deleteMeta = false; let deleteMeta = false;
await this.$confirm(this.$t('Are you sure to delete it\'s process?'), this.$t('Alert'), { await this.$confirm(this.$t('Are you sure to delete it\'s process?'), this.$t('Alert'), {
confirmButtonText: this.$t('Delete'), confirmButtonText: this.$t('Delete'),
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
window.onbeforeunload = (e) => { window.onbeforeunload = (e) => {
return this.showBadge ? true : null; return this.showBadge ? true : null;
}; };
this.updateProcessTree();
}, },
computed: { computed: {
...mapState({ ...mapState({
...@@ -114,7 +115,8 @@ ...@@ -114,7 +115,8 @@
close() { close() {
window.close(); window.close();
}, },
...mapMutations(['clearBehavior', 'resetProjectData', 'resetPackageStore', 'behavior_save']) ...mapMutations(['clearBehavior',
'resetProjectData', 'resetPackageStore', 'behavior_save', 'updateProcessTree'])
} }
} }
</script> </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