Fixed path issues in pad bootstrap

This commit is contained in:
SamTv12345 2024-07-23 11:47:44 +02:00
parent 8a1a03eca1
commit a2ad4b1975

View file

@ -1,7 +1,7 @@
(async () => { (async () => {
require('../../src/static/js/l10n') require('ep_etherpad-lite/static/js/l10n')
window.clientVars = { window.clientVars = {
// This is needed to fetch /pluginfw/plugin-definitions.json, which happens before the server // This is needed to fetch /pluginfw/plugin-definitions.json, which happens before the server
@ -13,20 +13,20 @@
//window.require.resolveTmp = require.resolve('ep_etherpad-lite/static/js/pad_cookie'); //window.require.resolveTmp = require.resolve('ep_etherpad-lite/static/js/pad_cookie');
const basePath = new URL('..', window.location.href).pathname; const basePath = new URL('..', window.location.href).pathname;
window.$ = window.jQuery = require('../../src/static/js/rjquery').jQuery; window.$ = window.jQuery = require('ep_etherpad-lite/static/js/rjquery').jQuery;
window.browser = require('../../src/static/js/vendors/browser'); window.browser = require('ep_etherpad-lite/static/js/vendors/browser');
const pad = require('../../src/static/js/pad'); const pad = require('ep_etherpad-lite/static/js/pad');
pad.baseURL = basePath; pad.baseURL = basePath;
window.plugins = require('../../src/static/js/pluginfw/client_plugins'); window.plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
const hooks = require('../../src/static/js/pluginfw/hooks'); const hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
// TODO: These globals shouldn't exist. // TODO: These globals shouldn't exist.
window.pad = pad.pad; window.pad = pad.pad;
window.chat = require('../../src/static/js/chat').chat; window.chat = require('ep_etherpad-lite/static/js/chat').chat;
window.padeditbar = require('../../src/static/js/pad_editbar').padeditbar; window.padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar;
window.padimpexp = require('../../src/static/js/pad_impexp').padimpexp; window.padimpexp = require('ep_etherpad-lite/static/js/pad_impexp').padimpexp;
require('../../src/static/js/skin_variants'); require('ep_etherpad-lite/static/js/skin_variants');
require('../../src/static/js/basic_error_handler') require('ep_etherpad-lite/static/js/basic_error_handler')
window.plugins.baseURL = basePath; window.plugins.baseURL = basePath;
await window.plugins.update(new Map([ await window.plugins.update(new Map([
@ -38,7 +38,7 @@
window._postPluginUpdateForTestingDone = false; window._postPluginUpdateForTestingDone = false;
if (window._postPluginUpdateForTesting != null) window._postPluginUpdateForTesting(); if (window._postPluginUpdateForTesting != null) window._postPluginUpdateForTesting();
window._postPluginUpdateForTestingDone = true; window._postPluginUpdateForTestingDone = true;
window.pluginDefs = require('../../src/static/js/pluginfw/plugin_defs'); window.pluginDefs = require('ep_etherpad-lite/static/js/pluginfw/plugin_defs');
pad.init(); pad.init();
await new Promise((resolve) => $(resolve)); await new Promise((resolve) => $(resolve));
await hooks.aCallAll('documentReady'); await hooks.aCallAll('documentReady');