Skip to content

Commit 620f187

Browse files
committed
Fix some IE8 problems with the right-click menu
1 parent 37cfc82 commit 620f187

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/codemirror.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var CodeMirror = (function() {
8484
// Gecko browsers fire contextmenu *after* opening the menu, at
8585
// which point we can't mess with it anymore. Context menu is
8686
// handled in onMouseDown for Gecko.
87-
if (!gecko) connect(scroller, "contextmenu", operation(onContextMenu));
87+
if (!gecko) connect(scroller, "contextmenu", onContextMenu);
8888
connect(code, "dblclick", operation(onDblClick));
8989
connect(scroller, "scroll", function() {updateDisplay([]); if (options.onScroll) options.onScroll(instance);});
9090
connect(window, "resize", function() {updateDisplay(true);});
@@ -1162,18 +1162,21 @@ var CodeMirror = (function() {
11621162
var pos = posFromMouse(e);
11631163
if (!pos || window.opera) return; // Opera is difficult.
11641164
if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
1165-
setCursor(pos.line, pos.ch);
1165+
operation(setCursor)(pos.line, pos.ch);
11661166

11671167
var oldCSS = input.style.cssText;
1168+
inputDiv.style.position = "absolute";
11681169
input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.pageY() - 1) +
11691170
"px; left: " + (e.pageX() - 1) + "px; z-index: 1000; background: white; " +
1170-
"border-width: 0; outline: none; overflow: hidden; opacity: .05;";
1171+
"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
11711172
var val = input.value = getSelection();
11721173
focusInput();
11731174
setSelRange(input, 0, input.value.length);
11741175
leaveInputAlone = true;
11751176
function rehide() {
1176-
if (input.value != val) operation(replaceSelection)(input.value, "end");
1177+
var newVal = splitLines(input.value).join("\n");
1178+
if (newVal != val) operation(replaceSelection)(newVal, "end");
1179+
inputDiv.style.position = "relative";
11771180
input.style.cssText = oldCSS;
11781181
leaveInputAlone = false;
11791182
prepareInput();

0 commit comments

Comments
 (0)