mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge pull request #377 from flurmbo/master
add confirm type change dialog when note not empty
This commit is contained in:
commit
0fc3053b0a
@ -110,35 +110,49 @@ function NoteTypeModel() {
|
|||||||
self.updateExecuteScriptButtonVisibility();
|
self.updateExecuteScriptButtonVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectText = function() {
|
function confirmChangeIfContent() {
|
||||||
|
if (noteDetailService.getCurrentNote().content && !confirm(
|
||||||
|
"It is not recommended to change note type when note content is not empty. Do you want to continue?")
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectText = async function() {
|
||||||
|
if (!(await confirmChangeIfContent())) { return; }
|
||||||
self.type('text');
|
self.type('text');
|
||||||
self.mime('');
|
self.mime('');
|
||||||
|
|
||||||
save();
|
save();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectRender = function() {
|
this.selectRender = async function() {
|
||||||
|
if (!(await confirmChangeIfContent())) { return; }
|
||||||
self.type('render');
|
self.type('render');
|
||||||
self.mime('text/html');
|
self.mime('text/html');
|
||||||
|
|
||||||
save();
|
save();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectRelationMap = function() {
|
this.selectRelationMap = async function() {
|
||||||
|
if (!(await confirmChangeIfContent())) { return; }
|
||||||
self.type('relation-map');
|
self.type('relation-map');
|
||||||
self.mime('application/json');
|
self.mime('application/json');
|
||||||
|
|
||||||
save();
|
save();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectCode = function() {
|
this.selectCode = async function() {
|
||||||
|
if (!(await confirmChangeIfContent())) { return; }
|
||||||
self.type('code');
|
self.type('code');
|
||||||
self.mime('');
|
self.mime('');
|
||||||
|
|
||||||
save();
|
save();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectCodeMime = function(el) {
|
this.selectCodeMime = async function(el) {
|
||||||
|
if (!(await confirmChangeIfContent())) { return; }
|
||||||
self.type('code');
|
self.type('code');
|
||||||
self.mime(el.mime);
|
self.mime(el.mime);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user