fix(editor): surface ref find element error (#9508)

This commit is contained in:
Saul-Mirone
2025-01-03 09:55:00 +00:00
parent 51b109ee53
commit ee5f13cd03

View File

@@ -341,7 +341,7 @@ export class SurfaceRefBlockComponent extends BlockComponent<SurfaceRefBlockMode
.find( .find(
doc => doc =>
doc.getBlock(this.model.reference) || doc.getBlock(this.model.reference) ||
getSurfaceBlock(doc)!.getElementById(this.model.reference) getSurfaceBlock(doc)?.getElementById(this.model.reference)
); );
if (doc) { if (doc) {
@@ -355,11 +355,11 @@ export class SurfaceRefBlockComponent extends BlockComponent<SurfaceRefBlockMode
]; ];
} }
if (doc && getSurfaceBlock(doc)) { if (doc) {
return [ const surfaceBlock = getSurfaceBlock(doc);
getSurfaceBlock(doc)!.getElementById(this.model.reference), if (surfaceBlock) {
doc.id, return [surfaceBlock.getElementById(this.model.reference), doc.id];
]; }
} }
return [null, this.doc.id]; return [null, this.doc.id];