mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-23 18:44:20 +03:00
performance improv
This commit is contained in:
parent
b355fff0f8
commit
1068450ddd
@ -1,4 +1,5 @@
|
|||||||
const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer')
|
const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer')
|
||||||
|
import * as isDev from 'electron-is-dev'
|
||||||
|
|
||||||
|
|
||||||
const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876'
|
const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876'
|
||||||
@ -9,6 +10,7 @@ try {
|
|||||||
release = require('electron').remote.app.getVersion()
|
release = require('electron').remote.app.getVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isDev) {
|
||||||
init({
|
init({
|
||||||
dsn: SENTRY_DSN,
|
dsn: SENTRY_DSN,
|
||||||
release,
|
release,
|
||||||
@ -16,3 +18,4 @@ init({
|
|||||||
return integrations.filter(integration => integration.name !== 'Breadcrumbs')
|
return integrations.filter(integration => integration.name !== 'Breadcrumbs')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
@ -7,7 +7,8 @@ import * as isDev from 'electron-is-dev'
|
|||||||
import './global.scss'
|
import './global.scss'
|
||||||
import './toastr.scss'
|
import './toastr.scss'
|
||||||
|
|
||||||
import { enableProdMode, NgModuleRef } from '@angular/core'
|
import { enableProdMode, NgModuleRef, ApplicationRef } from '@angular/core'
|
||||||
|
import { enableDebugTools } from '@angular/platform-browser'
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
||||||
|
|
||||||
import { getRootModule } from './app.module'
|
import { getRootModule } from './app.module'
|
||||||
@ -37,7 +38,14 @@ async function bootstrap (plugins: PluginInfo[], safeMode = false): Promise<NgMo
|
|||||||
})
|
})
|
||||||
const module = getRootModule(pluginsModules)
|
const module = getRootModule(pluginsModules)
|
||||||
window['rootModule'] = module
|
window['rootModule'] = module
|
||||||
return platformBrowserDynamic().bootstrapModule(module)
|
return platformBrowserDynamic().bootstrapModule(module).then(moduleRef => {
|
||||||
|
if (isDev) {
|
||||||
|
const applicationRef = moduleRef.injector.get(ApplicationRef)
|
||||||
|
const componentRef = applicationRef.components[0]
|
||||||
|
enableDebugTools(componentRef)
|
||||||
|
}
|
||||||
|
return moduleRef
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
findPlugins().then(async plugins => {
|
findPlugins().then(async plugins => {
|
||||||
|
@ -38,7 +38,7 @@ title-bar(
|
|||||||
button.btn.btn-secondary.btn-tab-bar(
|
button.btn.btn-secondary.btn-tab-bar(
|
||||||
[title]='button.title',
|
[title]='button.title',
|
||||||
(click)='button.click && button.click()',
|
(click)='button.click && button.click()',
|
||||||
[innerHTML]='sanitizeIcon(button.icon)',
|
[fastHtmlBind]='button.icon',
|
||||||
ngbDropdownToggle,
|
ngbDropdownToggle,
|
||||||
)
|
)
|
||||||
div(*ngIf='button.submenu', ngbDropdownMenu)
|
div(*ngIf='button.submenu', ngbDropdownMenu)
|
||||||
@ -49,7 +49,7 @@ title-bar(
|
|||||||
)
|
)
|
||||||
.icon-wrapper(
|
.icon-wrapper(
|
||||||
*ngIf='hasIcons(button.submenuItems)',
|
*ngIf='hasIcons(button.submenuItems)',
|
||||||
[innerHTML]='sanitizeIcon(item.icon)'
|
[fastHtmlBind]='item.icon'
|
||||||
)
|
)
|
||||||
div([class.ml-3]='hasIcons(button.submenuItems)') {{item.title}}
|
div([class.ml-3]='hasIcons(button.submenuItems)') {{item.title}}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ title-bar(
|
|||||||
button.btn.btn-secondary.btn-tab-bar(
|
button.btn.btn-secondary.btn-tab-bar(
|
||||||
[title]='button.title',
|
[title]='button.title',
|
||||||
(click)='button.click && button.click()',
|
(click)='button.click && button.click()',
|
||||||
[innerHTML]='sanitizeIcon(button.icon)',
|
[fastHtmlBind]='button.icon',
|
||||||
ngbDropdownToggle,
|
ngbDropdownToggle,
|
||||||
)
|
)
|
||||||
div(*ngIf='button.submenu', ngbDropdownMenu)
|
div(*ngIf='button.submenu', ngbDropdownMenu)
|
||||||
@ -75,7 +75,7 @@ title-bar(
|
|||||||
)
|
)
|
||||||
.icon-wrapper(
|
.icon-wrapper(
|
||||||
*ngIf='hasIcons(button.submenuItems)',
|
*ngIf='hasIcons(button.submenuItems)',
|
||||||
[innerHTML]='sanitizeIcon(item.icon)'
|
[fastHtmlBind]='item.icon'
|
||||||
)
|
)
|
||||||
div([class.ml-3]='hasIcons(button.submenuItems)') {{item.title}}
|
div([class.ml-3]='hasIcons(button.submenuItems)') {{item.title}}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ title-bar(
|
|||||||
*ngIf='updatesAvailable',
|
*ngIf='updatesAvailable',
|
||||||
title='Update available - Click to install',
|
title='Update available - Click to install',
|
||||||
(click)='updateApp()',
|
(click)='updateApp()',
|
||||||
[innerHTML]='sanitizeIcon(updateIcon)'
|
[fastHtmlBind]='updateIcon'
|
||||||
)
|
)
|
||||||
|
|
||||||
window-controls.background(
|
window-controls.background(
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Component, Inject, Input, HostListener, HostBinding } from '@angular/core'
|
import { Component, Inject, Input, HostListener, HostBinding } from '@angular/core'
|
||||||
import { trigger, style, animate, transition, state } from '@angular/animations'
|
import { trigger, style, animate, transition, state } from '@angular/animations'
|
||||||
import { DomSanitizer } from '@angular/platform-browser'
|
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
|
|
||||||
import { ElectronService } from '../services/electron.service'
|
import { ElectronService } from '../services/electron.service'
|
||||||
@ -75,7 +74,6 @@ export class AppRootComponent {
|
|||||||
public hostApp: HostAppService,
|
public hostApp: HostAppService,
|
||||||
public config: ConfigService,
|
public config: ConfigService,
|
||||||
public app: AppService,
|
public app: AppService,
|
||||||
private domSanitizer: DomSanitizer,
|
|
||||||
@Inject(ToolbarButtonProvider) private toolbarButtonProviders: ToolbarButtonProvider[],
|
@Inject(ToolbarButtonProvider) private toolbarButtonProviders: ToolbarButtonProvider[],
|
||||||
log: LogService,
|
log: LogService,
|
||||||
ngbModal: NgbModal,
|
ngbModal: NgbModal,
|
||||||
@ -254,10 +252,6 @@ export class AppRootComponent {
|
|||||||
return submenuItems.some(x => !!x.icon)
|
return submenuItems.some(x => !!x.icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
sanitizeIcon (icon: string): any {
|
|
||||||
return this.domSanitizer.bypassSecurityTrustHtml(icon || '')
|
|
||||||
}
|
|
||||||
|
|
||||||
private getToolbarButtons (aboveZero: boolean): ToolbarButton[] {
|
private getToolbarButtons (aboveZero: boolean): ToolbarButton[] {
|
||||||
let buttons: ToolbarButton[] = []
|
let buttons: ToolbarButton[] = []
|
||||||
this.config.enabledServices(this.toolbarButtonProviders).forEach(provider => {
|
this.config.enabledServices(this.toolbarButtonProviders).forEach(provider => {
|
||||||
|
14
terminus-core/src/directives/fastHtmlBind.directive.ts
Normal file
14
terminus-core/src/directives/fastHtmlBind.directive.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { Directive, Input, ElementRef, OnChanges } from '@angular/core'
|
||||||
|
|
||||||
|
/** @hidden */
|
||||||
|
@Directive({
|
||||||
|
selector: '[fastHtmlBind]',
|
||||||
|
})
|
||||||
|
export class FastHtmlBindDirective implements OnChanges {
|
||||||
|
@Input() fastHtmlBind: string
|
||||||
|
constructor (private el: ElementRef) { }
|
||||||
|
|
||||||
|
ngOnChanges () {
|
||||||
|
this.el.nativeElement.innerHTML = this.fastHtmlBind
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@ import { SplitTabSpannerComponent } from './components/splitTabSpanner.component
|
|||||||
import { WelcomeTabComponent } from './components/welcomeTab.component'
|
import { WelcomeTabComponent } from './components/welcomeTab.component'
|
||||||
|
|
||||||
import { AutofocusDirective } from './directives/autofocus.directive'
|
import { AutofocusDirective } from './directives/autofocus.directive'
|
||||||
|
import { FastHtmlBindDirective } from './directives/fastHtmlBind.directive'
|
||||||
|
|
||||||
import { HotkeyProvider } from './api/hotkeyProvider'
|
import { HotkeyProvider } from './api/hotkeyProvider'
|
||||||
import { ConfigProvider } from './api/configProvider'
|
import { ConfigProvider } from './api/configProvider'
|
||||||
@ -80,6 +81,7 @@ const PROVIDERS = [
|
|||||||
RenameTabModalComponent,
|
RenameTabModalComponent,
|
||||||
SafeModeModalComponent,
|
SafeModeModalComponent,
|
||||||
AutofocusDirective,
|
AutofocusDirective,
|
||||||
|
FastHtmlBindDirective,
|
||||||
SplitTabComponent,
|
SplitTabComponent,
|
||||||
SplitTabSpannerComponent,
|
SplitTabSpannerComponent,
|
||||||
WelcomeTabComponent,
|
WelcomeTabComponent,
|
||||||
|
Loading…
Reference in New Issue
Block a user