Merge branch 'main' of https://github.com/Bubobubobubobubo/Topos
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -42,4 +42,5 @@ yarn.lock
|
|||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
.vs
|
.vs
|
||||||
|
dev-dist/**/*
|
||||||
@ -36,6 +36,22 @@ if (!self.define) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
.then(() => {
|
||||||
|
return registry[uri] || (
|
||||||
|
|
||||||
|
new Promise(resolve => {
|
||||||
|
if ("document" in self) {
|
||||||
|
const script = document.createElement("script");
|
||||||
|
script.src = uri;
|
||||||
|
script.onload = resolve;
|
||||||
|
document.head.appendChild(script);
|
||||||
|
} else {
|
||||||
|
nextDefineUri = uri;
|
||||||
|
importScripts(uri);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let promise = registry[uri];
|
let promise = registry[uri];
|
||||||
if (!promise) {
|
if (!promise) {
|
||||||
@ -54,11 +70,15 @@ if (!self.define) {
|
|||||||
}
|
}
|
||||||
let exports = {};
|
let exports = {};
|
||||||
const require = depUri => singleRequire(depUri, uri);
|
const require = depUri => singleRequire(depUri, uri);
|
||||||
|
const require = depUri => singleRequire(depUri, uri);
|
||||||
const specialDeps = {
|
const specialDeps = {
|
||||||
module: { uri },
|
module: { uri },
|
||||||
exports,
|
exports,
|
||||||
require
|
require
|
||||||
};
|
};
|
||||||
|
registry[uri] = Promise.all(depsNames.map(
|
||||||
|
depName => specialDeps[depName] || require(depName)
|
||||||
|
)).then(deps => {
|
||||||
registry[uri] = Promise.all(depsNames.map(
|
registry[uri] = Promise.all(depsNames.map(
|
||||||
depName => specialDeps[depName] || require(depName)
|
depName => specialDeps[depName] || require(depName)
|
||||||
)).then(deps => {
|
)).then(deps => {
|
||||||
@ -67,6 +87,7 @@ if (!self.define) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
define(['./workbox-b7fccfec'], (function (workbox) { 'use strict';
|
||||||
define(['./workbox-b7fccfec'], (function (workbox) { 'use strict';
|
define(['./workbox-b7fccfec'], (function (workbox) { 'use strict';
|
||||||
|
|
||||||
self.skipWaiting();
|
self.skipWaiting();
|
||||||
@ -100,5 +121,21 @@ define(['./workbox-b7fccfec'], (function (workbox) { 'use strict';
|
|||||||
})]
|
})]
|
||||||
}), 'GET');
|
}), 'GET');
|
||||||
|
|
||||||
|
}));
|
||||||
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
allowlist: [/^\/$/]
|
||||||
|
}));
|
||||||
|
workbox.registerRoute(({
|
||||||
|
url
|
||||||
|
}) => [/^https:\/\/raw\.githubusercontent\.com\/.*/i, /^https:\/\/shabda\.ndre\.gr\/.*/i].some(regex => regex.test(url)), new workbox.CacheFirst({
|
||||||
|
"cacheName": "external-samples",
|
||||||
|
plugins: [new workbox.ExpirationPlugin({
|
||||||
|
maxEntries: 5000,
|
||||||
|
maxAgeSeconds: 2592000
|
||||||
|
}), new workbox.CacheableResponsePlugin({
|
||||||
|
statuses: [0, 200]
|
||||||
|
})]
|
||||||
|
}), 'GET');
|
||||||
|
|
||||||
}));
|
}));
|
||||||
//# sourceMappingURL=sw.js.map
|
//# sourceMappingURL=sw.js.map
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -17,8 +17,6 @@ const handleResize = (canvas: HTMLCanvasElement) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const saveBeforeExit = (app: Editor): null => {
|
export const saveBeforeExit = (app: Editor): null => {
|
||||||
// @ts-ignore
|
|
||||||
event.preventDefault();
|
|
||||||
// Iterate over all local files and set the candidate to the committed
|
// Iterate over all local files and set the candidate to the committed
|
||||||
app.currentFile().candidate = app.view.state.doc.toString();
|
app.currentFile().candidate = app.view.state.doc.toString();
|
||||||
app.currentFile().committed = app.view.state.doc.toString();
|
app.currentFile().committed = app.view.state.doc.toString();
|
||||||
@ -38,10 +36,12 @@ export const installWindowBehaviors = (
|
|||||||
window.addEventListener("resize", () =>
|
window.addEventListener("resize", () =>
|
||||||
handleResize(app.interface.feedback as HTMLCanvasElement)
|
handleResize(app.interface.feedback as HTMLCanvasElement)
|
||||||
);
|
);
|
||||||
window.addEventListener("beforeunload", () => {
|
window.addEventListener("beforeunload", (event) => {
|
||||||
|
event.preventDefault()
|
||||||
saveBeforeExit(app)
|
saveBeforeExit(app)
|
||||||
});
|
});
|
||||||
window.addEventListener("visibilitychange", () => {
|
window.addEventListener("visibilitychange", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
saveBeforeExit(app)
|
saveBeforeExit(app)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const vitePWAconfiguration = {
|
|||||||
workbox: {
|
workbox: {
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
cleanupOutdatedCaches: true,
|
cleanupOutdatedCaches: true,
|
||||||
globPatterns: ["**/*.{js,css,html,json,ogg,wav,mp3,ico,png,svg}"],
|
globPatterns: ["**/*.{js,css,html,gif,png,json,woff,json,ogg,wav,mp3,ico,png,svg}"],
|
||||||
// Thanks Froos :)
|
// Thanks Froos :)
|
||||||
runtimeCaching: [
|
runtimeCaching: [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user