mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 00:47:15 +00:00
barrel export + deep equals
This commit is contained in:
parent
72bc58332d
commit
9544791c6c
3 changed files with 8 additions and 10 deletions
|
@ -5,7 +5,7 @@ export { SplitTabComponent, SplitContainer, SplitDirection, SplitOrientation } f
|
|||
export { TabRecoveryProvider, RecoveryToken } from './tabRecovery'
|
||||
export { ToolbarButtonProvider, ToolbarButton } from './toolbarButtonProvider'
|
||||
export { ConfigProvider } from './configProvider'
|
||||
export { HotkeyProvider, HotkeyDescription } from './hotkeyProvider'
|
||||
export { HotkeyProvider, HotkeyDescription, Hotkey } from './hotkeyProvider'
|
||||
export { Theme } from './theme'
|
||||
export { TabContextMenuItemProvider } from './tabContextMenuProvider'
|
||||
export { SelectorOption } from './selector'
|
||||
|
|
|
@ -3,11 +3,12 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
|
|||
import { Component, NgZone } from '@angular/core'
|
||||
import {
|
||||
ConfigService,
|
||||
Hotkey,
|
||||
HotkeyDescription,
|
||||
HotkeysService,
|
||||
HostAppService,
|
||||
} from 'tabby-core'
|
||||
import { Hotkey } from 'tabby-core/src/api/hotkeyProvider'
|
||||
import deepEqual from 'deep-equal'
|
||||
|
||||
_('Search hotkeys')
|
||||
|
||||
|
@ -66,7 +67,7 @@ export class HotkeySettingsTabComponent {
|
|||
.flat()
|
||||
|
||||
const isDuplicate = allHotkeys
|
||||
.filter(hotkey => JSON.stringify(hotkey) === JSON.stringify(strokes))
|
||||
.filter(hotkey => deepEqual(hotkey, strokes))
|
||||
.length > 1
|
||||
|
||||
return { strokes, isDuplicate }
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core'
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { HotkeyInputModalComponent } from './hotkeyInputModal.component'
|
||||
import { Hotkey } from 'tabby-core/src/api/hotkeyProvider'
|
||||
import { Hotkey } from 'tabby-core'
|
||||
import deepEqual from 'deep-equal'
|
||||
|
||||
/** @hidden */
|
||||
@Component({
|
||||
|
@ -24,7 +25,7 @@ export class MultiHotkeyInputComponent {
|
|||
|
||||
editItem (item: Hotkey): void {
|
||||
this.ngbModal.open(HotkeyInputModalComponent).result.then((newStrokes: string[]) => {
|
||||
this.hotkeys.find(hotkey => this.isEqual(hotkey, item))!.strokes = newStrokes
|
||||
this.hotkeys.find(hotkey => deepEqual(hotkey.strokes, item.strokes))!.strokes = newStrokes
|
||||
this.storeUpdatedHotkeys()
|
||||
})
|
||||
}
|
||||
|
@ -44,8 +45,4 @@ export class MultiHotkeyInputComponent {
|
|||
private storeUpdatedHotkeys () {
|
||||
this.hotkeysChange.emit(this.hotkeys)
|
||||
}
|
||||
|
||||
private isEqual (h: Hotkey, item: Hotkey) {
|
||||
return JSON.stringify(h.strokes) === JSON.stringify(item.strokes)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue