mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	| @@ -1,54 +0,0 @@ | |||||||
| const $dialog = $("#delete-notes-dialog"); |  | ||||||
| const $confirmContent = $("#delete-notes-dialog-content"); |  | ||||||
| const $okButton = $("#delete-notes-dialog-ok-button"); |  | ||||||
| const $cancelButton = $("#delete-notes-dialog-cancel-button"); |  | ||||||
| const $custom = $("#delete-notes-dialog-custom"); |  | ||||||
|  |  | ||||||
| const DELETE_NOTE_BUTTON_ID = "delete-notes-dialog-delete-note"; |  | ||||||
|  |  | ||||||
| let $originallyFocused; // element focused before the dialog was opened so we can return to it afterwards |  | ||||||
|  |  | ||||||
| export function showDialog(message) { |  | ||||||
|     $originallyFocused = $(':focus'); |  | ||||||
|  |  | ||||||
|     $custom.hide(); |  | ||||||
|  |  | ||||||
|     glob.activeDialog = $dialog; |  | ||||||
|  |  | ||||||
|     if (typeof message === 'string') { |  | ||||||
|         message = $("<div>").text(message); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $confirmContent.empty().append(message); |  | ||||||
|  |  | ||||||
|     $dialog.modal(); |  | ||||||
|  |  | ||||||
|     return new Promise((res, rej) => { resolve = res; }); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export function isDeleteNoteChecked() { |  | ||||||
|     return $("#" + DELETE_NOTE_BUTTON_ID + ":checked").length > 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| $dialog.on('shown.bs.modal', () => $okButton.trigger("focus")); |  | ||||||
|  |  | ||||||
| $dialog.on("hidden.bs.modal", () => { |  | ||||||
|     if (resolve) { |  | ||||||
|         resolve(false); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if ($originallyFocused) { |  | ||||||
|         $originallyFocused.trigger('focus'); |  | ||||||
|         $originallyFocused = null; |  | ||||||
|     } |  | ||||||
| }); |  | ||||||
|  |  | ||||||
| function doResolve(ret) { |  | ||||||
|     resolve(ret); |  | ||||||
|     resolve = null; |  | ||||||
|  |  | ||||||
|     $dialog.modal("hide"); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| $cancelButton.on('click', () => doResolve(false)); |  | ||||||
| $okButton.on('click', () => doResolve(true)); |  | ||||||
| @@ -74,9 +74,6 @@ async function deleteNotes(branchIdsToDelete) { | |||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const deleteNotesDialog = await import("../dialogs/delete_notes.js"); |  | ||||||
|     deleteNotesDialog.showDialog(); |  | ||||||
|  |  | ||||||
|     const $deleteClonesCheckbox = $('<div class="form-check">') |     const $deleteClonesCheckbox = $('<div class="form-check">') | ||||||
|         .append($('<input type="checkbox" class="form-check-input" id="delete-clones-checkbox">')) |         .append($('<input type="checkbox" class="form-check-input" id="delete-clones-checkbox">')) | ||||||
|         .append($('<label for="delete-clones-checkbox">') |         .append($('<label for="delete-clones-checkbox">') | ||||||
| @@ -96,7 +93,11 @@ async function deleteNotes(branchIdsToDelete) { | |||||||
|         .append($nodeTitles) |         .append($nodeTitles) | ||||||
|         .append($deleteClonesCheckbox); |         .append($deleteClonesCheckbox); | ||||||
|  |  | ||||||
|     return false; |     const confirmDialog = await import('../dialogs/confirm.js'); | ||||||
|  |  | ||||||
|  |     if (!await confirmDialog.confirm($confirmText)) { | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     const deleteClones = $deleteClonesCheckbox.find("input").is(":checked"); |     const deleteClones = $deleteClonesCheckbox.find("input").is(":checked"); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -40,7 +40,6 @@ | |||||||
| <%- include('dialogs/backend_log.ejs') %> | <%- include('dialogs/backend_log.ejs') %> | ||||||
| <%- include('dialogs/include_note.ejs') %> | <%- include('dialogs/include_note.ejs') %> | ||||||
| <%- include('dialogs/sort_child_notes.ejs') %> | <%- include('dialogs/sort_child_notes.ejs') %> | ||||||
| <%- include('dialogs/delete_notes.ejs') %> |  | ||||||
|  |  | ||||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||||
|     window.baseApiUrl = 'api/'; |     window.baseApiUrl = 'api/'; | ||||||
|   | |||||||
| @@ -1,23 +0,0 @@ | |||||||
| <div id="delete-notes-dialog" class="modal mx-auto" tabindex="-1" role="dialog"> |  | ||||||
|     <div class="modal-dialog modal-dialog-scrollable" role="document"> |  | ||||||
|         <div class="modal-content"> |  | ||||||
|             <div class="modal-header"> |  | ||||||
|                 <h5 class="modal-title mr-auto">Delete notes</h5> |  | ||||||
|  |  | ||||||
|                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |  | ||||||
|                     <span aria-hidden="true">×</span> |  | ||||||
|                 </button> |  | ||||||
|             </div> |  | ||||||
|             <div class="modal-body"> |  | ||||||
|                 ... delete |  | ||||||
|             </div> |  | ||||||
|             <div class="modal-footer"> |  | ||||||
|                 <button class="btn btn-sm" id="delete-notes-dialog-cancel-button">Cancel</button> |  | ||||||
|  |  | ||||||
|                   |  | ||||||
|  |  | ||||||
|                 <button class="btn btn-primary btn-sm" id="delete-notes-dialog-ok-button">OK</button> |  | ||||||
|             </div> |  | ||||||
|         </div> |  | ||||||
|     </div> |  | ||||||
| </div> |  | ||||||
		Reference in New Issue
	
	Block a user