allow displaying spellcheck suggestions in contextmenu

This commit is contained in:
nightwing 2012-12-06 02:35:43 +04:00
commit 38a5a522c2

View file

@ -359,12 +359,17 @@ var TextInput = function(parentNode, host) {
if (!tempStyle)
tempStyle = text.style.cssText;
text.style.cssText =
"position:fixed; z-index:100000;" +
(useragent.isIE ? "background:rgba(0, 0, 0, 0.03); opacity:0.1;" : "") + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
text.style.cssText = "z-index:100000;" +
(useragent.isIE ? "opacity:0.1;" : "")// + "background:rgba(250, 0, 0, 0.3); opacity:1;"
resetSelection(host.selection.isEmpty());
host._emit("nativecontextmenu", {target: editor});
var rect = host.container.getBoundingClientRect();
var move = function(e) {
text.style.left = e.clientX - rect.left - 2 + "px";
text.style.top = e.clientY - rect.top - 2 + "px";
};
move(e);
if (e.type != "mousedown")
return;
@ -374,10 +379,7 @@ var TextInput = function(parentNode, host) {
// on windows context menu is opened after mouseup
if (useragent.isWin)
event.capture(host.container, function(e) {
text.style.left = e.clientX - 2 + "px";
text.style.top = e.clientY - 2 + "px";
}, onContextMenuClose);
event.capture(host.container, move, onContextMenuClose);
};
function onContextMenuClose() {