diff --git a/src/public/app/dialogs/sort_child_notes.js b/src/public/app/dialogs/sort_child_notes.js
index f6a28dd5f..e855b3fa2 100644
--- a/src/public/app/dialogs/sort_child_notes.js
+++ b/src/public/app/dialogs/sort_child_notes.js
@@ -9,8 +9,9 @@ let parentNoteId = null;
$form.on('submit', async () => {
const sortBy = $form.find("input[name='sort-by']:checked").val();
const sortDirection = $form.find("input[name='sort-direction']:checked").val();
+ const foldersFirst = $form.find("input[name='sort-folders-first']").is(":checked");
- await server.put(`notes/${parentNoteId}/sort-children`, {sortBy, sortDirection});
+ await server.put(`notes/${parentNoteId}/sort-children`, {sortBy, sortDirection, foldersFirst});
utils.closeActiveDialog();
});
diff --git a/src/public/app/widgets/toc.js b/src/public/app/widgets/toc.js
index adde8805b..3a95620a3 100644
--- a/src/public/app/widgets/toc.js
+++ b/src/public/app/widgets/toc.js
@@ -76,8 +76,6 @@ function findHeadingElementByIndex(parent, headingIndex) {
// heading level. If a heading node is found, decrement the headingIndex
// until zero is reached
- console.log(child.tagName, headingIndex);
-
if (child.tagName.match(/H\d+/i) !== null) {
if (headingIndex === 0) {
headingElement = child;
diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js
index 5f334edc8..2b7ccf595 100644
--- a/src/routes/api/notes.js
+++ b/src/routes/api/notes.js
@@ -94,13 +94,13 @@ function undeleteNote(req) {
function sortChildNotes(req) {
const noteId = req.params.noteId;
- const {sortBy, sortDirection} = req.body;
+ const {sortBy, sortDirection, foldersFirst} = req.body;
- log.info(`Sorting '${noteId}' children with ${sortBy} ${sortDirection}`);
+ log.info(`Sorting '${noteId}' children with ${sortBy} ${sortDirection}, foldersFirst=${foldersFirst}`);
const reverse = sortDirection === 'desc';
- treeService.sortNotes(noteId, sortBy, reverse);
+ treeService.sortNotes(noteId, sortBy, reverse, foldersFirst);
}
function protectNote(req) {
diff --git a/src/views/dialogs/sort_child_notes.ejs b/src/views/dialogs/sort_child_notes.ejs
index 36c6475e0..ed38a0636 100644
--- a/src/views/dialogs/sort_child_notes.ejs
+++ b/src/views/dialogs/sort_child_notes.ejs
@@ -50,6 +50,17 @@
descending
+
+
+
+