mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
add open note in option
This commit is contained in:
parent
81ca4f3309
commit
8068710597
@ -363,12 +363,17 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
this.tree.reactivate(true);
|
||||
}
|
||||
else {
|
||||
const noteId = node.data.noteId;
|
||||
const notePath = treeService.getNotePath(node);
|
||||
if (noteId.startsWith('_')) {
|
||||
const openNoteIn = options.get("openNoteIn")
|
||||
if (openNoteIn === 'curtab') {
|
||||
node.setActive();
|
||||
} else {
|
||||
appContext.tabManager.openTabWithNoteWithHoisting(notePath, true);
|
||||
const noteId = node.data.noteId;
|
||||
const notePath = treeService.getNotePath(node);
|
||||
if (noteId.startsWith('_')) {
|
||||
node.setActive();
|
||||
} else {
|
||||
appContext.tabManager.openTabWithNoteWithHoisting(notePath, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import EtapiOptions from "./options/etapi.js";
|
||||
import BackupOptions from "./options/backup.js";
|
||||
import SyncOptions from "./options/sync.js";
|
||||
import TrayOptions from "./options/other/tray.js";
|
||||
import OpenNoteInOptions from "./options/other/open_note_in.js"
|
||||
import NoteErasureTimeoutOptions from "./options/other/note_erasure_timeout.js";
|
||||
import NoteRevisionsSnapshotIntervalOptions from "./options/other/note_revisions_snapshot_interval.js";
|
||||
import NetworkConnectionsOptions from "./options/other/network_connections.js";
|
||||
@ -78,7 +79,8 @@ const CONTENT_WIDGETS = {
|
||||
TrayOptions,
|
||||
NoteErasureTimeoutOptions,
|
||||
NoteRevisionsSnapshotIntervalOptions,
|
||||
NetworkConnectionsOptions
|
||||
NetworkConnectionsOptions,
|
||||
OpenNoteInOptions
|
||||
],
|
||||
_optionsAdvanced: [
|
||||
DatabaseIntegrityCheckOptions,
|
||||
|
@ -0,0 +1,27 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Open Note In</h4>
|
||||
<select class="open-note-in form-control">
|
||||
<option value="curtab">Current Tab</option>
|
||||
<option value="newtab">New Tab</option>
|
||||
</select>
|
||||
</div>`;
|
||||
|
||||
export default class OpenNoteInOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$body = $("body");
|
||||
this.$openNoteIn = this.$widget.find(".open-note-in");
|
||||
this.$openNoteIn.on('change', () => {
|
||||
const newopenNoteIn = this.$openNoteIn.val();
|
||||
|
||||
this.updateOption('openNoteIn', newopenNoteIn);
|
||||
});
|
||||
}
|
||||
|
||||
async optionsLoaded(options) {
|
||||
this.$openNoteIn.val(options.openNoteIn);
|
||||
}
|
||||
}
|
@ -61,7 +61,8 @@ const ALLOWED_OPTIONS = new Set([
|
||||
'downloadImagesAutomatically',
|
||||
'minTocHeadings',
|
||||
'checkForUpdates',
|
||||
'disableTray'
|
||||
'disableTray',
|
||||
'openNoteIn'
|
||||
]);
|
||||
|
||||
function getOptions() {
|
||||
|
@ -89,6 +89,7 @@ const defaultOptions = [
|
||||
{ name: 'minTocHeadings', value: '5', isSynced: true },
|
||||
{ name: 'checkForUpdates', value: 'true', isSynced: true },
|
||||
{ name: 'disableTray', value: 'false', isSynced: false },
|
||||
{ name: 'openNoteIn', value: 'curtab', isSynced: true },
|
||||
];
|
||||
|
||||
function initStartupOptions() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user