mirror of
https://github.com/zadam/trilium.git
synced 2025-01-14 19:19:28 +08:00
allow #newNotesOnTop=false to negate previous setting, closes #3796
This commit is contained in:
parent
a0e9ac73c9
commit
d100b0dc07
4 changed files with 31 additions and 3 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "trilium",
|
||||
"version": "0.59.2",
|
||||
"version": "0.59.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "0.59.2",
|
||||
"version": "0.59.3",
|
||||
"hasInstallScript": true,
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
|
|
|
@ -532,6 +532,20 @@ class BNote extends AbstractBeccaEntity {
|
|||
*/
|
||||
hasLabel(name, value) { return this.hasAttribute(LABEL, name, value); }
|
||||
|
||||
/**
|
||||
* @param {string} name - label name
|
||||
* @returns {boolean} true if label exists (including inherited) and does not have "false" value.
|
||||
*/
|
||||
isLabelTruthy(name) {
|
||||
const label = this.getLabel(name);
|
||||
|
||||
if (!label) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return label && label.value !== 'false';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name - label name
|
||||
* @param {string} [value] - label value
|
||||
|
|
|
@ -595,6 +595,20 @@ class FNote {
|
|||
*/
|
||||
hasLabel(name) { return this.hasAttribute(LABEL, name); }
|
||||
|
||||
/**
|
||||
* @param {string} name - label name
|
||||
* @returns {boolean} true if label exists (including inherited) and does not have "false" value.
|
||||
*/
|
||||
isLabelTruthy(name) {
|
||||
const label = this.getLabel(name);
|
||||
|
||||
if (!label) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return label && label.value !== 'false';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name - relation name
|
||||
* @returns {boolean} true if relation exists (excluding inherited)
|
||||
|
|
|
@ -23,7 +23,7 @@ const ValidationError = require("../errors/validation_error");
|
|||
const noteTypesService = require("./note_types");
|
||||
|
||||
function getNewNotePosition(parentNote) {
|
||||
if (parentNote.hasLabel('newNotesOnTop')) {
|
||||
if (parentNote.isLabelTruthy('newNotesOnTop')) {
|
||||
const minNotePos = parentNote.getChildBranches()
|
||||
.reduce((min, note) => Math.min(min, note.notePosition), 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue