Skip to content

Commit

Permalink
refactor: update typings
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx committed Oct 29, 2018
1 parent 172ba74 commit de42e3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/_helpers/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ export function getSelectionText (win = window): string {

// Firefox fix
const activeElement = win.document.activeElement
if (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA') {
const el = activeElement as HTMLInputElement | HTMLTextAreaElement
return el.value.slice(el.selectionStart || 0, el.selectionEnd || 0)
if (activeElement) {
if (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA') {
const el = activeElement as HTMLInputElement | HTMLTextAreaElement
return el.value.slice(el.selectionStart || 0, el.selectionEnd || 0)
}
}

return ''
Expand Down
2 changes: 1 addition & 1 deletion src/typings/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export interface MsgGetWords {
readonly area: DBArea
readonly itemsPerPage?: number
readonly pageNum?: number
readonly filters: { [field: string]: string[] | undefined }
readonly filters?: { [field: string]: string[] | undefined }
readonly sortField?: string
readonly sortOrder?: 'ascend' | 'descend' | false
readonly searchText?: string
Expand Down

0 comments on commit de42e3b

Please sign in to comment.