mheh looks fixed
parent
990e14c904
commit
ce40cacafa
|
@ -19,15 +19,15 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
var _, $, jQuery, plugins, Ace2Common, mybrowser;
|
var _, $, jQuery, plugins, Ace2Common, bowser;
|
||||||
mybrowser = require('./browser').browser;
|
bowser = require('./browser').browser;
|
||||||
|
|
||||||
if(mybrowser.msie){
|
if(bowser.msie){
|
||||||
// Honestly fuck IE royally.
|
// Honestly fuck IE royally.
|
||||||
// Basically every hack we have since V11 causes a problem
|
// Basically every hack we have since V11 causes a problem
|
||||||
if(parseInt(mybrowser.version) >= 11){
|
if(parseInt(bowser.version) >= 11){
|
||||||
delete mybrowser.msie;
|
delete bowser.msie;
|
||||||
mybrowser.firefox = true;
|
bowser.chrome = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ace2Common = require('./ace2_common');
|
Ace2Common = require('./ace2_common');
|
||||||
|
@ -607,7 +607,7 @@ function Ace2Inner(){
|
||||||
|
|
||||||
// Chrome can't handle the truth.. If CSS rule white-space:pre-wrap
|
// Chrome can't handle the truth.. If CSS rule white-space:pre-wrap
|
||||||
// is true then any paste event will insert two lines..
|
// is true then any paste event will insert two lines..
|
||||||
if(mybrowser.chrome){
|
if(bowser.chrome){
|
||||||
$("#innerdocbody").css({"white-space":"normal"});
|
$("#innerdocbody").css({"white-space":"normal"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,7 +953,7 @@ function Ace2Inner(){
|
||||||
showslinenumbers : function(value){
|
showslinenumbers : function(value){
|
||||||
hasLineNumbers = !! value;
|
hasLineNumbers = !! value;
|
||||||
// disable line numbers on mobile devices
|
// disable line numbers on mobile devices
|
||||||
// if (mybrowser.mobile) hasLineNumbers = false;
|
// if (bowser.mobile) hasLineNumbers = false;
|
||||||
setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers);
|
setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers);
|
||||||
fixView();
|
fixView();
|
||||||
},
|
},
|
||||||
|
@ -1320,7 +1320,7 @@ function Ace2Inner(){
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var offsetIntoLine = 0;
|
var offsetIntoLine = 0;
|
||||||
var filteredFunc = linestylefilter.getFilterStack(text, textAndClassFunc, mybrowser);
|
var filteredFunc = linestylefilter.getFilterStack(text, textAndClassFunc, bowser);
|
||||||
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(
|
||||||
|
@ -1568,13 +1568,13 @@ function Ace2Inner(){
|
||||||
lastDirtyNode = (lastDirtyNode && isNodeDirty(lastDirtyNode) && lastDirtyNode);
|
lastDirtyNode = (lastDirtyNode && isNodeDirty(lastDirtyNode) && lastDirtyNode);
|
||||||
if (firstDirtyNode && lastDirtyNode)
|
if (firstDirtyNode && lastDirtyNode)
|
||||||
{
|
{
|
||||||
var cc = makeContentCollector(isStyled, mybrowser, rep.apool, null, className2Author);
|
var cc = makeContentCollector(isStyled, bowser, rep.apool, null, className2Author);
|
||||||
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);
|
||||||
n = n.nextSibling)
|
n = n.nextSibling)
|
||||||
{
|
{
|
||||||
if (mybrowser.msie)
|
if (bowser.msie)
|
||||||
{
|
{
|
||||||
// try to undo IE's pesky and overzealous linkification
|
// try to undo IE's pesky and overzealous linkification
|
||||||
try
|
try
|
||||||
|
@ -1614,7 +1614,7 @@ function Ace2Inner(){
|
||||||
|
|
||||||
if (linesWrapped > 0)
|
if (linesWrapped > 0)
|
||||||
{
|
{
|
||||||
if(!mybrowser.msie){
|
if(!bowser.msie){
|
||||||
// chrome decides in it's infinite wisdom that its okay to put the browsers visisble window in the middle of the span
|
// chrome decides in it's infinite wisdom that its okay to put the browsers visisble window in the middle of the span
|
||||||
// an outcome of this is that the first chars of the string are no longer visible to the user.. Yay chrome..
|
// an outcome of this is that the first chars of the string are no longer visible to the user.. Yay chrome..
|
||||||
// Move the browsers visible area to the left hand side of the span
|
// Move the browsers visible area to the left hand side of the span
|
||||||
|
@ -1919,7 +1919,7 @@ function Ace2Inner(){
|
||||||
if (charsLeft === 0)
|
if (charsLeft === 0)
|
||||||
{
|
{
|
||||||
var index = 0;
|
var index = 0;
|
||||||
if (mybrowser.msie && line == (rep.lines.length() - 1) && lineNode.childNodes.length === 0)
|
if (bowser.msie && line == (rep.lines.length() - 1) && lineNode.childNodes.length === 0)
|
||||||
{
|
{
|
||||||
// best to stay at end of last empty div in IE
|
// best to stay at end of last empty div in IE
|
||||||
index = 1;
|
index = 1;
|
||||||
|
@ -2912,7 +2912,7 @@ function Ace2Inner(){
|
||||||
|
|
||||||
function doCreateDomLine(nonEmpty)
|
function doCreateDomLine(nonEmpty)
|
||||||
{
|
{
|
||||||
if (mybrowser.msie && (!nonEmpty))
|
if (bowser.msie && (!nonEmpty))
|
||||||
{
|
{
|
||||||
var result = {
|
var result = {
|
||||||
node: null,
|
node: null,
|
||||||
|
@ -2972,7 +2972,7 @@ function Ace2Inner(){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return domline.createDomLine(nonEmpty, doesWrap, mybrowser, doc);
|
return domline.createDomLine(nonEmpty, doesWrap, bowser, doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3239,7 +3239,7 @@ function Ace2Inner(){
|
||||||
var dirtiness = {};
|
var dirtiness = {};
|
||||||
dirtiness.nodeId = uniqueId(n);
|
dirtiness.nodeId = uniqueId(n);
|
||||||
dirtiness.knownHTML = n.innerHTML;
|
dirtiness.knownHTML = n.innerHTML;
|
||||||
if (mybrowser.msie)
|
if (bowser.msie)
|
||||||
{
|
{
|
||||||
// adding a space to an "empty" div in IE designMode doesn't
|
// adding a space to an "empty" div in IE designMode doesn't
|
||||||
// change the innerHTML of the div's parent; also, other
|
// change the innerHTML of the div's parent; also, other
|
||||||
|
@ -3256,7 +3256,7 @@ function Ace2Inner(){
|
||||||
var data = getAssoc(n, "dirtiness");
|
var data = getAssoc(n, "dirtiness");
|
||||||
if (!data) return true;
|
if (!data) return true;
|
||||||
if (n.id !== data.nodeId) return true;
|
if (n.id !== data.nodeId) return true;
|
||||||
if (mybrowser.msie)
|
if (bowser.msie)
|
||||||
{
|
{
|
||||||
if (n.innerText !== data.knownText) return true;
|
if (n.innerText !== data.knownText) return true;
|
||||||
}
|
}
|
||||||
|
@ -3591,7 +3591,7 @@ function Ace2Inner(){
|
||||||
// On Mac and Linux, move right moves to end of word and move left moves to start;
|
// On Mac and Linux, move right moves to end of word and move left moves to start;
|
||||||
// on Windows, always move to start of word.
|
// on Windows, always move to start of word.
|
||||||
// On Windows, Firefox and IE disagree on whether to stop for punctuation (FF says no).
|
// On Windows, Firefox and IE disagree on whether to stop for punctuation (FF says no).
|
||||||
if (mybrowser.msie && forwardNotBack)
|
if (bowser.msie && forwardNotBack)
|
||||||
{
|
{
|
||||||
while ((!isDone()) && isWordChar(nextChar()))
|
while ((!isDone()) && isWordChar(nextChar()))
|
||||||
{
|
{
|
||||||
|
@ -3662,13 +3662,13 @@ function Ace2Inner(){
|
||||||
if (isModKey) return;
|
if (isModKey) return;
|
||||||
|
|
||||||
// If the key is a keypress and the browser is opera and the key is enter, do nothign at all as this fires twice.
|
// If the key is a keypress and the browser is opera and the key is enter, do nothign at all as this fires twice.
|
||||||
if (keyCode == 13 && mybrowser.opera && (type == "keypress")){
|
if (keyCode == 13 && bowser.opera && (type == "keypress")){
|
||||||
return; // This stops double enters in Opera but double Tabs still show on single tab keypress, adding keyCode == 9 to this doesn't help as the event is fired twice
|
return; // This stops double enters in Opera but double Tabs still show on single tab keypress, adding keyCode == 9 to this doesn't help as the event is fired twice
|
||||||
}
|
}
|
||||||
|
|
||||||
var specialHandled = false;
|
var specialHandled = false;
|
||||||
var isTypeForSpecialKey = ((mybrowser.msie || mybrowser.safari || mybrowser.chrome) ? (type == "keydown") : (type == "keypress"));
|
var isTypeForSpecialKey = ((bowser.msie || bowser.safari || bowser.chrome) ? (type == "keydown") : (type == "keypress"));
|
||||||
var isTypeForCmdKey = (type === "keydown")
|
var isTypeForCmdKey = ((bowser.msie || bowser.safari || bowser.chrome) ? (type == "keydown") : (type == "keypress"));
|
||||||
var stopped = false;
|
var stopped = false;
|
||||||
|
|
||||||
inCallStackIfNecessary("handleKeyEvent", function()
|
inCallStackIfNecessary("handleKeyEvent", function()
|
||||||
|
@ -3884,7 +3884,7 @@ function Ace2Inner(){
|
||||||
/* Attempt to apply some sanity to cursor handling in Chrome after a copy / paste event
|
/* Attempt to apply some sanity to cursor handling in Chrome after a copy / paste event
|
||||||
We have to do this the way we do because rep. doesn't hold the value for keyheld events IE if the user
|
We have to do this the way we do because rep. doesn't hold the value for keyheld events IE if the user
|
||||||
presses and holds the arrow key .. Sorry if this is ugly, blame Chrome's weird handling of viewports after new content is added*/
|
presses and holds the arrow key .. Sorry if this is ugly, blame Chrome's weird handling of viewports after new content is added*/
|
||||||
if((evt.which == 37 || evt.which == 38 || evt.which == 39 || evt.which == 40) && mybrowser.chrome){
|
if((evt.which == 37 || evt.which == 38 || evt.which == 39 || evt.which == 40) && bowser.chrome){
|
||||||
var viewport = getViewPortTopBottom();
|
var viewport = getViewPortTopBottom();
|
||||||
var myselection = document.getSelection(); // get the current caret selection, can't use rep. here because that only gives us the start position not the current
|
var myselection = document.getSelection(); // get the current caret selection, can't use rep. here because that only gives us the start position not the current
|
||||||
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
|
||||||
|
@ -3955,10 +3955,10 @@ function Ace2Inner(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is part of multi-keystroke international character on Firefox Mac
|
// Is part of multi-keystroke international character on Firefox Mac
|
||||||
var isFirefoxHalfCharacter = (mybrowser.firefox && evt.altKey && charCode === 0 && keyCode === 0);
|
var isFirefoxHalfCharacter = (bowser.firefox && evt.altKey && charCode === 0 && keyCode === 0);
|
||||||
|
|
||||||
// Is part of multi-keystroke international character on Safari Mac
|
// Is part of multi-keystroke international character on Safari Mac
|
||||||
var isSafariHalfCharacter = (mybrowser.safari && evt.altKey && keyCode == 229);
|
var isSafariHalfCharacter = (bowser.safari && evt.altKey && keyCode == 229);
|
||||||
|
|
||||||
if (thisKeyDoesntTriggerNormalize || isFirefoxHalfCharacter || isSafariHalfCharacter)
|
if (thisKeyDoesntTriggerNormalize || isFirefoxHalfCharacter || isSafariHalfCharacter)
|
||||||
{
|
{
|
||||||
|
@ -4072,7 +4072,7 @@ function Ace2Inner(){
|
||||||
// each of which has node (a magicdom node), index, and maxIndex. If the node
|
// each of which has node (a magicdom node), index, and maxIndex. If the node
|
||||||
// is a text node, maxIndex is the length of the text; else maxIndex is 1.
|
// is a text node, maxIndex is the length of the text; else maxIndex is 1.
|
||||||
// index is between 0 and maxIndex, inclusive.
|
// index is between 0 and maxIndex, inclusive.
|
||||||
if (mybrowser.msie)
|
if (bowser.msie)
|
||||||
{
|
{
|
||||||
var browserSelection;
|
var browserSelection;
|
||||||
try
|
try
|
||||||
|
@ -4368,7 +4368,7 @@ function Ace2Inner(){
|
||||||
maxIndex: pt.maxIndex
|
maxIndex: pt.maxIndex
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (mybrowser.msie)
|
if (bowser.msie)
|
||||||
{
|
{
|
||||||
// Oddly enough, accessing scrollHeight fixes return key handling on IE 8,
|
// Oddly enough, accessing scrollHeight fixes return key handling on IE 8,
|
||||||
// presumably by forcing some kind of internal DOM update.
|
// presumably by forcing some kind of internal DOM update.
|
||||||
|
@ -4663,11 +4663,11 @@ function Ace2Inner(){
|
||||||
if (newHeight < viewHeight)
|
if (newHeight < viewHeight)
|
||||||
{
|
{
|
||||||
newHeight = viewHeight;
|
newHeight = viewHeight;
|
||||||
// if (mybrowser.msie) setIfNecessary(outerWin.document.documentElement.style, 'overflowY', 'auto');
|
// if (bowser.msie) setIfNecessary(outerWin.document.documentElement.style, 'overflowY', 'auto');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if (mybrowser.msie) setIfNecessary(outerWin.document.documentElement.style, 'overflowY', 'scroll');
|
// if (bowser.msie) setIfNecessary(outerWin.document.documentElement.style, 'overflowY', 'scroll');
|
||||||
}
|
}
|
||||||
if (doesWrap)
|
if (doesWrap)
|
||||||
{
|
{
|
||||||
|
@ -4681,7 +4681,7 @@ function Ace2Inner(){
|
||||||
setIfNecessary(iframe.style, "width", newWidth + "px");
|
setIfNecessary(iframe.style, "width", newWidth + "px");
|
||||||
setIfNecessary(sideDiv.style, "height", newHeight + "px");
|
setIfNecessary(sideDiv.style, "height", newHeight + "px");
|
||||||
}
|
}
|
||||||
if (mybrowser.firefox)
|
if (bowser.firefox)
|
||||||
{
|
{
|
||||||
if (!doesWrap)
|
if (!doesWrap)
|
||||||
{
|
{
|
||||||
|
@ -4780,14 +4780,14 @@ function Ace2Inner(){
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mybrowser.msie || mybrowser.safari)
|
if (bowser.msie || bowser.safari)
|
||||||
{
|
{
|
||||||
setIfNecessary(root, 'contentEditable', (newVal ? 'true' : 'false'));
|
setIfNecessary(root, 'contentEditable', (newVal ? 'true' : 'false'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var wasSet = setIfNecessary(doc, 'designMode', (newVal ? 'on' : 'off'));
|
var wasSet = setIfNecessary(doc, 'designMode', (newVal ? 'on' : 'off'));
|
||||||
if (wasSet && newVal && mybrowser.opera)
|
if (wasSet && newVal && bowser.opera)
|
||||||
{
|
{
|
||||||
// turning on designMode clears event handlers
|
// turning on designMode clears event handlers
|
||||||
bindTheEventHandlers();
|
bindTheEventHandlers();
|
||||||
|
@ -4853,11 +4853,11 @@ function Ace2Inner(){
|
||||||
$(document).on("keyup", handleKeyEvent);
|
$(document).on("keyup", handleKeyEvent);
|
||||||
$(document).on("click", handleClick);
|
$(document).on("click", handleClick);
|
||||||
$(root).on("blur", handleBlur);
|
$(root).on("blur", handleBlur);
|
||||||
if (mybrowser.msie)
|
if (bowser.msie)
|
||||||
{
|
{
|
||||||
$(document).on("click", handleIEOuterClick);
|
$(document).on("click", handleIEOuterClick);
|
||||||
}
|
}
|
||||||
if (mybrowser.msie) $(root).on("paste", handleIEPaste);
|
if (bowser.msie) $(root).on("paste", handleIEPaste);
|
||||||
|
|
||||||
// Don't paste on middle click of links
|
// Don't paste on middle click of links
|
||||||
$(root).on("paste", function(e){
|
$(root).on("paste", function(e){
|
||||||
|
@ -4867,7 +4867,7 @@ function Ace2Inner(){
|
||||||
})
|
})
|
||||||
|
|
||||||
// CompositionEvent is not implemented below IE version 8
|
// CompositionEvent is not implemented below IE version 8
|
||||||
if ( !(mybrowser.msie && mybrowser.version <= 9) && document.documentElement)
|
if ( !(bowser.msie && bowser.version <= 9) && document.documentElement)
|
||||||
{
|
{
|
||||||
$(document.documentElement).on("compositionstart", handleCompositionEvent);
|
$(document.documentElement).on("compositionstart", handleCompositionEvent);
|
||||||
$(document.documentElement).on("compositionend", handleCompositionEvent);
|
$(document.documentElement).on("compositionend", handleCompositionEvent);
|
||||||
|
@ -4930,7 +4930,7 @@ function Ace2Inner(){
|
||||||
|
|
||||||
function handleBlur(evt)
|
function handleBlur(evt)
|
||||||
{
|
{
|
||||||
if (mybrowser.msie)
|
if (bowser.msie)
|
||||||
{
|
{
|
||||||
// a fix: in IE, clicking on a control like a button outside the
|
// a fix: in IE, clicking on a control like a button outside the
|
||||||
// iframe can "blur" the editor, causing it to stop getting
|
// iframe can "blur" the editor, causing it to stop getting
|
||||||
|
@ -5001,7 +5001,7 @@ function Ace2Inner(){
|
||||||
var win = outerWin;
|
var win = outerWin;
|
||||||
var odoc = win.document;
|
var odoc = win.document;
|
||||||
var h;
|
var h;
|
||||||
if (mybrowser.opera) h = win.innerHeight;
|
if (bowser.opera) h = win.innerHeight;
|
||||||
else h = odoc.documentElement.clientHeight;
|
else h = odoc.documentElement.clientHeight;
|
||||||
if (h) return h;
|
if (h) return h;
|
||||||
|
|
||||||
|
@ -5330,9 +5330,9 @@ function Ace2Inner(){
|
||||||
{
|
{
|
||||||
var body = doc.getElementById("innerdocbody");
|
var body = doc.getElementById("innerdocbody");
|
||||||
root = body; // defined as a var in scope outside
|
root = body; // defined as a var in scope outside
|
||||||
if (mybrowser.firefox) $(root).addClass("mozilla");
|
if (bowser.firefox) $(root).addClass("mozilla");
|
||||||
if (mybrowser.safari) $(root).addClass("safari");
|
if (bowser.safari) $(root).addClass("safari");
|
||||||
if (mybrowser.msie) $(root).addClass("msie");
|
if (bowser.msie) $(root).addClass("msie");
|
||||||
setClassPresence(root, "authorColors", true);
|
setClassPresence(root, "authorColors", true);
|
||||||
setClassPresence(root, "doesWrap", doesWrap);
|
setClassPresence(root, "doesWrap", doesWrap);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue