Compare commits
10 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab70b55316 | ||
|
|
fbdfaaf0fc | ||
|
|
1d05dc78be | ||
|
|
0ca1e2cf2d | ||
|
|
1b8ea9a48e | ||
|
|
4315fd36cf | ||
|
|
b3b26a311b | ||
|
|
ff7c1b5182 | ||
|
|
c50a765176 | ||
|
|
fcc37e2068 |
7 changed files with 92 additions and 64 deletions
|
|
@ -2,8 +2,8 @@
|
|||
position: absolute;
|
||||
overflow: hidden;
|
||||
|
||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
font-family: "Droid Sans Mono", "Monaco", "Courier New", monospace;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.ace_scroller {
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
}
|
||||
|
||||
.ace_text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-family: "Droid Sans Mono", Monaco, "Courier New", monospace;
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ var EditSession = function(text, mode) {
|
|||
return this.doc.getNewLineMode();
|
||||
};
|
||||
|
||||
this.$useWorker = true;
|
||||
this.$useWorker = false;
|
||||
this.setUseWorker = function(useWorker) {
|
||||
if (this.$useWorker == useWorker)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.resize = function() {
|
||||
this.renderer.onResize();
|
||||
this.renderer.$textLayer.$pollSizeChanges();
|
||||
};
|
||||
|
||||
this.setTheme = function(theme) {
|
||||
|
|
@ -528,7 +529,7 @@ var Editor =function(renderer, session) {
|
|||
return this.$highlightActiveLine;
|
||||
};
|
||||
|
||||
this.$highlightSelectedWord = true;
|
||||
this.$highlightSelectedWord = false;
|
||||
this.setHighlightSelectedWord = function(shouldHighlight) {
|
||||
if (this.$highlightSelectedWord == shouldHighlight)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var text = dom.createElement("textarea");
|
||||
text.style.left = "-10000px";
|
||||
// We have too many moving parts in the iPad, so we set the text
|
||||
// positioning to absolute to be able to calculate the precise position for
|
||||
// cursor. Otherwise the cursor position would be relative to the screen
|
||||
// coordinates (position: fixed).
|
||||
if (useragent.isIPad)
|
||||
text.style.position = "absolute";
|
||||
|
||||
parentNode.appendChild(text);
|
||||
|
||||
var PLACEHOLDER = String.fromCharCode(0);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
var dom = require("pilot/dom");
|
||||
var useragent = require("pilot/useragent");
|
||||
|
||||
var Cursor = function(parentEl) {
|
||||
this.element = dom.createElement("div");
|
||||
|
|
@ -68,7 +69,9 @@ var Cursor = function(parentEl) {
|
|||
|
||||
this.showCursor = function() {
|
||||
this.isVisible = true;
|
||||
this.element.appendChild(this.cursor);
|
||||
if (!useragent.isIPad)
|
||||
this.element.appendChild(this.cursor);
|
||||
|
||||
|
||||
var cursor = this.cursor;
|
||||
cursor.style.visibility = "visible";
|
||||
|
|
@ -120,7 +123,7 @@ var Cursor = function(parentEl) {
|
|||
this.cursor.style.width = config.characterWidth + "px";
|
||||
this.cursor.style.height = config.lineHeight + "px";
|
||||
|
||||
if (this.isVisible) {
|
||||
if (this.isVisible && !useragent.isIPad) {
|
||||
this.element.appendChild(this.cursor);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
/* vim:ts=4:sts=4:sw=4:
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
|
@ -77,13 +78,13 @@ var Text = function(parentEl) {
|
|||
|
||||
this.$pollSizeChanges = function() {
|
||||
var self = this;
|
||||
setInterval(function() {
|
||||
//setInterval(function() {
|
||||
var size = self.$measureSizes();
|
||||
if (self.$characterSize.width !== size.width || self.$characterSize.height !== size.height) {
|
||||
self.$characterSize = size;
|
||||
self._dispatchEvent("changeCharaterSize", {data: size});
|
||||
}
|
||||
}, 500);
|
||||
//}, 500);
|
||||
};
|
||||
|
||||
this.$fontStyles = {
|
||||
|
|
|
|||
|
|
@ -319,23 +319,39 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.getTextAreaContainer = function() {
|
||||
return this.container;
|
||||
// Let's make it play nice wit iPad. Otherwise the default padding of
|
||||
// the container will make the cursor shift to the left.
|
||||
return useragent.isIPad ? this.content : this.container;
|
||||
|
||||
};
|
||||
|
||||
this.moveTextAreaToCursor = function(textarea) {
|
||||
// in IE the native cursor always shines through
|
||||
if (useragent.isIE)
|
||||
if (!this.layerConfig)
|
||||
return;
|
||||
|
||||
var pos = this.$cursorLayer.getPixelPosition();
|
||||
if (!pos)
|
||||
return;
|
||||
var pos, left, top;
|
||||
if (useragent.isIPad) {
|
||||
pos = this.$cursorLayer.getPixelPosition(true);
|
||||
if (!pos)
|
||||
return;
|
||||
|
||||
var bounds = this.content.getBoundingClientRect();
|
||||
var offset = (this.layerConfig && this.layerConfig.offset) || 0;
|
||||
left = pos.left + this.$padding - 3;
|
||||
top = pos.top;
|
||||
} else {
|
||||
pos = this.$cursorLayer.getPixelPosition();
|
||||
if (!pos)
|
||||
return;
|
||||
|
||||
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
|
||||
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
|
||||
var bounds = this.content.getBoundingClientRect();
|
||||
var offset = this.layerConfig.offset;
|
||||
|
||||
left = bounds.left + pos.left + this.$padding;
|
||||
top = bounds.top + pos.top - this.scrollTop + offset;
|
||||
}
|
||||
|
||||
textarea.style.left = left + "px";
|
||||
textarea.style.top = top + "px";
|
||||
textarea.style.lineHeight = this.layerConfig.lineHeight + "px";
|
||||
};
|
||||
|
||||
this.getFirstVisibleRow = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue