fix: use confirmDialog
This commit is contained in:
@@ -5,6 +5,7 @@ import { SNItem, ItemHistoryEntry } from '@node_modules/snjs/dist/@types';
|
|||||||
import { PureViewCtrl } from '@/views';
|
import { PureViewCtrl } from '@/views';
|
||||||
import { ItemSessionHistory } from 'snjs/dist/@types/services/history/session/item_session_history';
|
import { ItemSessionHistory } from 'snjs/dist/@types/services/history/session/item_session_history';
|
||||||
import { RemoteHistoryList, RemoteHistoryListEntry } from 'snjs/dist/@types/services/history/history_manager';
|
import { RemoteHistoryList, RemoteHistoryListEntry } from 'snjs/dist/@types/services/history/history_manager';
|
||||||
|
import { confirmDialog } from '@/services/alertService';
|
||||||
|
|
||||||
interface HistoryScope {
|
interface HistoryScope {
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
@@ -90,9 +91,10 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearItemHistory() {
|
clearItemHistory() {
|
||||||
this.application.alertService!.confirm(
|
confirmDialog({
|
||||||
"Are you sure you want to delete the local session history for this note?"
|
text: "Are you sure you want to delete the local session history for this note?",
|
||||||
).then((confirmed) => {
|
confirmButtonStyle: "danger"
|
||||||
|
}).then((confirmed) => {
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -105,9 +107,10 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearAllHistory() {
|
clearAllHistory() {
|
||||||
this.application.alertService!.confirm(
|
confirmDialog({
|
||||||
"Are you sure you want to delete the local session history for all notes?"
|
text: "Are you sure you want to delete the local session history for all notes?",
|
||||||
).then((confirmed) => {
|
confirmButtonStyle: "danger"
|
||||||
|
}).then((confirmed) => {
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -136,11 +139,12 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
if (!this.application.historyManager!.isDiskEnabled()) {
|
if (!this.application.historyManager!.isDiskEnabled()) {
|
||||||
this.application.alertService!.confirm(
|
confirmDialog({
|
||||||
"Are you sure you want to save history to disk? This will decrease general " +
|
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 " +
|
"performance, especially as you type. You are advised to disable this feature " +
|
||||||
"if you experience any lagging."
|
"if you experience any lagging.",
|
||||||
).then((confirmed) => {
|
confirmButtonStyle: "danger"
|
||||||
|
}).then((confirmed) => {
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
run();
|
run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
} from 'snjs';
|
} from 'snjs';
|
||||||
import template from '%/directives/revision-preview-modal.pug';
|
import template from '%/directives/revision-preview-modal.pug';
|
||||||
import { PayloadContent } from '@node_modules/snjs/dist/@types/protocol/payloads/generator';
|
import { PayloadContent } from '@node_modules/snjs/dist/@types/protocol/payloads/generator';
|
||||||
|
import { confirmDialog } from '@/services/alertService';
|
||||||
|
|
||||||
interface RevisionPreviewScope {
|
interface RevisionPreviewScope {
|
||||||
uuid: string
|
uuid: string
|
||||||
@@ -109,9 +110,10 @@ class RevisionPreviewModalCtrl implements RevisionPreviewScope {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!asCopy) {
|
if (!asCopy) {
|
||||||
this.application.alertService!.confirm(
|
confirmDialog({
|
||||||
"Are you sure you want to replace the current note's contents with what you see in this preview?"
|
text: "Are you sure you want to replace the current note's contents with what you see in this preview?",
|
||||||
).then((confirmed) => {
|
confirmButtonStyle: "danger"
|
||||||
|
}).then((confirmed) => {
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
run();
|
run();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user