mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
Merge ef5374554deb5099809f13401f074d2f9ff34859 into dc0a0dcf094f904bff4da3abc18f405470b38b37
This commit is contained in:
commit
b6b4541292
@ -293,6 +293,15 @@ export default class TabManager extends Component {
|
|||||||
const hoistedNoteId = opts.hoistedNoteId || 'root';
|
const hoistedNoteId = opts.hoistedNoteId || 'root';
|
||||||
const viewMode = opts.viewMode || "default";
|
const viewMode = opts.viewMode || "default";
|
||||||
|
|
||||||
|
const targetNoteId = await treeService.getNoteIdFromNotePath(notePath);
|
||||||
|
for (const openedNoteContext of this.getNoteContexts()) {
|
||||||
|
if (openedNoteContext.note && openedNoteContext.note.noteId === targetNoteId) {
|
||||||
|
this.activateNoteContext(openedNoteContext.ntxId, true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const noteContext = await this.openEmptyTab(ntxId, hoistedNoteId, mainNtxId);
|
const noteContext = await this.openEmptyTab(ntxId, hoistedNoteId, mainNtxId);
|
||||||
|
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
|
@ -366,7 +366,18 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
this.tree.reactivate(true);
|
this.tree.reactivate(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
node.setActive();
|
const openNoteIn = options.get("openNoteIn")
|
||||||
|
if (openNoteIn === 'curtab') {
|
||||||
|
node.setActive();
|
||||||
|
} else {
|
||||||
|
const noteId = node.data.noteId;
|
||||||
|
const notePath = treeService.getNotePath(node);
|
||||||
|
if (noteId.startsWith('_')) {
|
||||||
|
node.setActive();
|
||||||
|
} else {
|
||||||
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -21,6 +21,7 @@ import BackupOptions from "./options/backup.js";
|
|||||||
import SyncOptions from "./options/sync.js";
|
import SyncOptions from "./options/sync.js";
|
||||||
import SearchEngineOptions from "./options/other/search_engine.js";
|
import SearchEngineOptions from "./options/other/search_engine.js";
|
||||||
import TrayOptions from "./options/other/tray.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 NoteErasureTimeoutOptions from "./options/other/note_erasure_timeout.js";
|
||||||
import NoteRevisionsSnapshotIntervalOptions from "./options/other/note_revisions_snapshot_interval.js";
|
import NoteRevisionsSnapshotIntervalOptions from "./options/other/note_revisions_snapshot_interval.js";
|
||||||
import NetworkConnectionsOptions from "./options/other/network_connections.js";
|
import NetworkConnectionsOptions from "./options/other/network_connections.js";
|
||||||
@ -82,7 +83,8 @@ const CONTENT_WIDGETS = {
|
|||||||
TrayOptions,
|
TrayOptions,
|
||||||
NoteErasureTimeoutOptions,
|
NoteErasureTimeoutOptions,
|
||||||
NoteRevisionsSnapshotIntervalOptions,
|
NoteRevisionsSnapshotIntervalOptions,
|
||||||
NetworkConnectionsOptions
|
NetworkConnectionsOptions,
|
||||||
|
OpenNoteInOptions
|
||||||
],
|
],
|
||||||
_optionsAdvanced: [
|
_optionsAdvanced: [
|
||||||
DatabaseIntegrityCheckOptions,
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -65,6 +65,7 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'disableTray',
|
'disableTray',
|
||||||
'customSearchEngineName',
|
'customSearchEngineName',
|
||||||
'customSearchEngineUrl',
|
'customSearchEngineUrl',
|
||||||
|
'openNoteIn',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function getOptions() {
|
function getOptions() {
|
||||||
|
@ -92,6 +92,7 @@ const defaultOptions = [
|
|||||||
{ name: 'disableTray', value: 'false', isSynced: false },
|
{ name: 'disableTray', value: 'false', isSynced: false },
|
||||||
{ name: 'customSearchEngineName', value: 'Duckduckgo', isSynced: false },
|
{ name: 'customSearchEngineName', value: 'Duckduckgo', isSynced: false },
|
||||||
{ name: 'customSearchEngineUrl', value: 'https://duckduckgo.com/?q={keyword}', isSynced: false },
|
{ name: 'customSearchEngineUrl', value: 'https://duckduckgo.com/?q={keyword}', isSynced: false },
|
||||||
|
{ name: 'openNoteIn', value: 'curtab', isSynced: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
function initStartupOptions() {
|
function initStartupOptions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user