/* tslint:disable:max-line-length */ "use strict"; import React, { Component } from "react"; const _ = browser.i18n.getMessage; interface EditableListItemProps { text: string; itemPattern: RegExp; editing?: boolean; itemPatternError (err?: string): string; onRemove (item: string): void; onEdit (item: string, newValue: string): void; } interface EditableListItemState { editing: boolean; editValue: string; } export default class EditableListItem extends Component< EditableListItemProps, EditableListItemState> { private input: (HTMLInputElement | null) = null; constructor (props: EditableListItemProps) { super(props); this.state = { editing: this.props.editing || false , editValue: "" }; this.handleRemove = this.handleRemove.bind(this); this.handleEditBegin = this.handleEditBegin.bind(this); this.handleEditEnd = this.handleEditEnd.bind(this); this.handleInputChange = this.handleInputChange.bind(this); this.handleInputKeyPress = this.handleInputKeyPress.bind(this); } public render () { const selected = this.state.editing ? "editable-list__item--selected" : ""; return (