mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-05-06 20:29:12 -05:00
refactoring of layout finished
This commit is contained in:
@@ -17,7 +17,6 @@ class AppContext extends Component {
|
||||
super(null);
|
||||
|
||||
this.layout = layout;
|
||||
this.tabManager = new TabManager(this);
|
||||
this.executors = [];
|
||||
}
|
||||
|
||||
@@ -45,16 +44,22 @@ class AppContext extends Component {
|
||||
this.triggerEvent(eventName);
|
||||
});
|
||||
|
||||
this.tabManager = new TabManager();
|
||||
|
||||
this.executors = [
|
||||
this.tabManager,
|
||||
new DialogCommandExecutor(this),
|
||||
new Entrypoints(this)
|
||||
new DialogCommandExecutor(),
|
||||
new Entrypoints()
|
||||
];
|
||||
|
||||
this.children = [ rootWidget, ...this.executors ];
|
||||
this.child(rootWidget);
|
||||
|
||||
for (const executor of this.executors) {
|
||||
this.child(executor);
|
||||
}
|
||||
|
||||
if (utils.isElectron()) {
|
||||
this.children.push(new ZoomService(this));
|
||||
this.child(new ZoomService());
|
||||
|
||||
import("./spell_check.js").then(spellCheckService => spellCheckService.initSpellCheck());
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import appContext from "./app_context.js";
|
||||
import Component from "../widgets/component.js";
|
||||
|
||||
export default class Entrypoints extends Component {
|
||||
constructor(parent) {
|
||||
super(parent);
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// hot keys are active also inside inputs and content editables
|
||||
jQuery.hotkeys.options.filterInputAcceptingElements = false;
|
||||
|
||||
@@ -9,15 +9,12 @@ import hoistedNoteService from "./hoisted_note.js";
|
||||
|
||||
class TabContext extends Component {
|
||||
/**
|
||||
* @param {Component} parent
|
||||
* @param {string|null} tabId
|
||||
*/
|
||||
constructor(parent, tabId = null) {
|
||||
super(parent);
|
||||
constructor(tabId = null) {
|
||||
super();
|
||||
|
||||
this.tabId = tabId || utils.randomString(4);
|
||||
|
||||
this.triggerEvent('newTabOpened', {tabId: this.tabId});
|
||||
}
|
||||
|
||||
async setNote(inputNotePath) {
|
||||
|
||||
@@ -6,11 +6,10 @@ import treeCache from "./tree_cache.js";
|
||||
import treeService from "./tree.js";
|
||||
import utils from "./utils.js";
|
||||
import TabContext from "./tab_context.js";
|
||||
import appContext from "./app_context.js";
|
||||
|
||||
export default class TabManager extends Component {
|
||||
constructor(parent) {
|
||||
super(parent);
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.activeTabId = null;
|
||||
|
||||
@@ -183,8 +182,11 @@ export default class TabManager extends Component {
|
||||
}
|
||||
|
||||
openEmptyTab(tabId) {
|
||||
const tabContext = new TabContext(appContext, tabId);
|
||||
this.children.push(tabContext);
|
||||
const tabContext = new TabContext(tabId);
|
||||
this.child(tabContext);
|
||||
|
||||
this.triggerEvent('newTabOpened', {tabId: this.tabId})
|
||||
|
||||
return tabContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ const MIN_ZOOM = 0.5;
|
||||
const MAX_ZOOM = 2.0;
|
||||
|
||||
export default class ZoomService extends Component {
|
||||
constructor(parent) {
|
||||
super(parent);
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.setZoomFactor(options.getFloat('zoomFactor'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user