editor: remove widget deletion confirmation popup
This commit is contained in:
parent
ae13823a85
commit
cabac1143b
5 changed files with 16 additions and 48 deletions
|
|
@ -490,47 +490,20 @@ var Editor = class Editor {
|
|||
type = this.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget',
|
||||
parent = this.selectedWidgets[0].parent
|
||||
|
||||
if (this.deleting || this.selectedWidgets[0].getProp('id') === 'root') return
|
||||
if (this.selectedWidgets[0].getProp('id') === 'root') return
|
||||
|
||||
this.deleting = true
|
||||
|
||||
var popup = new Popup({
|
||||
title: locales('editor_delete_prompt'),
|
||||
content:`
|
||||
<div class="actions">
|
||||
<a class="btn warning confirm-delete">${locales('editor_delete_yes')}</a>
|
||||
<a class="btn cancel-delete">${locales('editor_delete_no')}</a>
|
||||
</div>`,
|
||||
closable: false,
|
||||
escKey: true,
|
||||
enterKey: function(){DOM.get(this.html, '.confirm-delete')[0].click()}
|
||||
})
|
||||
|
||||
DOM.get(popup.html, '.confirm-delete')[0].addEventListener('click', ()=>{
|
||||
|
||||
popup.close()
|
||||
|
||||
if (type === 'widget') {
|
||||
for (let i of index) {
|
||||
parent.props.widgets.splice(i,1)
|
||||
}
|
||||
} else {
|
||||
for (let i of index) {
|
||||
parent.props.tabs.splice(i,1)
|
||||
}
|
||||
if (type === 'widget') {
|
||||
for (let i of index) {
|
||||
parent.props.widgets.splice(i,1)
|
||||
}
|
||||
} else {
|
||||
for (let i of index) {
|
||||
parent.props.tabs.splice(i,1)
|
||||
}
|
||||
}
|
||||
|
||||
this.select(updateWidget(parent, {preventSelect: true}))
|
||||
this.pushHistory()
|
||||
|
||||
this.deleting = false
|
||||
|
||||
})
|
||||
|
||||
DOM.get(popup.html, '.cancel-delete')[0].addEventListener('click', function(){
|
||||
popup.close()
|
||||
this.deleting = false
|
||||
})
|
||||
this.select(updateWidget(parent, {preventSelect: true}))
|
||||
this.pushHistory()
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ module.exports = {
|
|||
editor_addwidget: 'Add widget',
|
||||
editor_addtab: 'Add tab',
|
||||
editor_delete: 'Delete',
|
||||
editor_delete_prompt: 'Are you sure ?',
|
||||
editor_delete_yes: 'Delete',
|
||||
editor_delete_no: 'Cancel',
|
||||
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Uploading file...',
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ module.exports = {
|
|||
editor_addwidget: 'Nouveau widget',
|
||||
editor_addtab: 'Nouvel onglet',
|
||||
editor_delete: 'Supprimer',
|
||||
editor_delete_prompt: 'Êtes-vous sûr ?',
|
||||
editor_delete_yes: 'Supprimer',
|
||||
editor_delete_no: 'Annuler',
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Téléversement...',
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ module.exports = { // @https://github.com/suhr
|
|||
editor_addwidget: 'Добавить виджет',
|
||||
editor_addtab: 'Добавить вкладку',
|
||||
editor_delete: 'Удалить',
|
||||
editor_delete_prompt: 'Вы уверены?',
|
||||
editor_delete_yes: 'Удалить',
|
||||
editor_delete_no: 'Отмена',
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Загрузка файла...',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue