fix spellcheck extension on chrome

This commit is contained in:
nightwing 2013-10-20 20:56:59 +04:00
commit 5bead368ea
3 changed files with 30 additions and 9 deletions

View file

@ -33,6 +33,10 @@ define(function(require, exports, module) {
"use strict";
require("ace/lib/fixoldbrowsers");
require("ace/multi_select")
require("ace/ext/spellcheck");
var config = require("ace/config");
config.init();
var env = {};
@ -51,7 +55,6 @@ var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
var Editor = require("ace/editor").Editor;
var MultiSelect = require("ace/multi_select").MultiSelect;
var whitespace = require("ace/ext/whitespace");
@ -89,8 +92,6 @@ split.on("focus", function(editor) {
env.split = split;
window.env = env;
// add multiple cursor support to editor
require("ace/multi_select").MultiSelect(env.editor);
var consoleEl = dom.createElement("div");
container.parentNode.appendChild(consoleEl);
@ -531,6 +532,7 @@ bindCheckbox("highlight_token", function(checked) {
}
});
/************** dragover ***************************/
event.addListener(container, "dragover", function(e) {
var types = e.dataTransfer.types;
@ -562,6 +564,12 @@ event.addListener(container, "drop", function(e) {
var StatusBar = require("ace/ext/statusbar").StatusBar;
new StatusBar(env.editor, cmdLine.container);
@ -613,7 +621,22 @@ env.editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true
})
/* for textinput debuggging
dom.importCssString("\
.ace_text-input {\
position: absolute;\
z-index: 10!important;\
width: 6em!important;\
height: 1em;\
opacity: 1!important;\
background: rgba(0, 92, 255, 0.11);\
border: none;\
font: inherit;\
padding: 0 1px;\
margin: 0 -1px;\
text-indent: 0em;\
}\
")*/
});
// allow easy access to ace in console, but not in ace code which uses strict

View file

@ -17,8 +17,9 @@ exports.contextMenuHandler = function(e){
var PLACEHOLDER = "\x01\x01";
var value = w + " " + PLACEHOLDER;
text.value = value;
text.setSelectionRange(w.length + 1, w.length + 1);
text.setSelectionRange(w.length, w.length + 1);
text.setSelectionRange(0, 0);
text.setSelectionRange(0, w.length);
var afterKeydown = false;
event.addListener(text, "keydown", function onKeydown() {

View file

@ -40,9 +40,7 @@ var BROKEN_SETDATA = useragent.isChrome < 18;
var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea");
text.className = "ace_text-input";
/*/ debug
text.style.cssText = "opacity:1;background:rgba(0, 250, 0, 0.3);outline:rgba(0, 250, 0, 0.8) solid 1px;outline-offset:3px;width:5em;z-pindex:500";
/**/
if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true);
@ -451,7 +449,6 @@ var TextInput = function(parentNode, host) {
tempStyle = text.style.cssText;
text.style.cssText = "z-index:100000;" + (useragent.isIE ? "opacity:0.1;" : "");
//debug*/ text.style.cssText += "background:rgba(250, 0, 0, 0.3); opacity:1;";
resetSelection(host.selection.isEmpty());
host._emit("nativecontextmenu", {target: host, domEvent: e});