Skip to content

Commit

Permalink
fix: use confirmDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny243 committed Aug 13, 2020
1 parent ef65129 commit ee49d80
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
24 changes: 14 additions & 10 deletions app/assets/javascripts/directives/views/historyMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SNItem, ItemHistoryEntry } from '@node_modules/snjs/dist/@types';
import { PureViewCtrl } from '@/views';
import { ItemSessionHistory } from 'snjs/dist/@types/services/history/session/item_session_history';
import { RemoteHistoryList, RemoteHistoryListEntry } from 'snjs/dist/@types/services/history/history_manager';
import { confirmDialog } from '@/services/alertService';

interface HistoryScope {
application: WebApplication
Expand Down Expand Up @@ -90,9 +91,10 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
}

clearItemHistory() {
this.application.alertService!.confirm(
"Are you sure you want to delete the local session history for this note?"
).then((confirmed) => {
confirmDialog({
text: "Are you sure you want to delete the local session history for this note?",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (!confirmed) {
return;
}
Expand All @@ -105,9 +107,10 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
}

clearAllHistory() {
this.application.alertService!.confirm(
"Are you sure you want to delete the local session history for all notes?"
).then((confirmed) => {
confirmDialog({
text: "Are you sure you want to delete the local session history for all notes?",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (!confirmed) {
return;
}
Expand Down Expand Up @@ -136,11 +139,12 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
});
};
if (!this.application.historyManager!.isDiskEnabled()) {
this.application.alertService!.confirm(
"Are you sure you want to save history to disk? This will decrease general " +
confirmDialog({
text: "Are you sure you want to save history to disk? This will decrease general " +
"performance, especially as you type. You are advised to disable this feature " +
"if you experience any lagging."
).then((confirmed) => {
"if you experience any lagging.",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (confirmed) {
run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from 'snjs';
import template from '%/directives/revision-preview-modal.pug';
import { PayloadContent } from '@node_modules/snjs/dist/@types/protocol/payloads/generator';
import { confirmDialog } from '@/services/alertService';

interface RevisionPreviewScope {
uuid: string
Expand Down Expand Up @@ -109,9 +110,10 @@ class RevisionPreviewModalCtrl implements RevisionPreviewScope {
};

if (!asCopy) {
this.application.alertService!.confirm(
"Are you sure you want to replace the current note's contents with what you see in this preview?"
).then((confirmed) => {
confirmDialog({
text: "Are you sure you want to replace the current note's contents with what you see in this preview?",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (confirmed) {
run();
}
Expand Down

0 comments on commit ee49d80

Please sign in to comment.