working with a big hack

pull/2480/head
John McLear 2015-01-21 14:25:24 +00:00
parent 34d6b31c98
commit 990e14c904
5 changed files with 25 additions and 27 deletions

View File

@ -21,6 +21,15 @@
*/
var _, $, jQuery, plugins, Ace2Common, mybrowser;
mybrowser = require('./browser').browser;
if(mybrowser.msie){
// Honestly fuck IE royally.
// Basically every hack we have since V11 causes a problem
if(parseInt(mybrowser.version) >= 11){
delete mybrowser.msie;
mybrowser.firefox = true;
}
}
Ace2Common = require('./ace2_common');
plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
@ -1311,9 +1320,7 @@ function Ace2Inner(){
else
{
var offsetIntoLine = 0;
mybrowser.msie = false; // cake 1
var filteredFunc = linestylefilter.getFilterStack(text, textAndClassFunc, mybrowser);
mybrowser.msie = true;
var lineNum = rep.lines.indexOfEntry(lineEntry);
var aline = rep.alines[lineNum];
filteredFunc = linestylefilter.getLineStyleFilter(
@ -1355,7 +1362,7 @@ mybrowser.msie = true;
// (from how it looks in our representation) and record them in a way
// that can be used to "normalize" the document (apply the changes to our
// representation, and put the DOM in a canonical form).
//top.console.log("observeChangesAroundNode(%o)", node);
// top.console.log("observeChangesAroundNode(%o)", node);
var cleanNode;
var hasAdjacentDirtyness;
if (!isNodeDirty(node))
@ -1561,10 +1568,7 @@ mybrowser.msie = true;
lastDirtyNode = (lastDirtyNode && isNodeDirty(lastDirtyNode) && lastDirtyNode);
if (firstDirtyNode && lastDirtyNode)
{
// cake 2
mybrowser.msie = false;
var cc = makeContentCollector(isStyled, mybrowser, rep.apool, null, className2Author);
mybrowser.msie = true;
cc.notifySelection(selection);
var dirtyNodes = [];
for (var n = firstDirtyNode; n && !(n.previousSibling && n.previousSibling == lastDirtyNode);
@ -2964,15 +2968,11 @@ mybrowser.msie = true;
{
return "";
};
return result;
}
else
{
// cake 3
mybrowser.msie = false;
return domline.createDomLine(nonEmpty, doesWrap, mybrowser, doc);
mybrowser.msie = true;
}
}
@ -3632,7 +3632,6 @@ mybrowser.msie = true;
evt.preventDefault();
return;
}
// Is caret potentially hidden by the chat button?
var myselection = document.getSelection(); // get the current caret selection
var caretOffsetTop = myselection.focusNode.parentNode.offsetTop | myselection.focusNode.offsetTop; // get the carets selection offset in px IE 214
@ -3669,8 +3668,7 @@ mybrowser.msie = true;
var specialHandled = false;
var isTypeForSpecialKey = ((mybrowser.msie || mybrowser.safari || mybrowser.chrome) ? (type == "keydown") : (type == "keypress"));
var isTypeForCmdKey = ((mybrowser.msie || mybrowser.safari || mybrowser.chrome) ? (type == "keydown") : (type == "keypress"));
var isTypeForCmdKey = (type === "keydown")
var stopped = false;
inCallStackIfNecessary("handleKeyEvent", function()
@ -3920,10 +3918,10 @@ mybrowser.msie = true;
// only move the viewport if we're at the bottom of the viewport, if we hit down any other time the viewport shouldn't change
// NOTE: This behavior only fires if Chrome decides to break the page layout after a paste, it's annoying but nothing I can do
var selection = getSelection();
top.console.log("line #", rep.selStart[0]); // the line our caret is on
top.console.log("firstvisible", visibleLineRange[0]); // the first visiblel ine
top.console.log("lastVisible", visibleLineRange[1]); // the last visible line
top.console.log(rep.selStart[0], visibleLineRange[1], rep.selStart[0], visibleLineRange[0]);
// top.console.log("line #", rep.selStart[0]); // the line our caret is on
// top.console.log("firstvisible", visibleLineRange[0]); // the first visiblel ine
// top.console.log("lastVisible", visibleLineRange[1]); // the last visible line
// top.console.log(rep.selStart[0], visibleLineRange[1], rep.selStart[0], visibleLineRange[0]);
var newY = viewport.top + lineHeight;
}
if(newY){

View File

@ -81,7 +81,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
onServerMessage: function()
{}
};
if (browser.firefox)
{
// Prevent "escape" from taking effect and canceling a comet connection;

View File

@ -35,9 +35,9 @@ function sanitizeUnicode(s)
return UNorm.nfc(s);
}
function makeContentCollector(collectStyles, browser, apool, domInterface, className2Author)
function makeContentCollector(collectStyles, abrowser, apool, domInterface, className2Author)
{
// browser = browser || {};
abrowser = abrowser || {};
// I don't like the above.
var dom = domInterface || {
@ -485,7 +485,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
var cls = dom.nodeProp(node, "className");
var isPre = (tname == "pre");
if ((!isPre) && browser.safari)
if ((!isPre) && abrowser.safari)
{
isPre = (styl && /\bwhite-space:\s*pre\b/i.exec(styl));
}
@ -611,7 +611,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
}
}
}
if (!browser.msie)
if (!abrowser.msie)
{
_reachBlockPoint(node, 1, state);
}
@ -627,7 +627,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
}
}
if (browser.msie)
if (abrowser.msie)
{
// in IE, a point immediately after a DIV appears on the next line
_reachBlockPoint(node, 1, state);

View File

@ -65,7 +65,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
lineMarker: 0
};
// var browser = (optBrowser || {});
var document = optDocument;
if (document)
@ -93,8 +92,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
var perTextNodeProcess = (doesWrap ? _.identity : processSpaces);
var perHtmlLineProcess = (doesWrap ? processSpaces : _.identity);
var lineClass = 'ace-line';
result.appendSpan = function(txt, cls)
{
var processedMarker = false;
// Handle lineAttributeMarker, if present
if (cls.indexOf(lineAttributeMarker) >= 0)

View File

@ -318,20 +318,20 @@ linestylefilter.textAndClassFuncSplitter = function(func, splitPointsOpt)
return spanHandler;
};
linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
linestylefilter.getFilterStack = function(lineText, textAndClassFunc, abrowser)
{
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
var hookFilters = hooks.callAll("aceGetFilterStack", {
linestylefilter: linestylefilter,
browser: browser
browser: abrowser
});
_.map(hookFilters ,function(hookFilter)
{
func = hookFilter(lineText, func);
});
if (browser !== undefined && browser.msie)
if (abrowser !== undefined && abrowser.msie)
{
// IE7+ will take an e-mail address like <foo@bar.com> and linkify it to foo@bar.com.
// We then normalize it back to text with no angle brackets. It's weird. So always