Skip to content

Commit 9544791

Browse files
BenjaminBrandmeierEugeny
authored andcommitted
barrel export + deep equals
1 parent 72bc583 commit 9544791

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

tabby-core/src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export { SplitTabComponent, SplitContainer, SplitDirection, SplitOrientation } f
55
export { TabRecoveryProvider, RecoveryToken } from './tabRecovery'
66
export { ToolbarButtonProvider, ToolbarButton } from './toolbarButtonProvider'
77
export { ConfigProvider } from './configProvider'
8-
export { HotkeyProvider, HotkeyDescription } from './hotkeyProvider'
8+
export { HotkeyProvider, HotkeyDescription, Hotkey } from './hotkeyProvider'
99
export { Theme } from './theme'
1010
export { TabContextMenuItemProvider } from './tabContextMenuProvider'
1111
export { SelectorOption } from './selector'

tabby-settings/src/components/hotkeySettingsTab.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
33
import { Component, NgZone } from '@angular/core'
44
import {
55
ConfigService,
6+
Hotkey,
67
HotkeyDescription,
78
HotkeysService,
89
HostAppService,
910
} from 'tabby-core'
10-
import { Hotkey } from 'tabby-core/src/api/hotkeyProvider'
11+
import deepEqual from 'deep-equal'
1112

1213
_('Search hotkeys')
1314

@@ -66,7 +67,7 @@ export class HotkeySettingsTabComponent {
6667
.flat()
6768

6869
const isDuplicate = allHotkeys
69-
.filter(hotkey => JSON.stringify(hotkey) === JSON.stringify(strokes))
70+
.filter(hotkey => deepEqual(hotkey, strokes))
7071
.length > 1
7172

7273
return { strokes, isDuplicate }

tabby-settings/src/components/multiHotkeyInput.component.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core'
1+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'
22
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
33
import { HotkeyInputModalComponent } from './hotkeyInputModal.component'
4-
import { Hotkey } from 'tabby-core/src/api/hotkeyProvider'
4+
import { Hotkey } from 'tabby-core'
5+
import deepEqual from 'deep-equal'
56

67
/** @hidden */
78
@Component({
@@ -24,7 +25,7 @@ export class MultiHotkeyInputComponent {
2425

2526
editItem (item: Hotkey): void {
2627
this.ngbModal.open(HotkeyInputModalComponent).result.then((newStrokes: string[]) => {
27-
this.hotkeys.find(hotkey => this.isEqual(hotkey, item))!.strokes = newStrokes
28+
this.hotkeys.find(hotkey => deepEqual(hotkey.strokes, item.strokes))!.strokes = newStrokes
2829
this.storeUpdatedHotkeys()
2930
})
3031
}
@@ -44,8 +45,4 @@ export class MultiHotkeyInputComponent {
4445
private storeUpdatedHotkeys () {
4546
this.hotkeysChange.emit(this.hotkeys)
4647
}
47-
48-
private isEqual (h: Hotkey, item: Hotkey) {
49-
return JSON.stringify(h.strokes) === JSON.stringify(item.strokes)
50-
}
5148
}

0 commit comments

Comments
 (0)