mirror of
https://github.com/zadam/trilium.git
synced 2024-09-22 08:36:10 +08:00
quick unhoist link/button
This commit is contained in:
parent
a680bb4612
commit
841420360e
3
src/public/javascripts/services/bootstrap.js
vendored
3
src/public/javascripts/services/bootstrap.js
vendored
|
@ -32,6 +32,7 @@ import tooltip from './tooltip.js';
|
|||
import bundle from "./bundle.js";
|
||||
import treeCache from "./tree_cache.js";
|
||||
import libraryLoader from "./library_loader.js";
|
||||
import hoistedNoteService from './hoisted_note.js';
|
||||
|
||||
// required for CKEditor image upload plugin
|
||||
window.glob.getCurrentNode = treeService.getCurrentNode;
|
||||
|
@ -84,6 +85,8 @@ $(document).on("click", "button[data-help-page]", e => {
|
|||
|
||||
$("#logout-button").toggle(!utils.isElectron());
|
||||
|
||||
$("#tree").on("click", ".unhoist-button", hoistedNoteService.unhoist);
|
||||
|
||||
if (utils.isElectron()) {
|
||||
require('electron').ipcRenderer.on('create-day-sub-note', async function(event, parentNoteId) {
|
||||
// this might occur when day note had to be created
|
||||
|
|
|
@ -22,7 +22,12 @@ async function setHoistedNoteId(noteId) {
|
|||
await tree.reload();
|
||||
}
|
||||
|
||||
async function unhoist() {
|
||||
await setHoistedNoteId('root');
|
||||
}
|
||||
|
||||
export default {
|
||||
getHoistedNoteId,
|
||||
setHoistedNoteId
|
||||
setHoistedNoteId,
|
||||
unhoist
|
||||
}
|
|
@ -122,7 +122,7 @@ async function activateNote(notePath, newNote) {
|
|||
}
|
||||
|
||||
// unhoist so we can activate the note
|
||||
await hoistedNoteService.setHoistedNoteId('root');
|
||||
await hoistedNoteService.unhoist();
|
||||
}
|
||||
|
||||
if (glob.activeDialog) {
|
||||
|
@ -417,6 +417,15 @@ function initFancyTree(tree) {
|
|||
},
|
||||
clones: {
|
||||
highlightActiveClones: true
|
||||
},
|
||||
renderNode: async function (event, data) {
|
||||
const node = data.node;
|
||||
|
||||
if (node.data.noteId !== 'root' && node.data.noteId === await hoistedNoteService.getHoistedNoteId()) {
|
||||
const unhoistButton = $('<span> (<a class="unhoist-button">unhoist</a>)</span>');
|
||||
|
||||
$(node.span).append(unhoistButton);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ function selectContextMenuItem(event, cmd) {
|
|||
hoistedNoteService.setHoistedNoteId(node.data.noteId);
|
||||
}
|
||||
else if (cmd === "unhoist") {
|
||||
hoistedNoteService.setHoistedNoteId('root');
|
||||
hoistedNoteService.unhoist();
|
||||
}
|
||||
else {
|
||||
messagingService.logError("Unknown command: " + cmd);
|
||||
|
|
|
@ -117,7 +117,7 @@ const keyBindings = {
|
|||
"ctrl+h": node => {
|
||||
hoistedNoteService.getHoistedNoteId().then(hoistedNoteId => {
|
||||
if (node.data.noteId === hoistedNoteId) {
|
||||
hoistedNoteService.setHoistedNoteId('root');
|
||||
hoistedNoteService.unhoist();
|
||||
}
|
||||
else {
|
||||
hoistedNoteService.setHoistedNoteId(node.data.noteId);
|
||||
|
|
|
@ -698,4 +698,10 @@ div[data-notify="container"] {
|
|||
|
||||
#export-form .form-check-label {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.unhoist-button {
|
||||
text-decoration: underline !important;
|
||||
color: blue !important;
|
||||
cursor: pointer !important;
|
||||
}
|
Loading…
Reference in a new issue