@@ -76,7 +76,13 @@ export default class MicroPanelEditorEntry extends LitElement {
7676 < header class ="bar ">
7777 < label > ${ propname } </ label >
7878 < button on-click =${ _ =>
79- this . _modify ( entry , draft => delete draft . properties [ propname ] )
79+ this . _modify ( entry , draft => {
80+ delete draft . properties [ propname ]
81+ if ( ! ( 'x-micro-panel-deleted-properties' in draft ) ) {
82+ draft [ 'x-micro-panel-deleted-properties' ] = [ ]
83+ }
84+ draft [ 'x-micro-panel-deleted-properties' ] . push ( propname )
85+ } )
8086 } title ="Delete this property" class="icon-button"> ${ iconCode ( icons . minus ) } </ button >
8187 < button on-click =${ _ => {
8288 this . openJsonEditors = produce ( openJsonEditors , x => { x [ propname ] = ! ( x [ propname ] || false ) } )
@@ -161,8 +167,14 @@ export default class MicroPanelEditorEntry extends LitElement {
161167 }
162168 const inp = this . shadowRoot . getElementById ( 'new-prop-inp' )
163169 const propName = inp . value
164- this . _modify ( entry , draft =>
165- propName . length > 0 && ! ( propName in draft . properties ) && ( draft . properties [ propName ] = [ '' ] ) )
170+ this . _modify ( entry , draft => {
171+ if ( propName . length > 0 && ! ( propName in draft . properties ) ) {
172+ draft . properties [ propName ] = [ '' ]
173+ if ( 'x-micro-panel-deleted-properties' in draft ) {
174+ draft [ 'x-micro-panel-deleted-properties' ] = draft [ 'x-micro-panel-deleted-properties' ] . filter ( x => x !== propName )
175+ }
176+ }
177+ } )
166178 inp . value = ''
167179 }
168180
0 commit comments