Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Changes to prompt for confirmation on file deletion #4526

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,8 +1142,38 @@ define(function (require, exports, module) {
}

function handleFileDelete() {
var entry = ProjectManager.getSelectedItem();
ProjectManager.deleteItem(entry);
var _entry = ProjectManager.getSelectedItem();
var _filename = FileUtils.getBaseName(_entry.fullPath);
if (_entry.isDirectory) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.LIVE_DEV_CONFIRM,
StringUtils.format(
Strings.LIVE_DEV_FOLDER_DELETE_CONFIRM,
StringUtils.breakableUrl(_filename)
),
[
{
className : Dialogs.DIALOG_BTN_CLASS_PRIMARY,
id : Dialogs.DIALOG_BTN_OK,
text : Strings.DELETE
},
{
className : Dialogs.DIALOG_BTN_CLASS_NORMAL,
id : Dialogs.DIALOG_BTN_CANCEL,
text : Strings.CANCEL
}
]

).done(function (id) {
if (id === Dialogs.DIALOG_BTN_OK) {
ProjectManager.deleteItem(_entry);
}
}
);
} else {
ProjectManager.deleteItem(_entry);
}
}

/** Show the selected sidebar (tree or working set) item in Finder/Explorer */
Expand Down
3 changes: 3 additions & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ define({
"FILE_DELETED_TITLE" : "File Deleted",
"EXT_MODIFIED_MESSAGE" : "<span class='dialog-filename'>{0}</span> has been modified on disk, but also has unsaved changes in {APP_NAME}.<br /><br />Which version do you want to keep?",
"EXT_DELETED_MESSAGE" : "<span class='dialog-filename'>{0}</span> has been deleted on disk, but has unsaved changes in {APP_NAME}.<br /><br />Do you want to keep your changes?",
"LIVE_DEV_CONFIRM" : "Confirm",
"LIVE_DEV_FOLDER_DELETE_CONFIRM" : "Are you sure you want to delete the folder <span class='dialog-filename'>{0}</span> ?",

// Find, Replace, Find in Files
"SEARCH_REGEXP_INFO" : "Use /re/ syntax for regexp search",
Expand Down Expand Up @@ -302,6 +304,7 @@ define({
"BASEURL_ERROR_HASH_DISALLOWED" : "The base URL can't contain hashes like \"{0}\".",
"BASEURL_ERROR_INVALID_CHAR" : "Special characters like '{0}' must be %-encoded.",
"BASEURL_ERROR_UNKOWN_ERROR" : "Unknown error parsing Base URL",
"DELETE" : "Delete",

// Extension Management strings
"INSTALL" : "Install",
Expand Down