* Expands selection to cover whole sign * Prevents partial deletion/copying/overwriting of a sign * @private
()
| 8935 | * @private |
| 8936 | */ |
| 8937 | _expandSelectionOnSign() { |
| 8938 | const [signPosition, currencySymbolPosition] = this._getSignPosition(); |
| 8939 | const selection = this.selection; |
| 8940 | |
| 8941 | // If selection catches something except sign and catches only space from sign |
| 8942 | if (selection.start < currencySymbolPosition && selection.end > signPosition) { |
| 8943 | // Then select without empty space |
| 8944 | if ((selection.start < signPosition || selection.end > currencySymbolPosition) && |
| 8945 | AutoNumericHelper.getElementValue(this.domElement).substring(Math.max(selection.start, signPosition), Math.min(selection.end, currencySymbolPosition)) |
| 8946 | .match(/^\s*$/)) { |
| 8947 | if (selection.start < signPosition) { |
| 8948 | this._setSelection(selection.start, signPosition); |
| 8949 | } else { |
| 8950 | this._setSelection(currencySymbolPosition, selection.end); |
| 8951 | } |
| 8952 | } else { |
| 8953 | // Else select with whole sign |
| 8954 | this._setSelection(Math.min(selection.start, signPosition), Math.max(selection.end, currencySymbolPosition)); |
| 8955 | } |
| 8956 | } |
| 8957 | } |
| 8958 | |
| 8959 | /** |
| 8960 | * Return `true` if the given key should be ignored or not. |
no test coverage detected