mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
reimplement note source to open in a new tab
This commit is contained in:
parent
c190296bf9
commit
b1e2b5ba8e
@ -37,7 +37,9 @@ class NoteContext extends Component {
|
|||||||
return !this.noteId;
|
return !this.noteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
async setNote(inputNotePath, triggerSwitchEvent = true) {
|
async setNote(inputNotePath, opts = {}) {
|
||||||
|
opts.triggerSwitchEvent = opts.triggerSwitchEvent !== undefined ? opts.triggerSwitchEvent : true;
|
||||||
|
|
||||||
const resolvedNotePath = await this.getResolvedNotePath(inputNotePath);
|
const resolvedNotePath = await this.getResolvedNotePath(inputNotePath);
|
||||||
|
|
||||||
if (!resolvedNotePath) {
|
if (!resolvedNotePath) {
|
||||||
@ -52,12 +54,13 @@ class NoteContext extends Component {
|
|||||||
({noteId: this.noteId, parentNoteId: this.parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(resolvedNotePath));
|
({noteId: this.noteId, parentNoteId: this.parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(resolvedNotePath));
|
||||||
|
|
||||||
this.resetViewScope();
|
this.resetViewScope();
|
||||||
|
this.viewScope.viewMode = opts.viewMode || "default";
|
||||||
|
|
||||||
this.saveToRecentNotes(resolvedNotePath);
|
this.saveToRecentNotes(resolvedNotePath);
|
||||||
|
|
||||||
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
||||||
|
|
||||||
if (triggerSwitchEvent) {
|
if (opts.triggerSwitchEvent) {
|
||||||
await this.triggerEvent('noteSwitched', {
|
await this.triggerEvent('noteSwitched', {
|
||||||
noteContext: this,
|
noteContext: this,
|
||||||
notePath: this.notePath
|
notePath: this.notePath
|
||||||
@ -183,7 +186,8 @@ class NoteContext extends Component {
|
|||||||
mainNtxId: this.mainNtxId,
|
mainNtxId: this.mainNtxId,
|
||||||
notePath: this.notePath,
|
notePath: this.notePath,
|
||||||
hoistedNoteId: this.hoistedNoteId,
|
hoistedNoteId: this.hoistedNoteId,
|
||||||
active: this.isActive()
|
active: this.isActive(),
|
||||||
|
viewMode: this.viewScope.viewMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,8 +228,8 @@ class NoteContext extends Component {
|
|||||||
|
|
||||||
const noteComplement = await this.getNoteComplement();
|
const noteComplement = await this.getNoteComplement();
|
||||||
|
|
||||||
const sizeLimit = this.note.type === 'text' ?
|
const sizeLimit = this.note.type === 'text'
|
||||||
options.getInt('autoReadonlySizeText')
|
? options.getInt('autoReadonlySizeText')
|
||||||
: options.getInt('autoReadonlySizeCode');
|
: options.getInt('autoReadonlySizeCode');
|
||||||
|
|
||||||
return noteComplement.content
|
return noteComplement.content
|
||||||
@ -251,6 +255,7 @@ class NoteContext extends Component {
|
|||||||
|
|
||||||
hasNoteList() {
|
hasNoteList() {
|
||||||
return this.note
|
return this.note
|
||||||
|
&& this.viewScope.viewMode === 'default'
|
||||||
&& this.note.hasChildren()
|
&& this.note.hasChildren()
|
||||||
&& ['book', 'text', 'code'].includes(this.note.type)
|
&& ['book', 'text', 'code'].includes(this.note.type)
|
||||||
&& this.note.mime !== 'text/x-sqlite;schema=trilium'
|
&& this.note.mime !== 'text/x-sqlite;schema=trilium'
|
||||||
|
@ -18,7 +18,7 @@ export default class RootCommandExecutor extends Component {
|
|||||||
async showSQLConsoleCommand() {
|
async showSQLConsoleCommand() {
|
||||||
const sqlConsoleNote = await dateNoteService.createSqlConsole();
|
const sqlConsoleNote = await dateNoteService.createSqlConsole();
|
||||||
|
|
||||||
const noteContext = await appContext.tabManager.openContextWithNote(sqlConsoleNote.noteId, true);
|
const noteContext = await appContext.tabManager.openContextWithNote(sqlConsoleNote.noteId, { activate: true });
|
||||||
|
|
||||||
appContext.triggerEvent('focusOnDetail', {ntxId: noteContext.ntxId});
|
appContext.triggerEvent('focusOnDetail', {ntxId: noteContext.ntxId});
|
||||||
}
|
}
|
||||||
@ -32,7 +32,10 @@ export default class RootCommandExecutor extends Component {
|
|||||||
const activeNoteContext = appContext.tabManager.getActiveContext();
|
const activeNoteContext = appContext.tabManager.getActiveContext();
|
||||||
const hoistedNoteId = activeNoteContext?.hoistedNoteId || 'root';
|
const hoistedNoteId = activeNoteContext?.hoistedNoteId || 'root';
|
||||||
|
|
||||||
const noteContext = await appContext.tabManager.openContextWithNote(searchNote.noteId, true, null, hoistedNoteId);
|
const noteContext = await appContext.tabManager.openContextWithNote(searchNote.noteId, {
|
||||||
|
activate: true,
|
||||||
|
hoistedNoteId
|
||||||
|
});
|
||||||
|
|
||||||
appContext.triggerCommand('focusOnSearchDefinition', {ntxId: noteContext.ntxId});
|
appContext.triggerCommand('focusOnSearchDefinition', {ntxId: noteContext.ntxId});
|
||||||
}
|
}
|
||||||
@ -73,7 +76,7 @@ export default class RootCommandExecutor extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async showBackendLogCommand() {
|
async showBackendLogCommand() {
|
||||||
await appContext.tabManager.openContextWithNote('_backendLog', true);
|
await appContext.tabManager.openContextWithNote('_backendLog', { activate: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
async showLaunchBarSubtreeCommand() {
|
async showLaunchBarSubtreeCommand() {
|
||||||
@ -89,11 +92,10 @@ export default class RootCommandExecutor extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async showOptionsCommand({section}) {
|
async showOptionsCommand({section}) {
|
||||||
await appContext.tabManager.openContextWithNote(
|
await appContext.tabManager.openContextWithNote(section || '_options', {
|
||||||
section || '_options',
|
activate: true,
|
||||||
true,
|
hoistedNoteId: '_options'
|
||||||
null,
|
});
|
||||||
'_options');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async showSQLConsoleHistoryCommand() {
|
async showSQLConsoleHistoryCommand() {
|
||||||
@ -109,6 +111,17 @@ export default class RootCommandExecutor extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async showAndHoistSubtree(subtreeNoteId) {
|
async showAndHoistSubtree(subtreeNoteId) {
|
||||||
await appContext.tabManager.openContextWithNote(subtreeNoteId, true, null, subtreeNoteId);
|
await appContext.tabManager.openContextWithNote(subtreeNoteId, {
|
||||||
|
activate: true,
|
||||||
|
hoistedNoteId: subtreeNoteId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async showNoteSourceEvent() {
|
||||||
|
const notePath = appContext.tabManager.getActiveContextNotePath();
|
||||||
|
|
||||||
|
if (notePath) {
|
||||||
|
await appContext.tabManager.openContextWithNote(notePath, { activate: true, viewMode: 'source' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,13 @@ export default class TabManager extends Component {
|
|||||||
|
|
||||||
await this.tabsUpdate.allowUpdateWithoutChange(async () => {
|
await this.tabsUpdate.allowUpdateWithoutChange(async () => {
|
||||||
for (const tab of filteredTabs) {
|
for (const tab of filteredTabs) {
|
||||||
await this.openContextWithNote(tab.notePath, tab.active, tab.ntxId, tab.hoistedNoteId, tab.mainNtxId);
|
await this.openContextWithNote(tab.notePath, {
|
||||||
|
activate: tab.active,
|
||||||
|
ntxId: tab.ntxId,
|
||||||
|
mainNtxId: tab.mainNtxId,
|
||||||
|
hoistedNoteId: tab.hoistedNoteId,
|
||||||
|
viewMode: tab.viewMode
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -277,14 +283,24 @@ export default class TabManager extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.openContextWithNote(notePath, activate, null, hoistedNoteId);
|
return this.openContextWithNote(notePath, { activate, hoistedNoteId });
|
||||||
}
|
}
|
||||||
|
|
||||||
async openContextWithNote(notePath, activate, ntxId = null, hoistedNoteId = 'root', mainNtxId = null) {
|
async openContextWithNote(notePath, opts = {}) {
|
||||||
|
const activate = !!opts.activate;
|
||||||
|
const ntxId = opts.ntxId || null;
|
||||||
|
const mainNtxId = opts.mainNtxId || null;
|
||||||
|
const hoistedNoteId = opts.hoistedNoteId || 'root';
|
||||||
|
const viewMode = opts.viewMode || "default";
|
||||||
|
|
||||||
const noteContext = await this.openEmptyTab(ntxId, hoistedNoteId, mainNtxId);
|
const noteContext = await this.openEmptyTab(ntxId, hoistedNoteId, mainNtxId);
|
||||||
|
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
await noteContext.setNote(notePath, !activate); // if activate is false then send normal noteSwitched event
|
await noteContext.setNote(notePath, {
|
||||||
|
// if activate is false then send normal noteSwitched event
|
||||||
|
triggerSwitchEvent: !activate,
|
||||||
|
viewMode: viewMode
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
@ -310,7 +326,7 @@ export default class TabManager extends Component {
|
|||||||
|
|
||||||
// if no tab with this note has been found we'll create new tab
|
// if no tab with this note has been found we'll create new tab
|
||||||
|
|
||||||
await this.openContextWithNote(noteId, true);
|
await this.openContextWithNote(noteId, { activate: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
async activateNoteContext(ntxId, triggerEvent = true) {
|
async activateNoteContext(ntxId, triggerEvent = true) {
|
||||||
|
@ -46,7 +46,6 @@ import FindWidget from "../widgets/find.js";
|
|||||||
import TocWidget from "../widgets/toc.js";
|
import TocWidget from "../widgets/toc.js";
|
||||||
import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js";
|
import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js";
|
||||||
import AboutDialog from "../widgets/dialogs/about.js";
|
import AboutDialog from "../widgets/dialogs/about.js";
|
||||||
import NoteSourceDialog from "../widgets/dialogs/note_source.js";
|
|
||||||
import HelpDialog from "../widgets/dialogs/help.js";
|
import HelpDialog from "../widgets/dialogs/help.js";
|
||||||
import RecentChangesDialog from "../widgets/dialogs/recent_changes.js";
|
import RecentChangesDialog from "../widgets/dialogs/recent_changes.js";
|
||||||
import BackendLogDialog from "../widgets/dialogs/backend_log.js";
|
import BackendLogDialog from "../widgets/dialogs/backend_log.js";
|
||||||
@ -186,7 +185,6 @@ export default class DesktopLayout {
|
|||||||
)
|
)
|
||||||
.child(new BulkActionsDialog())
|
.child(new BulkActionsDialog())
|
||||||
.child(new AboutDialog())
|
.child(new AboutDialog())
|
||||||
.child(new NoteSourceDialog())
|
|
||||||
.child(new HelpDialog())
|
.child(new HelpDialog())
|
||||||
.child(new RecentChangesDialog())
|
.child(new RecentChangesDialog())
|
||||||
.child(new BackendLogDialog())
|
.child(new BackendLogDialog())
|
||||||
|
@ -16,7 +16,7 @@ function openContextMenu(notePath, hoistedNoteId, e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (command === 'openNoteInNewTab') {
|
if (command === 'openNoteInNewTab') {
|
||||||
appContext.tabManager.openContextWithNote(notePath, false, null, hoistedNoteId);
|
appContext.tabManager.openContextWithNote(notePath, { hoistedNoteId });
|
||||||
}
|
}
|
||||||
else if (command === 'openNoteInNewSplit') {
|
else if (command === 'openNoteInNewSplit') {
|
||||||
const subContexts = appContext.tabManager.getActiveContext().getSubContexts();
|
const subContexts = appContext.tabManager.getActiveContext().getSubContexts();
|
||||||
|
@ -103,7 +103,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
|||||||
this.openTabWithNote = async (notePath, activate) => {
|
this.openTabWithNote = async (notePath, activate) => {
|
||||||
await ws.waitForMaxKnownEntityChangeId();
|
await ws.waitForMaxKnownEntityChangeId();
|
||||||
|
|
||||||
await appContext.tabManager.openContextWithNote(notePath, activate);
|
await appContext.tabManager.openContextWithNote(notePath, { activate });
|
||||||
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
appContext.triggerEvent('focusAndSelectTitle');
|
appContext.triggerEvent('focusAndSelectTitle');
|
||||||
|
@ -42,7 +42,7 @@ async function checkNoteAccess(notePath, noteContext) {
|
|||||||
const resolvedNotePath = await treeService.resolveNotePath(notePath, noteContext.hoistedNoteId);
|
const resolvedNotePath = await treeService.resolveNotePath(notePath, noteContext.hoistedNoteId);
|
||||||
|
|
||||||
if (!resolvedNotePath) {
|
if (!resolvedNotePath) {
|
||||||
console.log(`Cannot activate ${notePath}`);
|
console.log(`Cannot activate '${notePath}'`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ const TPL = `
|
|||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a data-trigger-command="renderActiveNote" class="dropdown-item render-note-button"><kbd data-command="renderActiveNote"></kbd> Re-render note</a>
|
<a data-trigger-command="renderActiveNote" class="dropdown-item render-note-button"><kbd data-command="renderActiveNote"></kbd> Re-render note</a>
|
||||||
<a data-trigger-command="findInText" class="dropdown-item find-in-text-button">Search in note <kbd data-command="findInText"></a>
|
<a data-trigger-command="findInText" class="dropdown-item find-in-text-button">Search in note <kbd data-command="findInText"></a>
|
||||||
<a data-trigger-command="openNoteSourceDialog" class="dropdown-item show-source-button"><kbd data-command="showNoteSource"></kbd> Note source</a>
|
<a data-trigger-command="showNoteSource" class="dropdown-item show-source-button"><kbd data-command="showNoteSource"></kbd> Note source</a>
|
||||||
<a data-trigger-command="openNoteExternally" class="dropdown-item open-note-externally-button"><kbd data-command="openNoteExternally"></kbd> Open note externally</a>
|
<a data-trigger-command="openNoteExternally" class="dropdown-item open-note-externally-button"><kbd data-command="openNoteExternally"></kbd> Open note externally</a>
|
||||||
<a class="dropdown-item import-files-button">Import files</a>
|
<a class="dropdown-item import-files-button">Import files</a>
|
||||||
<a class="dropdown-item export-note-button">Export note</a>
|
<a class="dropdown-item export-note-button">Export note</a>
|
||||||
@ -81,7 +81,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
|
|||||||
refreshWithNote(note) {
|
refreshWithNote(note) {
|
||||||
this.toggleDisabled(this.$findInTextButton, ['text', 'code', 'book', 'search'].includes(note.type));
|
this.toggleDisabled(this.$findInTextButton, ['text', 'code', 'book', 'search'].includes(note.type));
|
||||||
|
|
||||||
this.toggleDisabled(this.$showSourceButton, ['text', 'relationMap', 'search', 'code'].includes(note.type));
|
this.toggleDisabled(this.$showSourceButton, ['text', 'relationMap', 'mermaid'].includes(note.type));
|
||||||
|
|
||||||
this.toggleDisabled(this.$printActiveNoteButton, ['text', 'code'].includes(note.type));
|
this.toggleDisabled(this.$printActiveNoteButton, ['text', 'code'].includes(note.type));
|
||||||
|
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
import appContext from "../../components/app_context.js";
|
|
||||||
import BasicWidget from "../basic_widget.js";
|
|
||||||
import utils from "../../services/utils.js";
|
|
||||||
|
|
||||||
const TPL = `
|
|
||||||
<div class="note-source-dialog modal fade mx-auto" tabindex="-1" role="dialog">
|
|
||||||
<style>
|
|
||||||
.note-source-dialog .note-source {
|
|
||||||
height: 98%;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 500px;
|
|
||||||
overflow: scroll;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title">Note source</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<textarea readonly="readonly" class="note-source"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
export default class NoteSourceDialog extends BasicWidget {
|
|
||||||
doRender() {
|
|
||||||
this.$widget = $(TPL);
|
|
||||||
this.$noteSource = this.$widget.find(".note-source");
|
|
||||||
}
|
|
||||||
|
|
||||||
async refresh() {
|
|
||||||
const noteCompletement = await appContext.tabManager.getActiveContext().getNoteComplement();
|
|
||||||
|
|
||||||
this.$noteSource.text(this.formatHtml(noteCompletement.content));
|
|
||||||
}
|
|
||||||
|
|
||||||
formatHtml(str) {
|
|
||||||
const div = document.createElement('div');
|
|
||||||
div.innerHTML = str.trim();
|
|
||||||
|
|
||||||
return this.formatNode(div, 0).innerHTML.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
formatNode(node, level) {
|
|
||||||
const indentBefore = new Array(level++ + 1).join(' ');
|
|
||||||
const indentAfter = new Array(level - 1).join(' ');
|
|
||||||
let textNode;
|
|
||||||
|
|
||||||
for (let i = 0; i < node.children.length; i++) {
|
|
||||||
textNode = document.createTextNode(`
|
|
||||||
${indentBefore}`);
|
|
||||||
node.insertBefore(textNode, node.children[i]);
|
|
||||||
|
|
||||||
this.formatNode(node.children[i], level);
|
|
||||||
|
|
||||||
if (node.lastElementChild === node.children[i]) {
|
|
||||||
textNode = document.createTextNode(`
|
|
||||||
${indentAfter}`);
|
|
||||||
node.appendChild(textNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
async openNoteSourceDialogEvent() {
|
|
||||||
await this.refresh();
|
|
||||||
|
|
||||||
utils.openDialog(this.$widget);
|
|
||||||
}
|
|
||||||
}
|
|
@ -187,23 +187,17 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
let type = note.type;
|
let type = note.type;
|
||||||
|
|
||||||
if (type === 'text' && await this.noteContext.isReadOnly()) {
|
if (type === 'text' && this.noteContext.viewScope.viewMode === 'source') {
|
||||||
type = 'readOnlyText';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((type === 'code' || type === 'mermaid') && await this.noteContext.isReadOnly()) {
|
|
||||||
type = 'readOnlyCode';
|
type = 'readOnlyCode';
|
||||||
}
|
} else if (type === 'text' && await this.noteContext.isReadOnly()) {
|
||||||
|
type = 'readOnlyText';
|
||||||
if (type === 'text') {
|
} else if ((type === 'code' || type === 'mermaid') && await this.noteContext.isReadOnly()) {
|
||||||
|
type = 'readOnlyCode';
|
||||||
|
} else if (type === 'text') {
|
||||||
type = 'editableText';
|
type = 'editableText';
|
||||||
}
|
} else if (type === 'code' || type === 'mermaid') {
|
||||||
|
|
||||||
if (type === 'code' || type === 'mermaid') {
|
|
||||||
type = 'editableCode';
|
type = 'editableCode';
|
||||||
}
|
} else if (type === 'launcher') {
|
||||||
|
|
||||||
if (type === 'launcher') {
|
|
||||||
type = 'doc';
|
type = 'doc';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,12 +617,13 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
updateTabById(ntxId) {
|
updateTabById(ntxId) {
|
||||||
const $tab = this.getTabById(ntxId);
|
const $tab = this.getTabById(ntxId);
|
||||||
|
|
||||||
const {note} = appContext.tabManager.getNoteContextById(ntxId);
|
const noteContext = appContext.tabManager.getNoteContextById(ntxId);
|
||||||
|
|
||||||
this.updateTab($tab, note);
|
this.updateTab($tab, noteContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTab($tab, note) {
|
/** @param {NoteContext} noteContext */
|
||||||
|
updateTab($tab, noteContext) {
|
||||||
if (!$tab.length) {
|
if (!$tab.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -633,8 +634,6 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const noteContext = appContext.tabManager.getNoteContextById(this.getTabId($tab));
|
|
||||||
|
|
||||||
if (noteContext) {
|
if (noteContext) {
|
||||||
const hoistedNote = froca.getNoteFromCache(noteContext.hoistedNoteId);
|
const hoistedNote = froca.getNoteFromCache(noteContext.hoistedNoteId);
|
||||||
|
|
||||||
@ -651,12 +650,19 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {note} = noteContext;
|
||||||
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
this.updateTitle($tab, 'New tab');
|
this.updateTitle($tab, 'New tab');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateTitle($tab, note.title);
|
const viewMode = noteContext.viewScope?.viewMode;
|
||||||
|
const title = (viewMode && viewMode !== 'default')
|
||||||
|
? `${viewMode}: ${note.title}`
|
||||||
|
: note.title;
|
||||||
|
|
||||||
|
this.updateTitle($tab, title);
|
||||||
|
|
||||||
$tab.addClass(note.getCssClass());
|
$tab.addClass(note.getCssClass());
|
||||||
$tab.addClass(utils.getNoteTypeClass(note.type));
|
$tab.addClass(utils.getNoteTypeClass(note.type));
|
||||||
@ -676,7 +682,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
) {
|
) {
|
||||||
const $tab = this.getTabById(noteContext.ntxId);
|
const $tab = this.getTabById(noteContext.ntxId);
|
||||||
|
|
||||||
this.updateTab($tab, noteContext.note);
|
this.updateTab($tab, noteContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -685,7 +691,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
for (const noteContext of appContext.tabManager.noteContexts) {
|
for (const noteContext of appContext.tabManager.noteContexts) {
|
||||||
const $tab = this.getTabById(noteContext.ntxId);
|
const $tab = this.getTabById(noteContext.ntxId);
|
||||||
|
|
||||||
this.updateTab($tab, noteContext.note);
|
this.updateTab($tab, noteContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +701,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
if ($tab) {
|
if ($tab) {
|
||||||
const noteContext = appContext.tabManager.getNoteContextById(ntxId);
|
const noteContext = appContext.tabManager.getNoteContextById(ntxId);
|
||||||
|
|
||||||
this.updateTab($tab, noteContext.note);
|
this.updateTab($tab, noteContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user