11import { MarkdownRenderChild , TFile } from 'obsidian' ;
22import MetaBindPlugin from './main' ;
3- import { Logger } from './utils/Logger' ;
43import { AbstractInputField } from './inputFields/AbstractInputField' ;
54import { InputFieldFactory } from './inputFields/InputFieldFactory' ;
65import { InputFieldArgumentType , InputFieldDeclaration , InputFieldDeclarationParser } from './parsers/InputFieldDeclarationParser' ;
@@ -118,12 +117,14 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
118117 // use this interval to reduce writing operations
119118 async applyValueUpdateQueues ( ) : Promise < void > {
120119 if ( this . metadataValueUpdateQueue . length !== 0 ) {
120+ console . debug ( `meta-bind | applying to metadataUpdateQueue to field ${ this . uid } ` ) ;
121121 await this . applyMetadataValueUpdateQueue ( ) ;
122122 this . cleanUpUpdateQueues ( ) ;
123123 return ;
124124 }
125125
126126 if ( this . inputFieldValueUpdateQueue . length !== 0 ) {
127+ console . debug ( `meta-bind | applying to inputFieldValueUpdateQueue to field ${ this . uid } ` ) ;
127128 await this . applyInputFieldValueUpdateQueue ( ) ;
128129 this . cleanUpUpdateQueues ( ) ;
129130 return ;
@@ -163,7 +164,6 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
163164 value = this . inputField . getDefaultValue ( ) ;
164165 }
165166
166- Logger . logDebug ( `updating input field ${ this . uid } to` , value ) ;
167167 this . inputField . setValue ( value ) ;
168168 } else {
169169 throw new MetaBindInternalError ( `cannot apply inputFieldValueUpdateQueue to inputField ${ this . uid } , inputFieldValueUpdateQueue is empty` ) ;
@@ -177,19 +177,23 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
177177
178178 pushToMetadataValueUpdateQueue ( value : any ) : void {
179179 if ( this . inputFieldDeclaration ?. isBound ) {
180+ console . debug ( `meta-bind | pushed value ${ value } (typeof ${ typeof value } ) to metadataUpdateQueue on field ${ this . uid } ` ) ;
180181 this . metadataValueUpdateQueue . push ( value ) ;
181182 }
182183 }
183184
184185 pushToInputFieldValueUpdateQueue ( value : any ) : void {
185186 if ( ! this . inputField ?. isEqualValue ( value ) ) {
187+ console . debug ( `meta-bind | pushed value ${ value } (typeof ${ typeof value } ) to inputFieldValueUpdateQueue on field ${ this . uid } ` ) ;
186188 this . inputFieldValueUpdateQueue . push ( value ) ;
187189 }
188190 }
189191
190192 getInitialValue ( ) : any | undefined {
191193 if ( this . inputFieldDeclaration ?. isBound && this . bindTargetMetadataField ) {
192- return traverseObject ( this . bindTargetMetadataField , this . metaData ) ?? this . inputField ?. getDefaultValue ( ) ;
194+ const value = traverseObject ( this . bindTargetMetadataField , this . metaData ) ;
195+ console . debug ( `meta-bind | setting initial value to ${ value } (typeof ${ typeof value } ) for input field ${ this . uid } ` ) ;
196+ return value ?? this . inputField ?. getDefaultValue ( ) ;
193197 }
194198 }
195199
@@ -206,7 +210,7 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
206210 }
207211
208212 async onload ( ) : Promise < void > {
209- Logger . logDebug ( ' load', this ) ;
213+ console . debug ( 'meta-bind | load inputFieldMarkdownRenderChild ', this ) ;
210214
211215 this . metaData = await this . metaData ;
212216
@@ -246,13 +250,12 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
246250 }
247251
248252 onunload ( ) : void {
249- Logger . logDebug ( ' unload', this ) ;
253+ console . debug ( 'meta-bind | unload inputFieldMarkdownRenderChild ', this ) ;
250254
251255 this . plugin . unregisterInputFieldMarkdownRenderChild ( this ) ;
252256
253257 super . onunload ( ) ;
254258
255- //console.log('unload', this);
256259 window . clearInterval ( this . limitInterval ) ;
257260 }
258261}
0 commit comments