added option to create note
This commit is contained in:
parent
ba6e1cf095
commit
b69432610b
|
|
@ -2249,7 +2249,21 @@ function noteApp() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
alert(this.t('notes.not_found', { path: notePath }));
|
// Note doesn't exist - offer to create it
|
||||||
|
if (confirm(this.t('notes.create_from_link', { path: notePath }))) {
|
||||||
|
const newPath = notePath.endsWith('.md') ? notePath : `${notePath}.md`;
|
||||||
|
fetch(`/api/notes/${newPath}`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ content: '' })
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
const folderPath = newPath.includes('/') ? newPath.substring(0, newPath.lastIndexOf('/')) : '';
|
||||||
|
if (folderPath) this.expandedFolders.add(folderPath);
|
||||||
|
this.loadNotes().then(() => this.loadNote(newPath));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
"invalid_name": "Ungültiger Notizname.",
|
"invalid_name": "Ungültiger Notizname.",
|
||||||
"empty_name": "Der Notizname darf nicht leer sein.",
|
"empty_name": "Der Notizname darf nicht leer sein.",
|
||||||
"not_found": "Notiz nicht gefunden: {{path}}",
|
"not_found": "Notiz nicht gefunden: {{path}}",
|
||||||
|
"create_from_link": "Notiz \"{{path}}\" existiert nicht.\n\nMöchten Sie sie erstellen?",
|
||||||
"no_content": "Kein Inhalt zum Exportieren",
|
"no_content": "Kein Inhalt zum Exportieren",
|
||||||
"open_first": "Bitte öffne zuerst eine Notiz, bevor du Bilder hochlädst."
|
"open_first": "Bitte öffne zuerst eine Notiz, bevor du Bilder hochlädst."
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
"invalid_name": "Invalid note name.",
|
"invalid_name": "Invalid note name.",
|
||||||
"empty_name": "Note name cannot be empty.",
|
"empty_name": "Note name cannot be empty.",
|
||||||
"not_found": "Note not found: {{path}}",
|
"not_found": "Note not found: {{path}}",
|
||||||
|
"create_from_link": "Note \"{{path}}\" doesn't exist.\n\nWould you like to create it?",
|
||||||
"no_content": "No note content to export",
|
"no_content": "No note content to export",
|
||||||
"open_first": "Please open a note first before uploading images."
|
"open_first": "Please open a note first before uploading images."
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
"invalid_name": "Nombre de nota inválido.",
|
"invalid_name": "Nombre de nota inválido.",
|
||||||
"empty_name": "El nombre de la nota no puede estar vacío.",
|
"empty_name": "El nombre de la nota no puede estar vacío.",
|
||||||
"not_found": "Nota no encontrada: {{path}}",
|
"not_found": "Nota no encontrada: {{path}}",
|
||||||
|
"create_from_link": "La nota \"{{path}}\" no existe.\n\n¿Desea crearla?",
|
||||||
"no_content": "No hay contenido para exportar",
|
"no_content": "No hay contenido para exportar",
|
||||||
"open_first": "Por favor, abre una nota antes de subir imágenes."
|
"open_first": "Por favor, abre una nota antes de subir imágenes."
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
"invalid_name": "Nom de note invalide.",
|
"invalid_name": "Nom de note invalide.",
|
||||||
"empty_name": "Le nom de la note ne peut pas être vide.",
|
"empty_name": "Le nom de la note ne peut pas être vide.",
|
||||||
"not_found": "Note introuvable : {{path}}",
|
"not_found": "Note introuvable : {{path}}",
|
||||||
|
"create_from_link": "La note \"{{path}}\" n'existe pas.\n\nVoulez-vous la créer ?",
|
||||||
"no_content": "Aucun contenu à exporter",
|
"no_content": "Aucun contenu à exporter",
|
||||||
"open_first": "Veuillez d'abord ouvrir une note avant de télécharger des images."
|
"open_first": "Veuillez d'abord ouvrir une note avant de télécharger des images."
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
"invalid_name": "Neveljavno ime zapisa.",
|
"invalid_name": "Neveljavno ime zapisa.",
|
||||||
"empty_name": "Ime zapisa ne more biti prazno.",
|
"empty_name": "Ime zapisa ne more biti prazno.",
|
||||||
"not_found": "Zapisa ni mogoče najti: {{path}}",
|
"not_found": "Zapisa ni mogoče najti: {{path}}",
|
||||||
|
"create_from_link": "Zapis \"{{path}}\" ne obstaja.\n\nAli ga želite ustvariti?",
|
||||||
"no_content": "Ni vsebine za izvoz",
|
"no_content": "Ni vsebine za izvoz",
|
||||||
"open_first": "Prosimo, najprej odprite zapis, preden naložite slike."
|
"open_first": "Prosimo, najprej odprite zapis, preden naložite slike."
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
"invalid_name": "无效的笔记名称。",
|
"invalid_name": "无效的笔记名称。",
|
||||||
"empty_name": "笔记名称不能为空。",
|
"empty_name": "笔记名称不能为空。",
|
||||||
"not_found": "未找到笔记:{{path}}",
|
"not_found": "未找到笔记:{{path}}",
|
||||||
|
"create_from_link": "笔记 \"{{path}}\" 不存在。\n\n是否要创建它?",
|
||||||
"no_content": "没有可导出的笔记内容",
|
"no_content": "没有可导出的笔记内容",
|
||||||
"open_first": "请先打开一篇笔记,然后再上传图片。"
|
"open_first": "请先打开一篇笔记,然后再上传图片。"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue