@@ -17,9 +17,10 @@ import {
1717import { Signal } from '../utils/Signal' ;
1818import { type BindTargetScope } from '../metadata/BindTargetScope' ;
1919import { MetaBindTable } from '../metaBindTable/MetaBindTable' ;
20- import { NewInputFieldFactory } from '../inputFields/NewInputFieldFactory ' ;
20+ import { InputFieldFactory } from '../inputFields/InputFieldFactory ' ;
2121import { type JsViewFieldDeclaration , type UnvalidatedViewFieldDeclaration , type ViewFieldDeclaration } from '../parsers/viewFieldParser/ViewFieldDeclaration' ;
2222import { ViewFieldFactory } from '../viewFields/ViewFieldFactory' ;
23+ import { getUUID } from '../utils/Utils' ;
2324
2425export class API implements IAPI {
2526 public plugin : MetaBindPlugin ;
@@ -30,7 +31,7 @@ export class API implements IAPI {
3031 public readonly viewFieldParser : ViewFieldDeclarationParser ;
3132 public readonly bindTargetParser : BindTargetParser ;
3233
33- public readonly inputFieldFactory : NewInputFieldFactory ;
34+ public readonly inputFieldFactory : InputFieldFactory ;
3435 public readonly viewFieldFactory : ViewFieldFactory ;
3536
3637 constructor ( plugin : MetaBindPlugin ) {
@@ -42,7 +43,7 @@ export class API implements IAPI {
4243 this . viewFieldParser = new ViewFieldDeclarationParser ( this . plugin ) ;
4344 this . bindTargetParser = new BindTargetParser ( this . plugin ) ;
4445
45- this . inputFieldFactory = new NewInputFieldFactory ( this . plugin ) ;
46+ this . inputFieldFactory = new InputFieldFactory ( this . plugin ) ;
4647 this . viewFieldFactory = new ViewFieldFactory ( this . plugin ) ;
4748 }
4849
@@ -59,7 +60,7 @@ export class API implements IAPI {
5960
6061 const declaration = this . inputFieldParser . validateDeclaration ( unvalidatedDeclaration ) ;
6162
62- const inputField = new InputFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , self . crypto . randomUUID ( ) ) ;
63+ const inputField = new InputFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , getUUID ( ) ) ;
6364 component . addChild ( inputField ) ;
6465
6566 return inputField ;
@@ -79,7 +80,7 @@ export class API implements IAPI {
7980
8081 const declaration : InputFieldDeclaration = this . inputFieldParser . parseString ( fullDeclaration , scope ) ;
8182
82- const inputField = new InputFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , self . crypto . randomUUID ( ) ) ;
83+ const inputField = new InputFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , getUUID ( ) ) ;
8384 component . addChild ( inputField ) ;
8485
8586 return inputField ;
@@ -98,7 +99,7 @@ export class API implements IAPI {
9899
99100 const declaration : ViewFieldDeclaration = this . viewFieldParser . parseString ( fullDeclaration ) ;
100101
101- const viewField = new ViewFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , self . crypto . randomUUID ( ) ) ;
102+ const viewField = new ViewFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , getUUID ( ) ) ;
102103 component . addChild ( viewField ) ;
103104
104105 return viewField ;
@@ -117,14 +118,14 @@ export class API implements IAPI {
117118
118119 const declaration : JsViewFieldDeclaration = this . viewFieldParser . parseJsString ( fullDeclaration ) ;
119120
120- const viewField = new JsViewFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , self . crypto . randomUUID ( ) ) ;
121+ const viewField = new JsViewFieldMDRC ( containerEl , renderType , declaration , this . plugin , filePath , getUUID ( ) ) ;
121122 component . addChild ( viewField ) ;
122123
123124 return viewField ;
124125 }
125126
126127 public createExcludedField ( containerEl : HTMLElement , filePath : string , component : Component | MarkdownPostProcessorContext ) : ExcludedMDRC {
127- const excludedField = new ExcludedMDRC ( containerEl , RenderChildType . INLINE , this . plugin , filePath , self . crypto . randomUUID ( ) ) ;
128+ const excludedField = new ExcludedMDRC ( containerEl , RenderChildType . INLINE , this . plugin , filePath , getUUID ( ) ) ;
128129 component . addChild ( excludedField ) ;
129130
130131 return excludedField ;
@@ -143,7 +144,7 @@ export class API implements IAPI {
143144 * @param listenToChildren
144145 */
145146 public listenToMetadata ( signal : Signal < unknown > , filePath : string , metadataPath : string [ ] , listenToChildren : boolean = false ) : ( ) => void {
146- const uuid = self . crypto . randomUUID ( ) ;
147+ const uuid = getUUID ( ) ;
147148
148149 const subscription = this . plugin . metadataManager . subscribe ( uuid , signal , {
149150 filePath : filePath ,
@@ -165,7 +166,7 @@ export class API implements IAPI {
165166 tableHead : string [ ] ,
166167 columns : ( UnvalidatedInputFieldDeclaration | UnvalidatedViewFieldDeclaration ) [ ] ,
167168 ) : MetaBindTable {
168- const table = new MetaBindTable ( containerEl , RenderChildType . INLINE , this . plugin , filePath , self . crypto . randomUUID ( ) , bindTarget , tableHead , columns ) ;
169+ const table = new MetaBindTable ( containerEl , RenderChildType . INLINE , this . plugin , filePath , getUUID ( ) , bindTarget , tableHead , columns ) ;
169170 component . addChild ( table ) ;
170171
171172 return table ;
0 commit comments