mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02: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 bundle from "./bundle.js";
|
||||||
import treeCache from "./tree_cache.js";
|
import treeCache from "./tree_cache.js";
|
||||||
import libraryLoader from "./library_loader.js";
|
import libraryLoader from "./library_loader.js";
|
||||||
|
import hoistedNoteService from './hoisted_note.js';
|
||||||
|
|
||||||
// required for CKEditor image upload plugin
|
// required for CKEditor image upload plugin
|
||||||
window.glob.getCurrentNode = treeService.getCurrentNode;
|
window.glob.getCurrentNode = treeService.getCurrentNode;
|
||||||
@ -84,6 +85,8 @@ $(document).on("click", "button[data-help-page]", e => {
|
|||||||
|
|
||||||
$("#logout-button").toggle(!utils.isElectron());
|
$("#logout-button").toggle(!utils.isElectron());
|
||||||
|
|
||||||
|
$("#tree").on("click", ".unhoist-button", hoistedNoteService.unhoist);
|
||||||
|
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
require('electron').ipcRenderer.on('create-day-sub-note', async function(event, parentNoteId) {
|
require('electron').ipcRenderer.on('create-day-sub-note', async function(event, parentNoteId) {
|
||||||
// this might occur when day note had to be created
|
// this might occur when day note had to be created
|
||||||
|
@ -22,7 +22,12 @@ async function setHoistedNoteId(noteId) {
|
|||||||
await tree.reload();
|
await tree.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function unhoist() {
|
||||||
|
await setHoistedNoteId('root');
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getHoistedNoteId,
|
getHoistedNoteId,
|
||||||
setHoistedNoteId
|
setHoistedNoteId,
|
||||||
|
unhoist
|
||||||
}
|
}
|
@ -122,7 +122,7 @@ async function activateNote(notePath, newNote) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unhoist so we can activate the note
|
// unhoist so we can activate the note
|
||||||
await hoistedNoteService.setHoistedNoteId('root');
|
await hoistedNoteService.unhoist();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glob.activeDialog) {
|
if (glob.activeDialog) {
|
||||||
@ -417,6 +417,15 @@ function initFancyTree(tree) {
|
|||||||
},
|
},
|
||||||
clones: {
|
clones: {
|
||||||
highlightActiveClones: true
|
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);
|
hoistedNoteService.setHoistedNoteId(node.data.noteId);
|
||||||
}
|
}
|
||||||
else if (cmd === "unhoist") {
|
else if (cmd === "unhoist") {
|
||||||
hoistedNoteService.setHoistedNoteId('root');
|
hoistedNoteService.unhoist();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
messagingService.logError("Unknown command: " + cmd);
|
messagingService.logError("Unknown command: " + cmd);
|
||||||
|
@ -117,7 +117,7 @@ const keyBindings = {
|
|||||||
"ctrl+h": node => {
|
"ctrl+h": node => {
|
||||||
hoistedNoteService.getHoistedNoteId().then(hoistedNoteId => {
|
hoistedNoteService.getHoistedNoteId().then(hoistedNoteId => {
|
||||||
if (node.data.noteId === hoistedNoteId) {
|
if (node.data.noteId === hoistedNoteId) {
|
||||||
hoistedNoteService.setHoistedNoteId('root');
|
hoistedNoteService.unhoist();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hoistedNoteService.setHoistedNoteId(node.data.noteId);
|
hoistedNoteService.setHoistedNoteId(node.data.noteId);
|
||||||
|
@ -699,3 +699,9 @@ div[data-notify="container"] {
|
|||||||
#export-form .form-check-label {
|
#export-form .form-check-label {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unhoist-button {
|
||||||
|
text-decoration: underline !important;
|
||||||
|
color: blue !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user