mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
cssmanager: Refactor CSS manager creation to avoid race condition
Safari takes a while to initialize `document.styleSheets`, which results in a race condition when loading the pad. Avoid the race condition by accessing the CSSStyleSheet objects directly from the HTMLStyleElement DOM objects.
This commit is contained in:
parent
e2bfe2fd10
commit
3ad1d0a74f
5 changed files with 20 additions and 60 deletions
|
@ -25,6 +25,7 @@
|
|||
// requires: undefined
|
||||
|
||||
const hooks = require('./pluginfw/hooks');
|
||||
const makeCSSManager = require('./cssmanager').makeCSSManager;
|
||||
const pluginUtils = require('./pluginfw/shared');
|
||||
|
||||
const debugLog = (...args) => {};
|
||||
|
@ -307,7 +308,11 @@ const Ace2Editor = function () {
|
|||
await new Promise((resolve, reject) => innerWindow.plugins.ensure(
|
||||
(err) => err != null ? reject(err) : resolve()));
|
||||
debugLog('Ace2Editor.init() waiting for Ace2Inner.init()');
|
||||
await innerWindow.Ace2Inner.init(info);
|
||||
await innerWindow.Ace2Inner.init(info, {
|
||||
inner: makeCSSManager(innerStyle.sheet),
|
||||
outer: makeCSSManager(outerStyle.sheet),
|
||||
parent: makeCSSManager(document.querySelector('style[title="dynamicsyntax"]').sheet),
|
||||
});
|
||||
debugLog('Ace2Editor.init() Ace2Inner.init() returned');
|
||||
loaded = true;
|
||||
doActionsPendingInit();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue