Skip to content

Commit 9883e3a

Browse files
authored
Merge pull request #1095 from vorth/online-redos
Legacy history now synced with target editNumber for online
2 parents 3bcce87 + fc63408 commit 9883e3a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

online/src/worker/legacy/controllers/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,15 @@ const initializeDesign = ( loading, polygons, legacyDesign, core, clientEvents )
7575
// polygons is a configuration from the client, to distinguish between a modern client
7676
// and the legacy React-based interpreter/debugger UI. They require different shape encodings.
7777

78-
const { lighting, camera, scenes, snapshotNodes } = legacyDesign;
78+
const { lighting, camera, scenes, snapshotNodes, history, targetEdit } = legacyDesign;
7979
const renderHistory = new RenderHistory( legacyDesign, polygons ); // used for all normal rendering
8080
const interpreter = new Interpreter( legacyDesign, renderHistory );
8181
const renderingChanges = renderedModelTransducer( renderHistory.getShapes(), clientEvents ); // used only for preview struts
8282

8383
if ( loading ) {
8484
// interpretation may take several seconds, which is why we already reported PARSE_COMPLETED
8585
interpreter .interpret( Step.DONE );
86+
history .goToEdit( targetEdit )
8687
} // else in debug mode, we'll interpret incrementally
8788

8889
// TODO: define a better contract for before/after.

online/src/worker/legacy/parser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ export const createParser = ( documentFactory ) => ( xmlText ) =>
131131
const historyElement = vZomeRoot.getChildElement( "EditHistory" ) || vZomeRoot.getChildElement( "editHistory" ) || vZomeRoot.getChildElement( "EditHistoryDetails" );
132132
const xmlTree = assignIds( historyElement.nativeElement );
133133
const edits = new ParsedEdit( xmlTree, null, legacyDesign.interpretEdit );
134-
const targetEditId = `:${edits.getAttribute( "editNumber" )}:`
134+
const targetEdit = Number( edits.getAttribute( "editNumber" ) );
135+
const targetEditId = `:${targetEdit}:`
135136
const firstEdit = edits.firstChild()
136137

137138
const snapshotNodes = [ ...findSnapshotNodes( xmlTree ), targetEditId ]; // The extra snapshot is discarded later
138139
const scenes = parseArticle( vZomeRoot.getChildElement( "notes" ) );
139140

140-
return { ...legacyDesign, firstEdit, camera, lighting, xmlTree, scenes, snapshotNodes }
141+
return { ...legacyDesign, firstEdit, camera, lighting, xmlTree, scenes, snapshotNodes, targetEdit }
141142
}

0 commit comments

Comments
 (0)