feat: standalone save/load routing + VITE_DOC_SOURCE ydoc mode

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Gergő Törcsvári 2026-06-12 10:16:02 +02:00
commit 8131bf9bac
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
19 changed files with 735 additions and 62 deletions

View file

@ -1016,6 +1016,19 @@ std::string kicadCollabSnapshotItems()
// Serializes exactly what the editor has loaded via the same writer eeschema/pcbnew
// use, so a test can read the file back from MEMFS and assert the file ⇄ Y.Doc
// round trip (README §A; feature 0004). Uses only public PCB_IO_KICAD_SEXPR API.
// C++ → JS save notification (standalone-hardening save routing). Called from the
// kicad fork's save chokepoint (PCB_EDIT_FRAME::SavePcbFile) after a successful
// write to MEMFS, so the web app can route the saved bytes onward (API upload,
// local-disk write-back, download). No-op without a JS listener.
extern "C" void kicadCollabOnSave( const char* aPath )
{
EM_ASM( {
if( window.kicadCollab && window.kicadCollab.onSave )
window.kicadCollab.onSave( UTF8ToString( $0 ) );
}, aPath );
}
void kicadSaveBoard( std::string path )
{
PCB_EDIT_FRAME* fr = pcbFrame();