mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
allow #newNotesOnTop=false to negate previous setting, closes #3796
This commit is contained in:
parent
a0e9ac73c9
commit
d100b0dc07
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.59.2",
|
"version": "0.59.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "0.59.2",
|
"version": "0.59.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -532,6 +532,20 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
*/
|
*/
|
||||||
hasLabel(name, value) { return this.hasAttribute(LABEL, name, value); }
|
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} name - label name
|
||||||
* @param {string} [value] - label value
|
* @param {string} [value] - label value
|
||||||
|
@ -595,6 +595,20 @@ class FNote {
|
|||||||
*/
|
*/
|
||||||
hasLabel(name) { return this.hasAttribute(LABEL, name); }
|
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
|
* @param {string} name - relation name
|
||||||
* @returns {boolean} true if relation exists (excluding inherited)
|
* @returns {boolean} true if relation exists (excluding inherited)
|
||||||
|
@ -23,7 +23,7 @@ const ValidationError = require("../errors/validation_error");
|
|||||||
const noteTypesService = require("./note_types");
|
const noteTypesService = require("./note_types");
|
||||||
|
|
||||||
function getNewNotePosition(parentNote) {
|
function getNewNotePosition(parentNote) {
|
||||||
if (parentNote.hasLabel('newNotesOnTop')) {
|
if (parentNote.isLabelTruthy('newNotesOnTop')) {
|
||||||
const minNotePos = parentNote.getChildBranches()
|
const minNotePos = parentNote.getChildBranches()
|
||||||
.reduce((min, note) => Math.min(min, note.notePosition), 0);
|
.reduce((min, note) => Math.min(min, note.notePosition), 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user