Skip to content

Commit 910d0db

Browse files
committed
fix html element delete bug, and change the mutations, actions, types
1 parent 272e89a commit 910d0db

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/components/right-sidebar/HTMLQueue.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ export default {
144144
...mapActions(['setActiveHTML', 'setActiveLayer', 'upOneLayer', 'setSelectedIdDrag', 'setIdDrag', 'setSelectedIdDrop', 'setIdDrop', 'dragDropSortHtmlElements', 'dragDropSortSelectedHtmlElements', 'openAttributeModal', 'addActiveComponentClass', 'addBindingText']),
145145
deleteElement(id) {
146146
if (this.activeComponent === '') this.$store.dispatch(deleteSelectedElement, id[0])
147-
this.setActiveHTML(element);
148-
this.openAttributeModal(element);
147+
else this.$store.dispatch(deleteFromComponentHtmlList, id[1])
149148
150149
},
151150
setActiveElement(element) {

src/store/actions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ const actions = {
246246
[types.deleteStateFromComponent]: ({ commit }, payload) => {
247247
commit(types.DELETE_STATE_FROM_COMPONENT, payload);
248248
},
249+
//
250+
[types.addBindingText]: ({ commit }, payload) => {
251+
commit(types.ADD_BINDING_TEXT, payload)
252+
},
253+
249254
// Delete user actions from vuex store
250255
[types.deleteUserActions]: ({ state, commit }, payload) => {
251256
commit(types.DELETE_USER_ACTIONS, payload);

src/store/mutations.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,7 @@ const mutations = {
206206
[state.activeComponent]: state.activeComponentObj,
207207
};
208208
},
209-
// //add binding
210-
[types.addBindingText]: (state, payload) => {
211-
//access the htmlList, add payload to the empty bind obj
212-
//state.component
213-
console.log(state.componentMap[state.activeComponent])
214-
},
209+
215210
[types.DELETE_ACTION_FROM_COMPONENT]: (state, payload) => {
216211
state.componentMap[state.activeComponent].actions = state.componentMap[state.activeComponent].actions.filter(
217212
(action) => action !== payload);
@@ -385,7 +380,8 @@ const mutations = {
385380
text: payload.elementName,
386381
id: payload.date,
387382
children: [],
388-
class: ''
383+
class: '',
384+
binding: ''
389385
});
390386
},
391387

@@ -830,7 +826,7 @@ const mutations = {
830826
},
831827

832828
// //add binding
833-
[types.addBindingText]: (state, payload) => {
829+
[types.ADD_BINDING_TEXT]: (state, payload) => {
834830
//access the htmlList, add payload to the empty bind obj
835831
//const active = state.componentMap[state.activeComponent].htmlList;
836832
if (payload.binding === "") {

src/store/types.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ export const SET_SELECTED_ID_DROP = 'SET_SELECTED_ID_DROP'
8585
export const DRAG_DROP_SORT_HTML_ELEMENTS = 'DRAG_DROP_SORT_HTML_ELEMENTS'
8686
export const DRAG_DROP_SORT_SELECTED_HTML_ELEMENTS = 'DRAG_DROP_SORT_SELECTED_HTML_ELEMENTS'
8787

88+
//adding vmodel info
89+
export const ADD_BINDING_TEXT = 'ADD_BINDING_TEXT'
90+
8891
// Actions
8992
export const openNoteModal = 'openNoteModal'
9093
export const openColorModal = 'openColorModal'

0 commit comments

Comments
 (0)