mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-05-12 15:56:16 +02:00
Convert require to import: timeslider (dynamic), vendors/jquery
- Convert dynamic requires to dynamic imports for circular dependency handling - Make timeslider.init async to support dynamic imports - Update exports references to use module scope or window - Add ESM export default for jquery library - Keep CommonJS compatibility for jquery Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
f95e38eba6
commit
50bf17c977
@ -88,7 +88,7 @@ const init = () => {
|
||||
Cookies.set(`${cp}token`, token, {expires: 60});
|
||||
}
|
||||
|
||||
socket = socketio.connect(exports.baseURL, '/', {query: {padId}});
|
||||
socket = socketio.connect(baseURL, '/', {query: {padId}});
|
||||
|
||||
// send the ready message once we're connected
|
||||
socket.on('connect', () => {
|
||||
@ -120,8 +120,8 @@ const init = () => {
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
exports.socket = socket; // make the socket available
|
||||
exports.BroadcastSlider = BroadcastSlider; // Make the slider available
|
||||
window.socket = socket; // make the socket available
|
||||
window.BroadcastSlider = BroadcastSlider; // Make the slider available
|
||||
|
||||
hooks.aCallAll('postTimesliderInit');
|
||||
});
|
||||
@ -141,7 +141,7 @@ const sendSocketMsg = (type, data) => {
|
||||
|
||||
const fireWhenAllScriptsAreLoaded = [];
|
||||
|
||||
const handleClientVars = (message) => {
|
||||
const handleClientVars = async (message) => {
|
||||
// save the client Vars
|
||||
window.clientVars = message.data;
|
||||
cp = (window as any).clientVars?.cookiePrefix || '';
|
||||
@ -160,16 +160,14 @@ const handleClientVars = (message) => {
|
||||
})
|
||||
}
|
||||
|
||||
// load all script that doesn't work without the clientVars
|
||||
BroadcastSlider = require('./broadcast_slider')
|
||||
.loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded);
|
||||
// load all script that doesn't work without the clientVars
|
||||
BroadcastSlider = (await import('./broadcast_slider.js')).loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded);
|
||||
|
||||
require('./broadcast_revisions').loadBroadcastRevisionsJS();
|
||||
changesetLoader = require('./broadcast')
|
||||
.loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, BroadcastSlider);
|
||||
(await import('./broadcast_revisions.js')).loadBroadcastRevisionsJS();
|
||||
changesetLoader = (await import('./broadcast.js')).loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, BroadcastSlider);
|
||||
|
||||
// initialize export ui
|
||||
require('./pad_impexp').padimpexp.init();
|
||||
// initialize export ui
|
||||
(await import('./pad_impexp.js')).padimpexp.init();
|
||||
|
||||
// Create a base URI used for timeslider exports
|
||||
const baseURI = document.location.pathname;
|
||||
|
||||
2
src/static/js/vendors/jquery.ts
vendored
2
src/static/js/vendors/jquery.ts
vendored
@ -10711,3 +10711,5 @@
|
||||
}
|
||||
return jQuery;
|
||||
} );
|
||||
|
||||
export default (typeof window !== "undefined" && typeof window.$ === "object" ? window.$ : null);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user