working with a big hack
parent
34d6b31c98
commit
990e14c904
|
@ -21,6 +21,15 @@
|
||||||
*/
|
*/
|
||||||
var _, $, jQuery, plugins, Ace2Common, mybrowser;
|
var _, $, jQuery, plugins, Ace2Common, mybrowser;
|
||||||
mybrowser = require('./browser').browser;
|
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');
|
Ace2Common = require('./ace2_common');
|
||||||
|
|
||||||
plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
|
plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
|
||||||
|
@ -1311,9 +1320,7 @@ function Ace2Inner(){
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var offsetIntoLine = 0;
|
var offsetIntoLine = 0;
|
||||||
mybrowser.msie = false; // cake 1
|
|
||||||
var filteredFunc = linestylefilter.getFilterStack(text, textAndClassFunc, mybrowser);
|
var filteredFunc = linestylefilter.getFilterStack(text, textAndClassFunc, mybrowser);
|
||||||
mybrowser.msie = true;
|
|
||||||
var lineNum = rep.lines.indexOfEntry(lineEntry);
|
var lineNum = rep.lines.indexOfEntry(lineEntry);
|
||||||
var aline = rep.alines[lineNum];
|
var aline = rep.alines[lineNum];
|
||||||
filteredFunc = linestylefilter.getLineStyleFilter(
|
filteredFunc = linestylefilter.getLineStyleFilter(
|
||||||
|
@ -1355,7 +1362,7 @@ mybrowser.msie = true;
|
||||||
// (from how it looks in our representation) and record them in a way
|
// (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
|
// that can be used to "normalize" the document (apply the changes to our
|
||||||
// representation, and put the DOM in a canonical form).
|
// representation, and put the DOM in a canonical form).
|
||||||
//top.console.log("observeChangesAroundNode(%o)", node);
|
// top.console.log("observeChangesAroundNode(%o)", node);
|
||||||
var cleanNode;
|
var cleanNode;
|
||||||
var hasAdjacentDirtyness;
|
var hasAdjacentDirtyness;
|
||||||
if (!isNodeDirty(node))
|
if (!isNodeDirty(node))
|
||||||
|
@ -1561,10 +1568,7 @@ mybrowser.msie = true;
|
||||||
lastDirtyNode = (lastDirtyNode && isNodeDirty(lastDirtyNode) && lastDirtyNode);
|
lastDirtyNode = (lastDirtyNode && isNodeDirty(lastDirtyNode) && lastDirtyNode);
|
||||||
if (firstDirtyNode && lastDirtyNode)
|
if (firstDirtyNode && lastDirtyNode)
|
||||||
{
|
{
|
||||||
// cake 2
|
|
||||||
mybrowser.msie = false;
|
|
||||||
var cc = makeContentCollector(isStyled, mybrowser, rep.apool, null, className2Author);
|
var cc = makeContentCollector(isStyled, mybrowser, rep.apool, null, className2Author);
|
||||||
mybrowser.msie = true;
|
|
||||||
cc.notifySelection(selection);
|
cc.notifySelection(selection);
|
||||||
var dirtyNodes = [];
|
var dirtyNodes = [];
|
||||||
for (var n = firstDirtyNode; n && !(n.previousSibling && n.previousSibling == lastDirtyNode);
|
for (var n = firstDirtyNode; n && !(n.previousSibling && n.previousSibling == lastDirtyNode);
|
||||||
|
@ -2964,15 +2968,11 @@ mybrowser.msie = true;
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// cake 3
|
|
||||||
mybrowser.msie = false;
|
|
||||||
return domline.createDomLine(nonEmpty, doesWrap, mybrowser, doc);
|
return domline.createDomLine(nonEmpty, doesWrap, mybrowser, doc);
|
||||||
mybrowser.msie = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3632,7 +3632,6 @@ mybrowser.msie = true;
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is caret potentially hidden by the chat button?
|
// Is caret potentially hidden by the chat button?
|
||||||
var myselection = document.getSelection(); // get the current caret selection
|
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
|
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 specialHandled = false;
|
||||||
var isTypeForSpecialKey = ((mybrowser.msie || mybrowser.safari || mybrowser.chrome) ? (type == "keydown") : (type == "keypress"));
|
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;
|
var stopped = false;
|
||||||
|
|
||||||
inCallStackIfNecessary("handleKeyEvent", function()
|
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
|
// 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
|
// 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();
|
var selection = getSelection();
|
||||||
top.console.log("line #", rep.selStart[0]); // the line our caret is on
|
// 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("firstvisible", visibleLineRange[0]); // the first visiblel ine
|
||||||
top.console.log("lastVisible", visibleLineRange[1]); // the last visible line
|
// 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(rep.selStart[0], visibleLineRange[1], rep.selStart[0], visibleLineRange[0]);
|
||||||
var newY = viewport.top + lineHeight;
|
var newY = viewport.top + lineHeight;
|
||||||
}
|
}
|
||||||
if(newY){
|
if(newY){
|
||||||
|
|
|
@ -81,7 +81,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||||
onServerMessage: function()
|
onServerMessage: function()
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (browser.firefox)
|
if (browser.firefox)
|
||||||
{
|
{
|
||||||
// Prevent "escape" from taking effect and canceling a comet connection;
|
// Prevent "escape" from taking effect and canceling a comet connection;
|
||||||
|
|
|
@ -35,9 +35,9 @@ function sanitizeUnicode(s)
|
||||||
return UNorm.nfc(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.
|
// I don't like the above.
|
||||||
|
|
||||||
var dom = domInterface || {
|
var dom = domInterface || {
|
||||||
|
@ -485,7 +485,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
var cls = dom.nodeProp(node, "className");
|
var cls = dom.nodeProp(node, "className");
|
||||||
|
|
||||||
var isPre = (tname == "pre");
|
var isPre = (tname == "pre");
|
||||||
if ((!isPre) && browser.safari)
|
if ((!isPre) && abrowser.safari)
|
||||||
{
|
{
|
||||||
isPre = (styl && /\bwhite-space:\s*pre\b/i.exec(styl));
|
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);
|
_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
|
// in IE, a point immediately after a DIV appears on the next line
|
||||||
_reachBlockPoint(node, 1, state);
|
_reachBlockPoint(node, 1, state);
|
||||||
|
|
|
@ -65,7 +65,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
lineMarker: 0
|
lineMarker: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// var browser = (optBrowser || {});
|
|
||||||
var document = optDocument;
|
var document = optDocument;
|
||||||
|
|
||||||
if (document)
|
if (document)
|
||||||
|
@ -93,8 +92,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
var perTextNodeProcess = (doesWrap ? _.identity : processSpaces);
|
var perTextNodeProcess = (doesWrap ? _.identity : processSpaces);
|
||||||
var perHtmlLineProcess = (doesWrap ? processSpaces : _.identity);
|
var perHtmlLineProcess = (doesWrap ? processSpaces : _.identity);
|
||||||
var lineClass = 'ace-line';
|
var lineClass = 'ace-line';
|
||||||
|
|
||||||
result.appendSpan = function(txt, cls)
|
result.appendSpan = function(txt, cls)
|
||||||
{
|
{
|
||||||
|
|
||||||
var processedMarker = false;
|
var processedMarker = false;
|
||||||
// Handle lineAttributeMarker, if present
|
// Handle lineAttributeMarker, if present
|
||||||
if (cls.indexOf(lineAttributeMarker) >= 0)
|
if (cls.indexOf(lineAttributeMarker) >= 0)
|
||||||
|
|
|
@ -318,20 +318,20 @@ linestylefilter.textAndClassFuncSplitter = function(func, splitPointsOpt)
|
||||||
return spanHandler;
|
return spanHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
|
linestylefilter.getFilterStack = function(lineText, textAndClassFunc, abrowser)
|
||||||
{
|
{
|
||||||
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
||||||
|
|
||||||
var hookFilters = hooks.callAll("aceGetFilterStack", {
|
var hookFilters = hooks.callAll("aceGetFilterStack", {
|
||||||
linestylefilter: linestylefilter,
|
linestylefilter: linestylefilter,
|
||||||
browser: browser
|
browser: abrowser
|
||||||
});
|
});
|
||||||
_.map(hookFilters ,function(hookFilter)
|
_.map(hookFilters ,function(hookFilter)
|
||||||
{
|
{
|
||||||
func = hookFilter(lineText, func);
|
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.
|
// 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
|
// We then normalize it back to text with no angle brackets. It's weird. So always
|
||||||
|
|
Loading…
Reference in New Issue