File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,17 @@ export class InsertionMarkerPreviewer implements IConnectionPreviewer {
150150 return markerConn ;
151151 }
152152
153- private createInsertionMarker ( origBlock : BlockSvg ) {
154- const blockJson = blocks . save ( origBlock , {
153+ /**
154+ * Transforms the given block into a JSON representation used to construct an
155+ * insertion marker.
156+ *
157+ * @param block The block to serialize and use as an insertion marker.
158+ * @returns A JSON-formatted string corresponding to a serialized
159+ * representation of the given block suitable for use as an insertion
160+ * marker.
161+ */
162+ protected serializeBlockToInsertionMarker ( block : BlockSvg ) {
163+ const blockJson = blocks . save ( block , {
155164 addCoordinates : false ,
156165 addInputBlocks : false ,
157166 addNextBlocks : false ,
@@ -160,10 +169,15 @@ export class InsertionMarkerPreviewer implements IConnectionPreviewer {
160169
161170 if ( ! blockJson ) {
162171 throw new Error (
163- `Failed to serialize source block. ${ origBlock . toDevString ( ) } ` ,
172+ `Failed to serialize source block. ${ block . toDevString ( ) } ` ,
164173 ) ;
165174 }
166175
176+ return blockJson ;
177+ }
178+
179+ private createInsertionMarker ( origBlock : BlockSvg ) {
180+ const blockJson = this . serializeBlockToInsertionMarker ( origBlock ) ;
167181 const result = blocks . append ( blockJson , this . workspace ) as BlockSvg ;
168182
169183 // Turn shadow blocks that are created programmatically during
You can’t perform that action at this time.
0 commit comments