提交 3e3dd8ce 编写于 作者: S Sandeep Somavarapu

fix #9887

上级 fe974d08
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
cursor: pointer; cursor: pointer;
} }
.search-viewlet .search-widget .input-box { .search-viewlet .search-widget .search-container,
.search-viewlet .search-widget .replace-container {
margin-left: 17px; margin-left: 17px;
} }
...@@ -38,14 +39,30 @@ ...@@ -38,14 +39,30 @@
vertical-align: middle; vertical-align: middle;
} }
.search-viewlet .search-widget .replace-box { .search-viewlet .search-widget .replace-container {
margin-top: 6px; margin-top: 6px;
position: relative;
} }
.search-viewlet .search-widget .replace-box.disabled { .search-viewlet .search-widget .replace-container.disabled {
display: none; display: none;
} }
.search-viewlet .search-widget .replace-container > * {
display: inline-block;
}
.search-viewlet .search-widget .replace-container .monaco-action-bar {
position: absolute;
margin-left: 3px;
}
.search-viewlet .search-widget .replace-container .monaco-action-bar .action-item .icon {
background-repeat: no-repeat;
width: 20px;
height: 25px;
}
.search-viewlet .query-clear { .search-viewlet .query-clear {
width: 20px; width: 20px;
height: 20px; height: 20px;
...@@ -63,7 +80,7 @@ ...@@ -63,7 +80,7 @@
.search-viewlet .query-details .more { .search-viewlet .query-details .more {
position: absolute; position: absolute;
margin-right: 0.5em; margin-right: 0.3em;
right: 0; right: 0;
cursor: pointer; cursor: pointer;
width: 16px; width: 16px;
...@@ -193,7 +210,7 @@ ...@@ -193,7 +210,7 @@
} }
.search-viewlet .action-replace-all { .search-viewlet .action-replace-all {
background-image: url('replace-all.svg'); background: url('replace-all.svg') center center no-repeat;
} }
.hc-black .search-viewlet .action-replace, .hc-black .search-viewlet .action-replace,
...@@ -203,7 +220,7 @@ ...@@ -203,7 +220,7 @@
.hc-black .search-viewlet .action-replace-all, .hc-black .search-viewlet .action-replace-all,
.vs-dark .search-viewlet .action-replace-all { .vs-dark .search-viewlet .action-replace-all {
background-image: url('replace-all-inverse.svg'); background: url('replace-all-inverse.svg') center center no-repeat;
} }
.search-viewlet .label { .search-viewlet .label {
......
...@@ -9,6 +9,7 @@ import dom = require('vs/base/browser/dom'); ...@@ -9,6 +9,7 @@ import dom = require('vs/base/browser/dom');
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { Widget } from 'vs/base/browser/ui/widget'; import { Widget } from 'vs/base/browser/ui/widget';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findInput'; import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findInput';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { Button } from 'vs/base/browser/ui/button/button'; import { Button } from 'vs/base/browser/ui/button/button';
...@@ -74,10 +75,11 @@ export class SearchWidget extends Widget { ...@@ -74,10 +75,11 @@ export class SearchWidget extends Widget {
public searchInput: FindInput; public searchInput: FindInput;
private replaceInput: InputBox; private replaceInput: InputBox;
private replaceInputContainer: HTMLElement; private replaceContainer: HTMLElement;
private toggleReplaceButton: Button; private toggleReplaceButton: Button;
private replaceAllAction: ReplaceAllAction; private replaceAllAction: ReplaceAllAction;
private replaceActive: IKeybindingContextKey<boolean>; private replaceActive: IKeybindingContextKey<boolean>;
private replaceActionBar: ActionBar;
private _onSearchSubmit = this._register(new Emitter<boolean>()); private _onSearchSubmit = this._register(new Emitter<boolean>());
public onSearchSubmit: Event<boolean> = this._onSearchSubmit.event; public onSearchSubmit: Event<boolean> = this._onSearchSubmit.event;
...@@ -138,7 +140,7 @@ export class SearchWidget extends Widget { ...@@ -138,7 +140,7 @@ export class SearchWidget extends Widget {
} }
public isReplaceShown(): boolean { public isReplaceShown(): boolean {
return !dom.hasClass(this.replaceInputContainer, 'disabled'); return !dom.hasClass(this.replaceContainer, 'disabled');
} }
public getReplaceValue():string { public getReplaceValue():string {
...@@ -173,7 +175,7 @@ export class SearchWidget extends Widget { ...@@ -173,7 +175,7 @@ export class SearchWidget extends Widget {
placeholder: nls.localize('search.placeHolder', "Search") placeholder: nls.localize('search.placeHolder', "Search")
}; };
let searchInputContainer= dom.append(parent, dom.emmet('.search-box.input-box')); let searchInputContainer= dom.append(parent, dom.emmet('.search-container.input-box'));
this.searchInput = this._register(new FindInput(searchInputContainer, this.contextViewService, inputOptions)); this.searchInput = this._register(new FindInput(searchInputContainer, this.contextViewService, inputOptions));
this.searchInput.onKeyUp((keyboardEvent: IKeyboardEvent) => this.onSearchInputKeyUp(keyboardEvent)); this.searchInput.onKeyUp((keyboardEvent: IKeyboardEvent) => this.onSearchInputKeyUp(keyboardEvent));
this.searchInput.onKeyDown((keyboardEvent: IKeyboardEvent) => this.onSearchInputKeyDown(keyboardEvent)); this.searchInput.onKeyDown((keyboardEvent: IKeyboardEvent) => this.onSearchInputKeyDown(keyboardEvent));
...@@ -184,19 +186,22 @@ export class SearchWidget extends Widget { ...@@ -184,19 +186,22 @@ export class SearchWidget extends Widget {
} }
private renderReplaceInput(parent: HTMLElement): void { private renderReplaceInput(parent: HTMLElement): void {
this.replaceAllAction = ReplaceAllAction.INSTANCE; this.replaceContainer = dom.append(parent, dom.emmet('.replace-container.disabled'));
this.replaceAllAction.searchWidget= this; let replaceBox= dom.append(this.replaceContainer, dom.emmet('.input-box'));
this.replaceAllAction.label= SearchWidget.REPLACE_ALL_DISABLED_LABEL; this.replaceInput = this._register(new InputBox(replaceBox, this.contextViewService, {
this.replaceInputContainer= dom.append(parent, dom.emmet('.replace-box.input-box.disabled'));
this.replaceInput = this._register(new InputBox(this.replaceInputContainer, this.contextViewService, {
ariaLabel: nls.localize('label.Replace', 'Replace: Type replace term and press Enter to preview or Escape to cancel'), ariaLabel: nls.localize('label.Replace', 'Replace: Type replace term and press Enter to preview or Escape to cancel'),
placeholder: nls.localize('search.replace.placeHolder', "Replace"), placeholder: nls.localize('search.replace.placeHolder', "Replace")
actions: [this.replaceAllAction]
})); }));
this.onkeydown(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyDown(keyboardEvent)); this.onkeydown(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyDown(keyboardEvent));
this.onkeyup(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyUp(keyboardEvent)); this.onkeyup(this.replaceInput.inputElement, (keyboardEvent) => this.onReplaceInputKeyUp(keyboardEvent));
this.replaceInput.onDidChange(() => this._onReplaceValueChanged.fire()); this.replaceInput.onDidChange(() => this._onReplaceValueChanged.fire());
this.searchInput.inputBox.onDidChange(() => this.onSearchInputChanged()); this.searchInput.inputBox.onDidChange(() => this.onSearchInputChanged());
this.replaceAllAction = ReplaceAllAction.INSTANCE;
this.replaceAllAction.searchWidget= this;
this.replaceAllAction.label = SearchWidget.REPLACE_ALL_DISABLED_LABEL;
this.replaceActionBar = this._register(new ActionBar(this.replaceContainer));
this.replaceActionBar.push([this.replaceAllAction], { icon: true, label: false });
} }
triggerReplaceAll(): TPromise<any> { triggerReplaceAll(): TPromise<any> {
...@@ -205,7 +210,7 @@ export class SearchWidget extends Widget { ...@@ -205,7 +210,7 @@ export class SearchWidget extends Widget {
} }
private onToggleReplaceButton():void { private onToggleReplaceButton():void {
dom.toggleClass(this.replaceInputContainer, 'disabled'); dom.toggleClass(this.replaceContainer, 'disabled');
dom.toggleClass(this.toggleReplaceButton.getElement(), 'collapse'); dom.toggleClass(this.toggleReplaceButton.getElement(), 'collapse');
dom.toggleClass(this.toggleReplaceButton.getElement(), 'expand'); dom.toggleClass(this.toggleReplaceButton.getElement(), 'expand');
this.updateReplaceActiveState(); this.updateReplaceActiveState();
...@@ -325,7 +330,7 @@ export class SearchWidget extends Widget { ...@@ -325,7 +330,7 @@ export class SearchWidget extends Widget {
public dispose(): void { public dispose(): void {
this.setReplaceAllActionState(false); this.setReplaceAllActionState(false);
this.replaceAllAction.searchWidget= null; this.replaceAllAction.searchWidget= null;
this.replaceActionBar = null;
super.dispose(); super.dispose();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册