fix opera by recreating a scheduler object
This commit is contained in:
parent
af022c8427
commit
a93ff37879
|
@ -154,17 +154,22 @@ function Ace2Inner(){
|
||||||
var dmesg = noop;
|
var dmesg = noop;
|
||||||
window.dmesg = noop;
|
window.dmesg = noop;
|
||||||
|
|
||||||
|
|
||||||
|
var scheduler = parent; // hack for opera required
|
||||||
|
|
||||||
// Ugly hack for Firefox 18
|
// Ugly hack for Firefox 18
|
||||||
// get the timeout and interval methods from the parent iframe
|
// get the timeout and interval methods from the parent iframe
|
||||||
// This hack breaks IE8
|
// This hack breaks IE8 so be careful
|
||||||
|
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){
|
||||||
try{
|
try{
|
||||||
setTimeout = parent.setTimeout;
|
setTimeout = scheduler.setTimeout;
|
||||||
clearTimeout = parent.clearTimeout;
|
clearTimeout = scheduler.clearTimeout;
|
||||||
setInterval = parent.setInterval;
|
setInterval = scheduler.setInterval;
|
||||||
clearInterval = parent.clearInterval;
|
clearInterval = scheduler.clearInterval;
|
||||||
}catch(err){
|
}catch(err){
|
||||||
// IE8 can panic here.
|
// IE8 can panic here.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var textFace = 'monospace';
|
var textFace = 'monospace';
|
||||||
var textSize = 12;
|
var textSize = 12;
|
||||||
|
@ -184,7 +189,7 @@ function Ace2Inner(){
|
||||||
parentDynamicCSS = makeCSSManager("dynamicsyntax", true);
|
parentDynamicCSS = makeCSSManager("dynamicsyntax", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var changesetTracker = makeChangesetTracker(rep.apool, {
|
var changesetTracker = makeChangesetTracker(scheduler, rep.apool, {
|
||||||
withCallbacks: function(operationName, f)
|
withCallbacks: function(operationName, f)
|
||||||
{
|
{
|
||||||
inCallStackIfNecessary(operationName, function()
|
inCallStackIfNecessary(operationName, function()
|
||||||
|
@ -604,7 +609,7 @@ function Ace2Inner(){
|
||||||
doesWrap = newVal;
|
doesWrap = newVal;
|
||||||
var dwClass = "doesWrap";
|
var dwClass = "doesWrap";
|
||||||
setClassPresence(root, "doesWrap", doesWrap);
|
setClassPresence(root, "doesWrap", doesWrap);
|
||||||
setTimeout(function()
|
scheduler.setTimeout(function()
|
||||||
{
|
{
|
||||||
inCallStackIfNecessary("setWraps", function()
|
inCallStackIfNecessary("setWraps", function()
|
||||||
{
|
{
|
||||||
|
@ -644,7 +649,7 @@ function Ace2Inner(){
|
||||||
textFace = face;
|
textFace = face;
|
||||||
root.style.fontFamily = textFace;
|
root.style.fontFamily = textFace;
|
||||||
lineMetricsDiv.style.fontFamily = textFace;
|
lineMetricsDiv.style.fontFamily = textFace;
|
||||||
setTimeout(function()
|
scheduler.setTimeout(function()
|
||||||
{
|
{
|
||||||
setUpTrackingCSS();
|
setUpTrackingCSS();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
@ -657,7 +662,7 @@ function Ace2Inner(){
|
||||||
root.style.lineHeight = textLineHeight() + "px";
|
root.style.lineHeight = textLineHeight() + "px";
|
||||||
sideDiv.style.lineHeight = textLineHeight() + "px";
|
sideDiv.style.lineHeight = textLineHeight() + "px";
|
||||||
lineMetricsDiv.style.fontSize = textSize + "px";
|
lineMetricsDiv.style.fontSize = textSize + "px";
|
||||||
setTimeout(function()
|
scheduler.setTimeout(function()
|
||||||
{
|
{
|
||||||
setUpTrackingCSS();
|
setUpTrackingCSS();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
@ -1106,7 +1111,7 @@ function Ace2Inner(){
|
||||||
scheduledTime = time;
|
scheduledTime = time;
|
||||||
var delay = time - now();
|
var delay = time - now();
|
||||||
if (delay < 0) delay = 0;
|
if (delay < 0) delay = 0;
|
||||||
scheduledTimeout = setTimeout(callback, delay);
|
scheduledTimeout = scheduler.setTimeout(callback, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
function callback()
|
function callback()
|
||||||
|
@ -3623,7 +3628,7 @@ function Ace2Inner(){
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
doReturnKey();
|
doReturnKey();
|
||||||
//scrollSelectionIntoView();
|
//scrollSelectionIntoView();
|
||||||
setTimeout(function()
|
scheduler.setTimeout(function()
|
||||||
{
|
{
|
||||||
outerWin.scrollBy(-100, 0);
|
outerWin.scrollBy(-100, 0);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
@ -3709,7 +3714,7 @@ function Ace2Inner(){
|
||||||
var isPageDown = evt.which === 34;
|
var isPageDown = evt.which === 34;
|
||||||
var isPageUp = evt.which === 33;
|
var isPageUp = evt.which === 33;
|
||||||
|
|
||||||
setTimeout(function(){
|
scheduler.setTimeout(function(){
|
||||||
var newVisibleLineRange = getVisibleLineRange();
|
var newVisibleLineRange = getVisibleLineRange();
|
||||||
var linesCount = rep.lines.length();
|
var linesCount = rep.lines.length();
|
||||||
|
|
||||||
|
@ -4766,7 +4771,7 @@ function Ace2Inner(){
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function()
|
scheduler.setTimeout(function()
|
||||||
{
|
{
|
||||||
parent.readyFunc(); // defined in code that sets up the inner iframe
|
parent.readyFunc(); // defined in code that sets up the inner iframe
|
||||||
}, 0);
|
}, 0);
|
||||||
|
@ -5214,7 +5219,7 @@ function Ace2Inner(){
|
||||||
documentAttributeManager: documentAttributeManager
|
documentAttributeManager: documentAttributeManager
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function()
|
scheduler.setTimeout(function()
|
||||||
{
|
{
|
||||||
parent.readyFunc(); // defined in code that sets up the inner iframe
|
parent.readyFunc(); // defined in code that sets up the inner iframe
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
var AttributePool = require('./AttributePool');
|
var AttributePool = require('./AttributePool');
|
||||||
var Changeset = require('./Changeset');
|
var Changeset = require('./Changeset');
|
||||||
|
|
||||||
function makeChangesetTracker(apool, aceCallbacksProvider)
|
function makeChangesetTracker(scheduler, apool, aceCallbacksProvider)
|
||||||
{
|
{
|
||||||
|
|
||||||
// latest official text from server
|
// latest official text from server
|
||||||
|
|
Loading…
Reference in New Issue