mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 08:15:52 +01:00
fixes, cleaned up noise in the developer console
This commit is contained in:
@@ -32,6 +32,8 @@ import options from "./services/options.js";
|
||||
import noteContentRenderer from "./services/note_content_renderer.js";
|
||||
import appContext from "./services/app_context.js";
|
||||
|
||||
window.glob.PROFILING_LOG = false;
|
||||
|
||||
window.glob.isDesktop = utils.isDesktop;
|
||||
window.glob.isMobile = utils.isMobile;
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ export default class LinkMap {
|
||||
.addClass('link-' + edge.target.id);
|
||||
}
|
||||
else {
|
||||
console.log(`connection not created for`, edge);
|
||||
console.debug(`connection not created for`, edge);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -78,7 +78,9 @@ async function call(method, url, data, headers = {}) {
|
||||
|
||||
const end = Date.now();
|
||||
|
||||
console.log(`${method} ${url} took ${end-start}ms`);
|
||||
if (glob.PROFILING_LOG) {
|
||||
console.log(`${method} ${url} took ${end - start}ms`);
|
||||
}
|
||||
|
||||
const maxSyncIdStr = resp.headers['trilium-max-sync-id'];
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class TabContext extends Component {
|
||||
}
|
||||
|
||||
isActive() {
|
||||
return this.appContext.activeTabId === this.tabId;
|
||||
return this.tabManager.activeTabId === this.tabId;
|
||||
}
|
||||
|
||||
getTabState() {
|
||||
@@ -99,7 +99,7 @@ class TabContext extends Component {
|
||||
return {
|
||||
tabId: this.tabId,
|
||||
notePath: this.notePath,
|
||||
active: this.appContext.activeTabId === this.tabId
|
||||
active: this.tabManager.activeTabId === this.tabId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,18 @@ export default class CalendarWidget extends CollapsibleWidget {
|
||||
&& this.note.hasOwnedLabel("dateNote");
|
||||
}
|
||||
|
||||
setTabContextListener({tabContext}) {
|
||||
super.setTabContextListener({tabContext});
|
||||
|
||||
console.log("set tab context", tabContext.tabId, "to", this.componentId);
|
||||
}
|
||||
|
||||
async refresh() {
|
||||
super.refresh();
|
||||
|
||||
//console.trace("tab", this.tabContext.tabId);
|
||||
}
|
||||
|
||||
async doRenderBody() {
|
||||
await libraryLoader.requireLibrary(libraryLoader.CALENDAR_WIDGET);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export default class Component {
|
||||
|
||||
const end = Date.now();
|
||||
|
||||
if (end - start > 10) {
|
||||
if (end - start > 10 && glob.PROFILING_LOG) {
|
||||
console.log(`Event ${name} in component ${this.componentId} took ${end-start}ms`);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export default class TabAwareWidget extends BasicWidget {
|
||||
}
|
||||
|
||||
async isEnabled() {
|
||||
return !!this.note;
|
||||
return !!this.note && this.tabContext.isActive();
|
||||
}
|
||||
|
||||
async refresh() {
|
||||
@@ -56,7 +56,7 @@ export default class TabAwareWidget extends BasicWidget {
|
||||
|
||||
const end = Date.now();
|
||||
|
||||
if (end - start > 10) {
|
||||
if (glob.PROFILING_LOG && end - start > 10) {
|
||||
console.log(`Refresh of ${this.componentId} took ${end-start}ms`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,12 +409,6 @@ export default class TabRowWidget extends BasicWidget {
|
||||
});
|
||||
}
|
||||
|
||||
get activeTabId() {
|
||||
const tabEl = this.activeTabEl;
|
||||
|
||||
return tabEl ? tabEl.getAttribute('data-tab-id') : null;
|
||||
}
|
||||
|
||||
get activeTabEl() {
|
||||
return this.$widget.find('.note-tab[active]')[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user