@@ -120,7 +120,34 @@ export abstract class UmbRteBaseElement extends UmbLitElement implements UmbProp
120
120
'observePropertyAlias' ,
121
121
) ;
122
122
123
- this . observe (
123
+ this . observe ( this . #entriesContext. layoutEntries , ( layouts ) => {
124
+ // Update manager:
125
+ this . #managerContext. setLayouts ( layouts ) ;
126
+ } ) ;
127
+
128
+ // Observe the value of the property and update the editor value.
129
+ this . observe ( this . #managerContext. layouts , ( layouts ) => {
130
+ this . _value = {
131
+ ...this . _value ,
132
+ blocks : { ...this . _value . blocks , layout : { [ UMB_BLOCK_RTE_PROPERTY_EDITOR_SCHEMA_ALIAS ] : layouts } } ,
133
+ } ;
134
+ this . _fireChangeEvent ( ) ;
135
+ } ) ;
136
+ this . observe ( this . #managerContext. contents , ( contents ) => {
137
+ this . _value = { ...this . _value , blocks : { ...this . _value . blocks , contentData : contents } } ;
138
+ this . _fireChangeEvent ( ) ;
139
+ } ) ;
140
+ this . observe ( this . #managerContext. settings , ( settings ) => {
141
+ this . _value = { ...this . _value , blocks : { ...this . _value . blocks , settingsData : settings } } ;
142
+ this . _fireChangeEvent ( ) ;
143
+ } ) ;
144
+ this . observe ( this . #managerContext. exposes , ( exposes ) => {
145
+ this . _value = { ...this . _value , blocks : { ...this . _value . blocks , expose : exposes } } ;
146
+ this . _fireChangeEvent ( ) ;
147
+ } ) ;
148
+
149
+ // The above could potentially be replaced with a single observeMultiple call, but it is not done for now to avoid potential issues with the order of the updates.
150
+ /*this.observe(
124
151
observeMultiple([
125
152
this.#managerContext.layouts,
126
153
this.#managerContext.contents,
@@ -141,7 +168,7 @@ export abstract class UmbRteBaseElement extends UmbLitElement implements UmbProp
141
168
this._fireChangeEvent();
142
169
},
143
170
'motherObserver',
144
- ) ;
171
+ );*/
145
172
} ) ;
146
173
this . consumeContext ( UMB_PROPERTY_DATASET_CONTEXT , ( context ) => {
147
174
this . #managerContext. setVariantId ( context . getVariantId ( ) ) ;
@@ -154,6 +181,10 @@ export abstract class UmbRteBaseElement extends UmbLitElement implements UmbProp
154
181
}
155
182
156
183
protected _filterUnusedBlocks ( usedContentKeys : ( string | null ) [ ] ) {
184
+ const unusedBlockContents = this . #managerContext. getContents ( ) . filter ( ( x ) => usedContentKeys . indexOf ( x . key ) === - 1 ) ;
185
+ unusedBlockContents . forEach ( ( blockContent ) => {
186
+ this . #managerContext. removeOneContent ( blockContent . key ) ;
187
+ } ) ;
157
188
const unusedBlocks = this . #managerContext. getLayouts ( ) . filter ( ( x ) => usedContentKeys . indexOf ( x . contentKey ) === - 1 ) ;
158
189
unusedBlocks . forEach ( ( blockLayout ) => {
159
190
this . #managerContext. removeOneLayout ( blockLayout . contentKey ) ;
0 commit comments