Merge branch 'TriliumNext:develop' into sql

This commit is contained in:
JYC333
2024-08-09 22:40:54 +02:00
committed by GitHub
53 changed files with 1022 additions and 194 deletions

View File

@@ -34,7 +34,7 @@ abstract class AbstractBeccaEntity<T extends AbstractBeccaEntity<T>> {
isSynced?: boolean;
blobId?: string;
protected beforeSaving() {
protected beforeSaving(opts?: {}) {
const constructorData = (this.constructor as unknown as ConstructorData<T>);
if (!(this as any)[constructorData.primaryKeyName]) {
(this as any)[constructorData.primaryKeyName] = utils.newEntityId();
@@ -101,7 +101,6 @@ abstract class AbstractBeccaEntity<T extends AbstractBeccaEntity<T>> {
/**
* Saves entity - executes SQL, but doesn't commit the transaction on its own
*/
// TODO: opts not used but called a few times, maybe should be used by derived classes or passed to beforeSaving.
save(opts?: {}): this {
const constructorData = (this.constructor as unknown as ConstructorData<T>);
const entityName = constructorData.entityName;
@@ -109,7 +108,7 @@ abstract class AbstractBeccaEntity<T extends AbstractBeccaEntity<T>> {
const isNewEntity = !(this as any)[primaryKeyName];
this.beforeSaving();
this.beforeSaving(opts);
const pojo = this.getPojoToSave();

View File

@@ -48,7 +48,7 @@ paths:
- name: search
in: query
required: true
description: search query string as described in https://github.com/zadam/trilium/wiki/Search
description: search query string as described in https://github.com/TriliumNext/Docs/blob/main/Wiki/search.md
schema:
type: string
examples:

View File

@@ -102,7 +102,7 @@ export default class Entrypoints extends Component {
if (utils.isElectron()) {
// standard JS version does not work completely correctly in electron
const webContents = utils.dynamicRequire('@electron/remote').getCurrentWebContents();
const activeIndex = parseInt(webContents.getActiveIndex());
const activeIndex = parseInt(webContents.navigationHistory.getActiveIndex());
webContents.goToIndex(activeIndex - 1);
}
@@ -115,7 +115,7 @@ export default class Entrypoints extends Component {
if (utils.isElectron()) {
// standard JS version does not work completely correctly in electron
const webContents = utils.dynamicRequire('@electron/remote').getCurrentWebContents();
const activeIndex = parseInt(webContents.getActiveIndex());
const activeIndex = parseInt(webContents.navigationHistory.getActiveIndex());
webContents.goToIndex(activeIndex + 1);
}

View File

@@ -249,7 +249,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/TriliumNext/Docs/blob/main/Wiki/search.md
*
* @method
* @param {string} searchString
@@ -261,7 +261,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/TriliumNext/Docs/blob/main/Wiki/search.md
*
* @method
* @param {string} searchString
@@ -558,7 +558,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
this.getYearNote = dateNotesService.getYearNote;
/**
* Hoist note in the current tab. See https://github.com/zadam/trilium/wiki/Note-hoisting
* Hoist note in the current tab. See https://github.com/TriliumNext/Docs/blob/main/Wiki/note-hoisting.md
*
* @method
* @param {string} noteId - set hoisted note. 'root' will effectively unhoist

View File

@@ -27,7 +27,7 @@ function setupGlobs() {
window.glob.importMarkdownInline = async () => appContext.triggerCommand("importMarkdownInline");
window.glob.SEARCH_HELP_TEXT = `
<strong>Search tips</strong> - also see <button class="btn btn-sm" type="button" data-help-page="Search">complete help on search</button>
<strong>Search tips</strong> - also see <button class="btn btn-sm" type="button" data-help-page="search.md">complete help on search</button>
<p>
<ul>
<li>Just enter any text for full text search</li>

View File

@@ -330,7 +330,7 @@ function initHelpDropdown($el) {
initHelpButtons($dropdownMenu);
}
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/";
const wikiBaseUrl = "https://github.com/TriliumNext/Docs/blob/main/Wiki/";
function openHelp($button) {
const helpPage = $button.attr("data-help-page");

View File

@@ -211,8 +211,8 @@ const ATTR_HELP = {
"cssClass": "value of this label is then added as CSS class to the node representing given note in the tree. This can be useful for advanced theming. Can be used in template notes.",
"iconClass": "value of this label is added as a CSS class to the icon on the tree which can help visually distinguish the notes in the tree. Example might be bx bx-home - icons are taken from boxicons. Can be used in template notes.",
"pageSize": "number of items per page in note listing",
"customRequestHandler": 'see <a href="javascript:" data-help-page="Custom request handler">Custom request handler</a>',
"customResourceProvider": 'see <a href="javascript:" data-help-page="Custom request handler">Custom request handler</a>',
"customRequestHandler": 'see <a href="javascript:" data-help-page="custom-request-handler.md">Custom request handler</a>',
"customResourceProvider": 'see <a href="javascript:" data-help-page="custom-request-handler.md">Custom request handler</a>',
"widget": "marks this note as a custom widget which will be added to the Trilium component tree",
"workspace": "marks this note as a workspace which allows easy hoisting",
"workspaceIconClass": "defines box icon CSS class which will be used in tab when hoisted to this note",
@@ -245,7 +245,7 @@ const ATTR_HELP = {
<li><code>Log for \${now.format('YYYY-MM-DD HH:mm:ss')}</code></li>
</ul>
See <a href="https://github.com/zadam/trilium/wiki/Default-note-title">wiki with details</a>, API docs for <a href="https://zadam.github.io/trilium/backend_api/Note.html">parentNote</a> and <a href="https://day.js.org/docs/en/display/format">now</a> for details.`,
See <a href="https://github.com/TriliumNext/Docs/blob/main/Wiki/default-note-title.md">wiki with details</a>, API docs for <a href="https://zadam.github.io/trilium/backend_api/Note.html">parentNote</a> and <a href="https://day.js.org/docs/en/display/format">now</a> for details.`,
"template": "This note will appear in the selection of available template when creating new note",
"toc": "<code>#toc</code> or <code>#toc=show</code> will force the Table of Contents to be shown, <code>#toc=hide</code> will force hiding it. If the label doesn't exist, the global setting is observed",
"color": "defines color of the note in note tree, links etc. Use any valid CSS color value like 'red' or #a13d5f",

View File

@@ -337,7 +337,7 @@ export default class GlobalMenuWidget extends BasicWidget {
}
downloadLatestVersionCommand() {
window.open("https://github.com/zadam/trilium/releases/latest");
window.open("https://github.com/TriliumNext/Notes/releases/latest");
}
activeContextChangedEvent() {

View File

@@ -10,7 +10,7 @@ const TPL = `
<div class="modal-header">
<h5 class="modal-title mr-auto">Add link</h5>
<button type="button" class="help-button" title="Help on links" data-help-page="Links">?</button>
<button type="button" class="help-button" title="Help on links" data-help-page="links.md">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span>

View File

@@ -15,7 +15,7 @@ const TPL = `<div class="branch-prefix-dialog modal fade mx-auto" tabindex="-1"
<div class="modal-header">
<h5 class="modal-title mr-auto">Edit branch prefix</h5>
<button class="help-button" type="button" data-help-page="Tree-concepts#prefix" title="Help on Tree prefix">?</button>
<button class="help-button" type="button" data-help-page="tree-concepts.md#prefix" title="Help on Tree prefix">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0;">
<span aria-hidden="true">&times;</span>

View File

@@ -14,7 +14,7 @@ const TPL = `
<div class="modal-header">
<h5 class="modal-title mr-auto">Clone notes to ...</h5>
<button type="button" class="help-button" title="Help on links" data-help-page="Cloning-notes">?</button>
<button type="button" class="help-button" title="Help on links" data-help-page="cloning-notes.md">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span>

View File

@@ -23,7 +23,7 @@ const TPL = `
<li><kbd>UP</kbd>, <kbd>DOWN</kbd> - go up/down in the list of notes</li>
<li><kbd>LEFT</kbd>, <kbd>RIGHT</kbd> - collapse/expand node</li>
<li><kbd data-command="backInNoteHistory">not set</kbd>, <kbd data-command="forwardInNoteHistory">not set</kbd> - go back / forwards in the history</li>
<li><kbd data-command="jumpToNote">not set</kbd> - show <a class="external" href="https://github.com/zadam/trilium/wiki/Note-navigation#jump-to-note">"Jump to" dialog</a></li>
<li><kbd data-command="jumpToNote">not set</kbd> - show <a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/note-navigation.md#jump-to-note">"Jump to" dialog</a></li>
<li><kbd data-command="scrollToActiveNote">not set</kbd> - scroll to active note</li>
<li><kbd>Backspace</kbd> - jump to parent note</li>
<li><kbd data-command="collapseTree">not set</kbd> - collapse whole note tree</li>
@@ -61,7 +61,7 @@ const TPL = `
<ul>
<li><kbd data-command="createNoteAfter">not set</kbd> - create new note after the active note</li>
<li><kbd data-command="createNoteInto">not set</kbd> - create new sub-note into active note</li>
<li><kbd data-command="editBranchPrefix">not set</kbd> - edit <a class="external" href="https://github.com/zadam/trilium/wiki/Tree concepts#prefix">prefix</a> of active note clone</li>
<li><kbd data-command="editBranchPrefix">not set</kbd> - edit <a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/tree-concepts.md#prefix">prefix</a> of active note clone</li>
</ul>
</p>
</div>
@@ -78,7 +78,7 @@ const TPL = `
<li><kbd data-command="addNoteAboveToSelection">not set</kbd>, <kbd data-command="addNoteBelowToSelection">not set</kbd> - multi-select note above/below</li>
<li><kbd data-command="selectAllNotesInParent">not set</kbd> - select all notes in the current level</li>
<li><kbd>Shift+click</kbd> - select note</li>
<li><kbd data-command="copyNotesToClipboard">not set</kbd> - copy active note (or current selection) into clipboard (used for <a class="external" href="https://github.com/zadam/trilium/wiki/Cloning notes">cloning</a>)</li>
<li><kbd data-command="copyNotesToClipboard">not set</kbd> - copy active note (or current selection) into clipboard (used for <a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/cloning-notes.md">cloning</a>)</li>
<li><kbd data-command="cutNotesToClipboard">not set</kbd> - cut current (or current selection) note into clipboard (used for moving notes)</li>
<li><kbd data-command="pasteNotesFromClipboard">not set</kbd> - paste note(s) as sub-note into active note (which is either move or clone depending on whether it was copied or cut into clipboard)</li>
<li><kbd data-command="deleteNotes">not set</kbd> - delete note / sub-tree</li>
@@ -107,7 +107,7 @@ const TPL = `
<div class="card">
<div class="card-body">
<h5 class="card-title"><a class="external" href="https://github.com/zadam/trilium/wiki/Text-notes#autoformat">Markdown-like autoformatting</a></h5>
<h5 class="card-title"><a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/text-notes.md#markdown--autoformat">Markdown-like autoformatting</a></h5>
<p class="card-text">
<ul>

View File

@@ -9,7 +9,7 @@ const TPL = `
<div class="modal-header">
<h5 class="modal-title mr-auto">Protected session</h5>
<button class="help-button" type="button" data-help-page="Protected-notes" title="Help on Protected notes">?</button>
<button class="help-button" type="button" data-help-page="protected-notes.md" title="Help on Protected notes">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0;">
<span aria-hidden="true">&times;</span>

View File

@@ -45,7 +45,7 @@ const TPL = `
title="Delete all revisions of this note"
style="padding: 0 10px 0 10px;" type="button">Delete all revisions</button>
<button class="help-button" type="button" data-help-page="Note-revisions" title="Help on Note revisions">?</button>
<button class="help-button" type="button" data-help-page="note-revisions.md" title="Help on Note revisions">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span>

View File

@@ -14,7 +14,7 @@ const TPL = `
<div class="dropdown help-dropdown">
<span class="bx bx-help-circle icon-action" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu dropdown-menu-right p-4">
<strong>Search syntax</strong> - also see <button class="btn btn-sm" type="button" data-help-page="Search">complete help on search syntax</button>
<strong>Search syntax</strong> - also see <button class="btn btn-sm" type="button" data-help-page="search.md">complete help on search syntax</button>
<p>
<ul>
<li>Just enter any text for full text search</li>

View File

@@ -13,7 +13,7 @@ const TPL = `
}
</style>
<span class="shared-text"></span> <a class="shared-link external"></a>. For help visit <a href="https://github.com/zadam/trilium/wiki/Sharing">wiki</a>.
<span class="shared-text"></span> <a class="shared-link external"></a>. For help visit <a href="https://github.com/TriliumNext/Docs/blob/main/Wiki/sharing.md">wiki</a>.
</div>`;
export default class SharedInfoWidget extends NoteContextAwareWidget {

View File

@@ -20,7 +20,7 @@ export default class SharedSwitchWidget extends SwitchWidget {
this.$switchOffName.text("Shared");
this.$switchOffButton.attr("title", "Unshare the note");
this.$helpButton.attr("data-help-page", "Sharing").show();
this.$helpButton.attr("data-help-page", "sharing.md").show();
this.$helpButton.on('click', e => utils.openHelp($(e.target)));
}

View File

@@ -47,7 +47,7 @@ export default class AttachmentDetailTypeWidget extends TypeWidget {
this.$wrapper.empty();
this.children = [];
const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments" title="Open help page on attachments"><span class="bx bx-help-circle"></span></button>');
const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments.md" title="Open help page on attachments"><span class="bx bx-help-circle"></span></button>');
utils.initHelpButtons($helpButton);
this.$linksWrapper.empty().append(

View File

@@ -39,7 +39,7 @@ export default class AttachmentListTypeWidget extends TypeWidget {
}
async doRefresh(note) {
const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments" title="Open help page on attachments"><span class="bx bx-help-circle"></span></button>');
const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments.md" title="Open help page on attachments"><span class="bx bx-help-circle"></span></button>');
utils.initHelpButtons($helpButton);
const noteLink = await linkService.createLink(this.noteId); // do separately to avoid race condition between empty() and .append()

View File

@@ -13,7 +13,7 @@ const TPL = `
</style>
<div class="note-detail-book-empty-help alert alert-warning" style="margin: 50px; padding: 20px;">
This note of type Book doesn't have any child notes so there's nothing to display. See <a href="https://github.com/zadam/trilium/wiki/Book-note">wiki</a> for details.
This note of type Book doesn't have any child notes so there's nothing to display. See <a href="https://github.com/TriliumNext/Docs/blob/main/Wiki/book-note.md">wiki</a> for details.
</div>
</div>`;

View File

@@ -8,7 +8,7 @@ const TPL = `
<h4>ETAPI</h4>
<p>ETAPI is a REST API used to access Trilium instance programmatically, without UI. <br/>
See more details on <a href="https://github.com/zadam/trilium/wiki/ETAPI">wiki</a> and <a onclick="window.open('etapi/etapi.openapi.yaml')" href="etapi/etapi.openapi.yaml">ETAPI OpenAPI spec</a>.</p>
See more details on <a href="https://github.com/TriliumNext/Docs/blob/main/Wiki/etapi.md">wiki</a> and <a onclick="window.open('etapi/etapi.openapi.yaml')" href="etapi/etapi.openapi.yaml">ETAPI OpenAPI spec</a>.</p>
<button type="button" class="create-etapi-token btn btn-sm">Create new ETAPI token</button>

View File

@@ -4,7 +4,7 @@ const TPL = `
<div class="options-section">
<h4>Note Revisions Snapshot Interval</h4>
<p>Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See <a href="https://github.com/zadam/trilium/wiki/Note-revisions" class="external">wiki</a> for more info.</p>
<p>Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See <a href="https://github.com/TriliumNext/Docs/blob/main/Wiki/note-revisions.md" class="external">wiki</a> for more info.</p>
<div class="form-group">
<label>Note revision snapshot time interval (in seconds)</label>

View File

@@ -37,7 +37,7 @@ const TPL = `
<h4>Protected Session Timeout</h4>
<p>Protected session timeout is a time period after which the protected session is wiped from
the browser's memory. This is measured from the last interaction with protected notes. See <a href="https://github.com/zadam/trilium/wiki/Protected-notes" class="external">wiki</a> for more info.</p>
the browser's memory. This is measured from the last interaction with protected notes. See <a href="https://github.com/TriliumNext/Docs/blob/main/Wiki/protected-notes.md" class="external">wiki</a> for more info.</p>
<div class="form-group">
<label>Protected session timeout (in seconds)</label>

View File

@@ -28,7 +28,7 @@ const TPL = `
<div style="display: flex; justify-content: space-between;">
<button class="btn btn-primary">Save</button>
<button class="btn" type="button" data-help-page="Synchronization">Help</button>
<button class="btn" type="button" data-help-page="synchronization.md">Help</button>
</div>
</form>
</div>

View File

@@ -12,7 +12,7 @@ const TPL = `
<div class="note-detail-render-help alert alert-warning" style="margin: 50px; padding: 20px;">
<p><strong>This help note is shown because this note of type Render HTML doesn't have required relation to function properly.</strong></p>
<p>Render HTML note type is used for <a class="external" href="https://github.com/zadam/trilium/wiki/Scripts">scripting</a>. In short, you have a HTML code note (optionally with some JavaScript) and this note will render it. To make it work, you need to define a <a class="external" href="https://github.com/zadam/trilium/wiki/Attributes">relation</a> called "renderNote" pointing to the HTML note to render.</p>
<p>Render HTML note type is used for <a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/scripts.md">scripting</a>. In short, you have a HTML code note (optionally with some JavaScript) and this note will render it. To make it work, you need to define a <a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/attributes.md">relation</a> called "renderNote" pointing to the HTML note to render.</p>
</div>
<div class="note-detail-render-content"></div>

View File

@@ -4,6 +4,7 @@ body {
--ck-color-base-text: var(--main-text-color);
--ck-color-base-foreground: var(--accented-background-color);
--ck-color-base-background: var(--main-background-color);
--ck-color-dialog-background: var(--ck-color-base-background);
--ck-color-focus-border: var(--main-border-color);
--ck-color-text: var(--main-text-color);
--ck-color-shadow-drop: var(--main-background-color);

View File

@@ -114,13 +114,13 @@ interface Api {
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "#dateModified =* MONTH AND #log". See {@link https://github.com/zadam/trilium/wiki/Search} for full documentation for all options
* "#dateModified =* MONTH AND #log". See {@link https://github.com/TriliumNext/Docs/blob/main/Wiki/search.md} for full documentation for all options
*/
searchForNotes(query: string, searchParams: SearchParams): BNote[];
/**
* This is a powerful search method - you can search by attributes and their values, e.g.:
* "#dateModified =* MONTH AND #log". See {@link https://github.com/zadam/trilium/wiki/Search} for full documentation for all options
* "#dateModified =* MONTH AND #log". See {@link https://github.com/TriliumNext/Docs/blob/main/Wiki/search.md} for full documentation for all options
*/
searchForNote(query: string, searchParams: SearchParams): BNote | null;
@@ -251,7 +251,7 @@ interface Api {
*/
sortNotes(parentNoteId: string, sortConfig: {
/** 'title', 'dateCreated', 'dateModified' or a label name
* See {@link https://github.com/zadam/trilium/wiki/Sorting} for details. */
* See {@link https://github.com/TriliumNext/Docs/blob/main/Wiki/sorting.md} for details. */
sortBy?: string;
reverse?: boolean;
foldersFirst?: boolean;

View File

@@ -1,4 +1,4 @@
export default {
buildDate: "2024-07-28T07:12:19Z",
buildRevision: "1d142b9e572bc5558997f0cf33523da3dbfce174"
buildDate: "2024-08-06T17:40:58Z",
buildRevision: "712ef92f7ca6b12cf19a8aa81b9735fd5f08cce8"
};

View File

@@ -817,7 +817,6 @@ function undeleteBranch(branchId: string, deleteId: string, taskContext: TaskCon
for (const attributeRow of attributeRows) {
// relation might point to a note which hasn't been undeleted yet and would thus throw up
// TODO: skipValidation is not used.
new BAttribute(attributeRow).save({skipValidation: true});
}
@@ -997,8 +996,7 @@ function duplicateSubtreeInner(origNote: BNote, origBranch: BBranch, newParentNo
}
// the relation targets may not be created yet, the mapping is pre-generated
// TODO: This used to be `attr.save({skipValidation: true});`, but skipValidation is in beforeSaving.
attr.save();
attr.save({skipValidation: true});
}
for (const childBranch of origNote.getChildBranches()) {

View File

@@ -14,8 +14,21 @@ import ws from "./ws.js";
import becca_loader from "../becca/becca_loader.js";
import entity_changes from "./entity_changes.js";
const dbConnection: DatabaseType = new Database(dataDir.DOCUMENT_PATH);
dbConnection.pragma('journal_mode = WAL');
function buildDatabase(path: string) {
if (process.env.TRILIUM_INTEGRATION_TEST === "memory") {
// This allows a database that is read normally but is kept in memory and discards all modifications.
const dbBuffer = fs.readFileSync(path);
return new Database(dbBuffer);
}
return new Database(dataDir.DOCUMENT_PATH);
}
const dbConnection: DatabaseType = buildDatabase(dataDir.DOCUMENT_PATH);
if (!process.env.TRILIUM_INTEGRATION_TEST) {
dbConnection.pragma('journal_mode = WAL');
}
const LOG_ALL_QUERIES = false;