提交 fa1bcc90 编写于 作者: A Alex Dima

Extract text area related CSS to textAreaHandler.css

上级 acff3d07
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-editor .inputarea {
/*Chrome cannot handle typing in a 0x0 textarea*/
width: 1px;
height: 1px;
min-width: 0;
min-height: 0;
margin: 0;
padding: 0;
position: absolute;
outline: none !important;
resize: none;
border: none;
overflow: hidden;
}
/*.monaco-editor .inputarea {
position: fixed !important;
width: 800px !important;
height: 500px !important;
top: initial !important;
left: initial !important;
bottom: 0 !important;
right: 0 !important;
}*/
.monaco-editor.ff .inputarea,
.monaco-editor.ie .inputarea {
width: 0;
height: 0;
}
.monaco-editor .ime-input.inputarea {
z-index: 10;
}
.monaco-editor .ime-input.inputarea {
background: rgba(255, 255, 255, 0.85);
}
.monaco-editor.vs-dark .ime-input.inputarea {
background: rgba(0, 0, 0, 0.65);
}
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
import 'vs/css!./textAreaHandler';
import * as browser from 'vs/base/browser/browser'; import * as browser from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom'; import * as dom from 'vs/base/browser/dom';
import { TextAreaInput, ITextAreaInputHost, IPasteData, ICompositionData } from 'vs/editor/browser/controller/textAreaInput'; import { TextAreaInput, ITextAreaInputHost, IPasteData, ICompositionData } from 'vs/editor/browser/controller/textAreaInput';
...@@ -24,7 +25,6 @@ import { Margin } from "vs/editor/browser/viewParts/margin/margin"; ...@@ -24,7 +25,6 @@ import { Margin } from "vs/editor/browser/viewParts/margin/margin";
import { LineNumbersOverlay } from "vs/editor/browser/viewParts/lineNumbers/lineNumbers"; import { LineNumbersOverlay } from "vs/editor/browser/viewParts/lineNumbers/lineNumbers";
export interface ITextAreaHandlerHelper { export interface ITextAreaHandlerHelper {
viewDomNode: FastDomNode<HTMLElement>;
visibleRangeForPositionRelativeToEditor(lineNumber: number, column: number): HorizontalRange; visibleRangeForPositionRelativeToEditor(lineNumber: number, column: number): HorizontalRange;
getVerticalOffsetForLineNumber(lineNumber: number): number; getVerticalOffsetForLineNumber(lineNumber: number): number;
} }
...@@ -228,7 +228,7 @@ export class TextAreaHandler extends ViewEventHandler { ...@@ -228,7 +228,7 @@ export class TextAreaHandler extends ViewEventHandler {
// Show the textarea // Show the textarea
this.textArea.setHeight(this._context.configuration.editor.lineHeight); this.textArea.setHeight(this._context.configuration.editor.lineHeight);
this._viewHelper.viewDomNode.addClassName('ime-input'); this.textArea.setClassName('inputarea ime-input');
this._viewController.compositionStart('keyboard'); this._viewController.compositionStart('keyboard');
})); }));
...@@ -261,7 +261,7 @@ export class TextAreaHandler extends ViewEventHandler { ...@@ -261,7 +261,7 @@ export class TextAreaHandler extends ViewEventHandler {
this.textArea.unsetWidth(); this.textArea.unsetWidth();
this.textArea.setLeft(0); this.textArea.setLeft(0);
this.textArea.setTop(0); this.textArea.setTop(0);
this._viewHelper.viewDomNode.removeClassName('ime-input'); this.textArea.setClassName('inputarea');
this._visiblePosition = null; this._visiblePosition = null;
......
...@@ -83,7 +83,7 @@ export class View extends ViewEventHandler { ...@@ -83,7 +83,7 @@ export class View extends ViewEventHandler {
private readonly _textAreaHandler: TextAreaHandler; private readonly _textAreaHandler: TextAreaHandler;
private readonly pointerHandler: PointerHandler; private readonly pointerHandler: PointerHandler;
private outgoingEvents: ViewOutgoingEvents; private readonly outgoingEvents: ViewOutgoingEvents;
// Dom nodes // Dom nodes
private linesContent: FastDomNode<HTMLElement>; private linesContent: FastDomNode<HTMLElement>;
...@@ -302,7 +302,6 @@ export class View extends ViewEventHandler { ...@@ -302,7 +302,6 @@ export class View extends ViewEventHandler {
private createTextAreaHandlerHelper(): ITextAreaHandlerHelper { private createTextAreaHandlerHelper(): ITextAreaHandlerHelper {
return { return {
viewDomNode: this.domNode,
visibleRangeForPositionRelativeToEditor: (lineNumber: number, column: number) => { visibleRangeForPositionRelativeToEditor: (lineNumber: number, column: number) => {
this._flushAccumulatedAndRenderNow(); this._flushAccumulatedAndRenderNow();
let visibleRanges = this.viewLines.visibleRangesForRange2(new Range(lineNumber, column, lineNumber, column)); let visibleRanges = this.viewLines.visibleRangesForRange2(new Range(lineNumber, column, lineNumber, column));
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
color: inherit; color: inherit;
} }
/* -------------------- Editor, inputarea and background -------------------- */ /* -------------------- Editor -------------------- */
.monaco-editor { .monaco-editor {
position: relative; position: relative;
...@@ -29,40 +29,8 @@ ...@@ -29,40 +29,8 @@
-webkit-font-feature-settings: "liga" on, "calt" on; -webkit-font-feature-settings: "liga" on, "calt" on;
font-feature-settings: "liga" on, "calt" on; font-feature-settings: "liga" on, "calt" on;
} }
.monaco-editor .inputarea {
/*Chrome cannot handle typing in a 0x0 textarea*/
width: 1px;
height: 1px;
min-width: 0;
min-height: 0;
margin: 0;
padding: 0;
position: absolute;
outline: none !important;
resize: none;
border: none;
overflow: hidden;
}
/*.monaco-editor .inputarea {
position: fixed !important;
width: 800px !important;
height: 200px !important;
top: initial !important;
left: initial !important;
bottom: 0 !important;
right: 0 !important;
}*/
.monaco-editor.ff .inputarea,
.monaco-editor.ie .inputarea {
width: 0;
height: 0;
}
.monaco-editor.ime-input .inputarea {
z-index: 10;
}
.monaco-editor, .monaco-editor {
.monaco-editor .inputarea {
color: #333; color: #333;
/* /*
* WORKAROUND: * WORKAROUND:
...@@ -71,22 +39,14 @@ ...@@ -71,22 +39,14 @@
*/ */
background: #fffffe; background: #fffffe;
} }
.monaco-editor.ime-input .inputarea {
background: rgba(255, 255, 255, 0.85);
}
.monaco-editor.vs-dark, .monaco-editor.vs-dark,
.monaco-editor.vs-dark .inputarea,
.monaco-editor.vs-dark .zone-widget .monaco-editor { .monaco-editor.vs-dark .zone-widget .monaco-editor {
color: #BBB; color: #BBB;
background: #1E1E1E; background: #1E1E1E;
} }
.monaco-editor.vs-dark.ime-input .inputarea {
background: rgba(0, 0, 0, 0.65);
}
.monaco-editor.hc-black, .monaco-editor.hc-black,
.monaco-editor.hc-black .inputarea,
.monaco-editor.hc-black .zone-widget .monaco-editor { .monaco-editor.hc-black .zone-widget .monaco-editor {
color: #fff; color: #fff;
background: #000; background: #000;
......
...@@ -25,7 +25,7 @@ registerThemingParticipant((theme, collector) => { ...@@ -25,7 +25,7 @@ registerThemingParticipant((theme, collector) => {
let background = theme.getColor(editorBackground); let background = theme.getColor(editorBackground);
if (background) { if (background) {
collector.addRule(`.monaco-editor.${theme.selector} .monaco-editor-background { background-color: ${background}; }`); collector.addRule(`.monaco-editor.${theme.selector} .monaco-editor-background, .monaco-editor.${theme.selector} .inputarea { background-color: ${background}; }`);
} }
let foreground = theme.getColor(editorForeground); let foreground = theme.getColor(editorForeground);
if (foreground) { if (foreground) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册