fix: autoupdate

This commit is contained in:
Oleg Proskurin 2026-04-23 12:37:09 +07:00
parent 994a13da52
commit 3e36cfcb39
3 changed files with 19 additions and 3 deletions

View File

@ -13,7 +13,7 @@ module.exports = {
"tasks/index.html",
"tasks/*/index.html",
"tasks/*/docs/*.template.html",
// output.html excluded: generated by save flow, reload would wipe editor state
"tasks/*/docs/*.output.html",
"tasks/*/editor.html",
"assets/**/*",
"public/**/*"

View File

@ -59,6 +59,10 @@ window.EditorCore = (function () {
_wireButton('btn-reset', () => opts.onReset(_currentPage + 1));
}
// Disconnect browser-sync to prevent auto-reload.
// Editors maintain DOM state — reload would wipe unsaved changes.
_disconnectBrowserSync();
// Load worksheet, then optionally load data.json
_loadWorksheet(_config.filePath, opts.onReady, opts.onDataLoaded);
@ -240,6 +244,18 @@ window.EditorCore = (function () {
// ---- Helpers ----
function _disconnectBrowserSync() {
function tryDisconnect() {
if (window.___browserSync___) {
window.___browserSync___.socket.close();
}
}
// Browser-sync client may connect after our script runs
tryDisconnect();
setTimeout(tryDisconnect, 500);
setTimeout(tryDisconnect, 2000);
}
function _wireButton(id, handler) {
const btn = document.getElementById(id);
if (btn) btn.addEventListener('click', handler);

View File

@ -5,7 +5,7 @@
"sections": [
{
"index": 0,
"scale": 1.15,
"scale": 1.25,
"rotate": 0
},
{
@ -35,7 +35,7 @@
},
{
"index": 2,
"scale": 0.85,
"scale": 0.65,
"rotate": 0
}
]