mirror of
https://github.com/zadam/trilium.git
synced 2025-01-16 20:21:43 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c8af250caa
11 changed files with 46 additions and 81 deletions
BIN
bin/better-sqlite3/linux-desktop-better_sqlite3.node
Normal file
BIN
bin/better-sqlite3/linux-desktop-better_sqlite3.node
Normal file
Binary file not shown.
|
@ -11,7 +11,7 @@ rm -r $SRC_DIR/src/public/app-dist/*.mobile.*
|
||||||
|
|
||||||
echo "Copying required linux-x64 binaries"
|
echo "Copying required linux-x64 binaries"
|
||||||
|
|
||||||
cp -r bin/better-sqlite3/linux-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
|
cp -r bin/better-sqlite3/linux-desktop-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
|
||||||
|
|
||||||
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite
|
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,11 @@ cd ..
|
||||||
|
|
||||||
mv dist/node-v${NODE_VERSION}-linux-x64 $PKG_DIR/node
|
mv dist/node-v${NODE_VERSION}-linux-x64 $PKG_DIR/node
|
||||||
|
|
||||||
|
rm -r $PKG_DIR/node/lib/node_modules/npm
|
||||||
|
|
||||||
rm -r $PKG_DIR/node_modules/electron*
|
rm -r $PKG_DIR/node_modules/electron*
|
||||||
|
|
||||||
cp -r bin/better-sqlite3/linux-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
|
cp -r bin/better-sqlite3/linux-server-better_sqlite3.node $PKG_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
|
||||||
|
|
||||||
printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh
|
printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh
|
||||||
chmod 755 $PKG_DIR/trilium.sh
|
chmod 755 $PKG_DIR/trilium.sh
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
/**!
|
|
||||||
* jquery.fancytree.hotkeys.js
|
|
||||||
*
|
|
||||||
* Integrate the 'jQuery.Hotkeys' plugin as Fancytree extension:
|
|
||||||
* https://github.com/jeresig/jquery.hotkeys/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2017, Martin Wendt (http://wwWendt.de)
|
|
||||||
* Released under the MIT license
|
|
||||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
|
||||||
*/
|
|
||||||
(function($, document) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var initHotkeys = function(tree, data) {
|
|
||||||
$.each(data, function(event, keys) {
|
|
||||||
$.each(keys, function(key, handler) {
|
|
||||||
$(tree.$container).on(event, null, key, function(evt) {
|
|
||||||
var node = tree.getActiveNode();
|
|
||||||
return handler(node, evt);
|
|
||||||
// return false from the handler will stop default handling.
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$.ui.fancytree.registerExtension({
|
|
||||||
name: "hotkeys",
|
|
||||||
version: "@VERSION",
|
|
||||||
hotkeys: { },
|
|
||||||
treeInit: function(ctx) {
|
|
||||||
this._superApply(arguments);
|
|
||||||
initHotkeys(this, ctx.options.hotkeys);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}(jQuery, document));
|
|
|
@ -28,8 +28,6 @@ class AppContext extends Component {
|
||||||
async start() {
|
async start() {
|
||||||
await Promise.all([treeCache.initializedPromise, options.initializedPromise]);
|
await Promise.all([treeCache.initializedPromise, options.initializedPromise]);
|
||||||
|
|
||||||
$("#loading-indicator").hide();
|
|
||||||
|
|
||||||
this.showWidgets();
|
this.showWidgets();
|
||||||
|
|
||||||
this.tabManager.loadTabs();
|
this.tabManager.loadTabs();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function reloadApp() {
|
function reloadApp() {
|
||||||
window.location.reload(true);
|
//window.location.reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseDate(str) {
|
function parseDate(str) {
|
||||||
|
|
|
@ -303,7 +303,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
this.$tree.fancytree({
|
this.$tree.fancytree({
|
||||||
titlesTabbable: true,
|
titlesTabbable: true,
|
||||||
keyboard: true,
|
keyboard: true,
|
||||||
extensions: utils.isMobile() ? ["dnd5", "clones"] : ["hotkeys", "dnd5", "clones"],
|
extensions: ["dnd5", "clones"],
|
||||||
source: treeData,
|
source: treeData,
|
||||||
scrollOfs: {
|
scrollOfs: {
|
||||||
top: 100,
|
top: 100,
|
||||||
|
@ -354,7 +354,6 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
},
|
},
|
||||||
expand: (event, data) => this.setExpanded(data.node.data.branchId, true),
|
expand: (event, data) => this.setExpanded(data.node.data.branchId, true),
|
||||||
collapse: (event, data) => this.setExpanded(data.node.data.branchId, false),
|
collapse: (event, data) => this.setExpanded(data.node.data.branchId, false),
|
||||||
//hotkeys: utils.isMobile() ? undefined : { keydown: await this.getHotKeys() },
|
|
||||||
dnd5: {
|
dnd5: {
|
||||||
autoExpandMS: 600,
|
autoExpandMS: 600,
|
||||||
dragStart: (node, data) => {
|
dragStart: (node, data) => {
|
||||||
|
@ -457,27 +456,27 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
clones: {
|
clones: {
|
||||||
highlightActiveClones: true
|
highlightActiveClones: true
|
||||||
},
|
},
|
||||||
// enhanceTitle: async function (event, data) {
|
enhanceTitle: async function (event, data) {
|
||||||
// const node = data.node;
|
const node = data.node;
|
||||||
// const $span = $(node.span);
|
const $span = $(node.span);
|
||||||
//
|
|
||||||
// if (node.data.noteId !== 'root'
|
if (node.data.noteId !== 'root'
|
||||||
// && node.data.noteId === hoistedNoteService.getHoistedNoteId()
|
&& node.data.noteId === hoistedNoteService.getHoistedNoteId()
|
||||||
// && $span.find('.unhoist-button').length === 0) {
|
&& $span.find('.unhoist-button').length === 0) {
|
||||||
//
|
|
||||||
// const unhoistButton = $('<span> (<a class="unhoist-button">unhoist</a>)</span>');
|
const unhoistButton = $('<span> (<a class="unhoist-button">unhoist</a>)</span>');
|
||||||
//
|
|
||||||
// $span.append(unhoistButton);
|
$span.append(unhoistButton);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// const note = await treeCache.getNote(node.data.noteId);
|
const note = await treeCache.getNote(node.data.noteId);
|
||||||
//
|
|
||||||
// if (note.type === 'search' && $span.find('.refresh-search-button').length === 0) {
|
if (note.type === 'search' && $span.find('.refresh-search-button').length === 0) {
|
||||||
// const refreshSearchButton = $('<span> <span class="refresh-search-button bx bx-refresh" title="Refresh saved search results"></span></span>');
|
const refreshSearchButton = $('<span> <span class="refresh-search-button bx bx-refresh" title="Refresh saved search results"></span></span>');
|
||||||
//
|
|
||||||
// $span.append(refreshSearchButton);
|
$span.append(refreshSearchButton);
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// this is done to automatically lazy load all expanded notes after tree load
|
// this is done to automatically lazy load all expanded notes after tree load
|
||||||
loadChildren: (event, data) => {
|
loadChildren: (event, data) => {
|
||||||
data.node.visit((subNode) => {
|
data.node.visit((subNode) => {
|
||||||
|
@ -490,6 +489,20 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!utils.isMobile()) {
|
||||||
|
this.getHotKeys().then(hotKeys => {
|
||||||
|
for (const key in hotKeys) {
|
||||||
|
const handler = hotKeys[key];
|
||||||
|
|
||||||
|
$(this.tree.$container).on('keydown', null, key, evt => {
|
||||||
|
const node = this.tree.getActiveNode();
|
||||||
|
return handler(node, evt);
|
||||||
|
// return false from the handler will stop default handling.
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.$tree.on('contextmenu', '.fancytree-node', e => {
|
this.$tree.on('contextmenu', '.fancytree-node', e => {
|
||||||
const node = $.ui.fancytree.getNode(e);
|
const node = $.ui.fancytree.getNode(e);
|
||||||
|
|
||||||
|
@ -611,9 +624,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
const note = branch.getNoteFromCache();
|
const note = branch.getNoteFromCache();
|
||||||
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
console.log("branch", branch);
|
throw new Error(`Branch has no note "${branch.noteId}": ${JSON.stringify(branch)}`);
|
||||||
|
|
||||||
throw new Error(`Branch has no note "${branch.noteId}": ${JSON.stringify(note)}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = (branch.prefix ? (branch.prefix + " - ") : "") + note.title;
|
const title = (branch.prefix ? (branch.prefix + " - ") : "") + note.title;
|
||||||
|
@ -633,11 +644,11 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
refKey: note.noteId,
|
refKey: note.noteId,
|
||||||
lazy: true,
|
lazy: true,
|
||||||
folder: isFolder,
|
folder: isFolder,
|
||||||
expanded: branch.isExpanded || hoistedNoteId === note.noteId,
|
expanded: (branch.isExpanded || hoistedNoteId === note.noteId) && note.type !== 'search',
|
||||||
key: utils.randomString(12) // this should prevent some "duplicate key" errors
|
key: utils.randomString(12) // this should prevent some "duplicate key" errors
|
||||||
};
|
};
|
||||||
|
|
||||||
if (node.folder && node.expanded) {
|
if (isFolder && node.expanded) {
|
||||||
node.children = this.prepareChildren(note);
|
node.children = this.prepareChildren(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,14 +656,8 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
isFolder(note) {
|
isFolder(note) {
|
||||||
if (note.type === 'search') {
|
return note.type === 'search'
|
||||||
return true;
|
|| this.getChildBranches(note).length > 0;
|
||||||
}
|
|
||||||
else {
|
|
||||||
const childBranches = this.getChildBranches(note);
|
|
||||||
|
|
||||||
return childBranches.length > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildBranches(parentNote) {
|
getChildBranches(parentNote) {
|
||||||
|
|
|
@ -70,7 +70,6 @@
|
||||||
<script src="libraries/fancytree/jquery.fancytree-all-deps.min.js"></script>
|
<script src="libraries/fancytree/jquery.fancytree-all-deps.min.js"></script>
|
||||||
|
|
||||||
<script src="libraries/jquery.hotkeys.js"></script>
|
<script src="libraries/jquery.hotkeys.js"></script>
|
||||||
<script src="libraries/jquery.fancytree.hotkeys.js"></script>
|
|
||||||
|
|
||||||
<script src="libraries/autocomplete.jquery.min.js"></script>
|
<script src="libraries/autocomplete.jquery.min.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,6 @@
|
||||||
<body class="mobile">
|
<body class="mobile">
|
||||||
<noscript>Trilium requires JavaScript to be enabled.</noscript>
|
<noscript>Trilium requires JavaScript to be enabled.</noscript>
|
||||||
|
|
||||||
<div style="text-align: center" id="loading-indicator">
|
|
||||||
<div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div>
|
<div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div>
|
<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div>
|
||||||
|
|
Loading…
Reference in a new issue