@@ -14,7 +14,6 @@ type ContentEmbed = {
1414
1515export class ContentEmbedManager < Root extends Form | Show > {
1616 embeds : { [ embedKey :string ] : EmbedData } = { } ;
17- onEmbedsUpdated : Root extends Form ? ( embeds : FormEditorFieldData [ 'value' ] [ 'embeds' ] ) => any : null
1817 root : Form | Show ;
1918
2019 state = reactive < {
@@ -81,23 +80,21 @@ export class ContentEmbedManager<Root extends Form | Show> {
8180 return id ;
8281 }
8382
84- syncEmbeds ( embed : EmbedData , locale : string | null , nodes : { id ?:string } [ ] ) {
85- if ( this . contentEmbeds [ embed . key ] ) {
86- this . contentEmbeds [ embed . key ] = {
87- ...Object . fromEntries (
88- Object . entries ( this . contentEmbeds [ embed . key ] )
89- . map ( ( [ id , contentEmbed ] ) => [
90- id ,
91- ( {
92- ...contentEmbed ,
93- removed : contentEmbed . value ?. _locale == locale
94- ? ! nodes . some ( node => String ( node . id ) === id )
95- : contentEmbed . removed ,
96- } )
97- ] )
98- ) ,
99- } ;
100- }
83+ syncEmbeds ( embed : EmbedData , locale : string | null , ids : ( string | number ) [ ] ) {
84+ this . contentEmbeds [ embed . key ] = {
85+ ...Object . fromEntries (
86+ Object . entries ( this . contentEmbeds [ embed . key ] ?? { } )
87+ . map ( ( [ id , contentEmbed ] ) => [
88+ id ,
89+ ( {
90+ ...contentEmbed ,
91+ removed : contentEmbed . value ?. _locale == locale
92+ ? ! ids . some ( i => String ( i ) === id )
93+ : contentEmbed . removed ,
94+ } )
95+ ] )
96+ ) ,
97+ } ;
10198 }
10299
103100 postResolveForm ( id : string , embed : EmbedData ) : Promise < FormData > {
@@ -134,8 +131,6 @@ export class ContentEmbedManager<Root extends Form | Show> {
134131 } ,
135132 }
136133
137- this . onEmbedsUpdated ( this . serializedEmbeds ) ;
138-
139134 return {
140135 id
141136 } ;
0 commit comments