mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)
* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 * fix config changes * fix strictnull checks
This commit is contained in:
@@ -171,7 +171,7 @@ export class InputBox extends Widget {
|
||||
let tagName = this.options.flexibleHeight ? 'textarea' : 'input';
|
||||
|
||||
let wrapper = dom.append(this.element, $('.wrapper'));
|
||||
this.input = dom.append(wrapper, $(tagName + '.input'));
|
||||
this.input = dom.append(wrapper, $(tagName + '.input.empty'));
|
||||
this.input.setAttribute('autocorrect', 'off');
|
||||
this.input.setAttribute('autocapitalize', 'off');
|
||||
this.input.setAttribute('spellcheck', 'false');
|
||||
@@ -242,13 +242,7 @@ export class InputBox extends Widget {
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (!this.input) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateMirror();
|
||||
}, 0);
|
||||
setTimeout(() => this.updateMirror(), 0);
|
||||
|
||||
// Support actions
|
||||
if (this.options.actions) {
|
||||
@@ -270,21 +264,18 @@ export class InputBox extends Widget {
|
||||
}
|
||||
|
||||
public setPlaceHolder(placeHolder: string): void {
|
||||
if (this.input) {
|
||||
this.input.setAttribute('placeholder', placeHolder);
|
||||
this.input.title = placeHolder;
|
||||
}
|
||||
this.placeholder = placeHolder;
|
||||
this.input.setAttribute('placeholder', placeHolder);
|
||||
this.input.title = placeHolder;
|
||||
}
|
||||
|
||||
public setAriaLabel(label: string): void {
|
||||
this.ariaLabel = label;
|
||||
|
||||
if (this.input) {
|
||||
if (label) {
|
||||
this.input.setAttribute('aria-label', this.ariaLabel);
|
||||
} else {
|
||||
this.input.removeAttribute('aria-label');
|
||||
}
|
||||
if (label) {
|
||||
this.input.setAttribute('aria-label', this.ariaLabel);
|
||||
} else {
|
||||
this.input.removeAttribute('aria-label');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,6 +541,7 @@ export class InputBox extends Widget {
|
||||
|
||||
this.validate();
|
||||
this.updateMirror();
|
||||
dom.toggleClass(this.input, 'empty', !this.value);
|
||||
|
||||
if (this.state === 'open' && this.contextViewProvider) {
|
||||
this.contextViewProvider.layout();
|
||||
@@ -561,7 +553,7 @@ export class InputBox extends Widget {
|
||||
return;
|
||||
}
|
||||
|
||||
const value = this.value || this.placeholder;
|
||||
const value = this.value;
|
||||
const lastCharCode = value.charCodeAt(value.length - 1);
|
||||
const suffix = lastCharCode === 10 ? ' ' : '';
|
||||
const mirrorTextContent = value + suffix;
|
||||
@@ -594,20 +586,18 @@ export class InputBox extends Widget {
|
||||
}
|
||||
|
||||
protected applyStyles(): void {
|
||||
if (this.element) {
|
||||
const background = this.inputBackground ? this.inputBackground.toString() : null;
|
||||
const foreground = this.inputForeground ? this.inputForeground.toString() : null;
|
||||
const border = this.inputBorder ? this.inputBorder.toString() : null;
|
||||
const background = this.inputBackground ? this.inputBackground.toString() : null;
|
||||
const foreground = this.inputForeground ? this.inputForeground.toString() : null;
|
||||
const border = this.inputBorder ? this.inputBorder.toString() : null;
|
||||
|
||||
this.element.style.backgroundColor = background;
|
||||
this.element.style.color = foreground;
|
||||
this.input.style.backgroundColor = background;
|
||||
this.input.style.color = foreground;
|
||||
this.element.style.backgroundColor = background;
|
||||
this.element.style.color = foreground;
|
||||
this.input.style.backgroundColor = background;
|
||||
this.input.style.color = foreground;
|
||||
|
||||
this.element.style.borderWidth = border ? '1px' : null;
|
||||
this.element.style.borderStyle = border ? 'solid' : null;
|
||||
this.element.style.borderColor = border;
|
||||
}
|
||||
this.element.style.borderWidth = border ? '1px' : null;
|
||||
this.element.style.borderStyle = border ? 'solid' : null;
|
||||
this.element.style.borderColor = border;
|
||||
}
|
||||
|
||||
public layout(): void {
|
||||
@@ -625,16 +615,27 @@ export class InputBox extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
public insertAtCursor(text: string): void {
|
||||
const inputElement = this.inputElement;
|
||||
const start = inputElement.selectionStart;
|
||||
const end = inputElement.selectionEnd;
|
||||
const content = inputElement.value;
|
||||
|
||||
if (start !== null && end !== null) {
|
||||
this.value = content.substr(0, start) + text + content.substr(end);
|
||||
inputElement.setSelectionRange(start + 1, start + 1);
|
||||
this.layout();
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._hideMessage();
|
||||
|
||||
this.element = null!; // StrictNullOverride: nulling out ok in dispose
|
||||
this.input = null!; // StrictNullOverride: nulling out ok in dispose
|
||||
this.contextViewProvider = undefined;
|
||||
this.message = null;
|
||||
this.validation = undefined;
|
||||
this.state = null!; // StrictNullOverride: nulling out ok in dispose
|
||||
this.actionbar = undefined;
|
||||
|
||||
if (this.actionbar) {
|
||||
this.actionbar.dispose();
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user