Skip to content

Commit d4425ac

Browse files
committed
comments
1 parent 2b342b3 commit d4425ac

File tree

2 files changed

+28
-5
lines changed
  • exampleVault/.obsidian/plugins/obsidian-meta-bind-plugin
  • src

2 files changed

+28
-5
lines changed

exampleVault/.obsidian/plugins/obsidian-meta-bind-plugin/main.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,22 @@ export default class MetaBindPlugin extends Plugin {
7474
this.addSettingTab(new MetaBindSettingTab(this.app, this));
7575
}
7676

77-
buildInputFieldMarkdownRenderChild(declaration: string | InputFieldDeclaration, sourcePath: string, codeBlock: HTMLElement, renderType: InputFieldMarkdownRenderChildType = InputFieldMarkdownRenderChildType.INLINE_CODE_BLOCK) {
77+
/**
78+
* Accessable function for building an input field.
79+
*
80+
* @param {string|InputFieldDeclaration} declaration The field declaration string or data.
81+
* @param {string} sourcePath The path of the file the element is being inserted into
82+
* @param {HTMLElement} container The element to fill with the input element
83+
* @param {InputFieldMarkdownRenderChildType} renderType Inline or Code Block
84+
*
85+
* @returns The render child produced.
86+
*/
87+
buildInputFieldMarkdownRenderChild(
88+
declaration: string | InputFieldDeclaration,
89+
sourcePath: string,
90+
container: HTMLElement,
91+
renderType: InputFieldMarkdownRenderChildType = InputFieldMarkdownRenderChildType.INLINE_CODE_BLOCK
92+
) : InputFieldMarkdownRenderChild {
7893
var error = undefined;
7994

8095
try {
@@ -86,7 +101,7 @@ export default class MetaBindPlugin extends Plugin {
86101
} catch (error) { }
87102

88103
return new InputFieldMarkdownRenderChild(
89-
codeBlock,
104+
container,
90105
renderType,
91106
declaration as InputFieldDeclaration,
92107
this,
@@ -95,6 +110,14 @@ export default class MetaBindPlugin extends Plugin {
95110
);
96111
}
97112

113+
/**
114+
* Helper method to build a declaration from some initial data or a string.
115+
*
116+
* @param {string | InputFieldDeclaration} base The base declaration data or a string to parse for it
117+
* @param {Record<InputFieldArgumentType, string> | {} | undefined | null} args The arguments, indexed by name.
118+
* @param { string | undefined | null} templateName (optional) A template to use.
119+
* @returns
120+
*/
98121
buildDeclaration(
99122
base: string | InputFieldDeclaration,
100123
args?: Record<InputFieldArgumentType, string> | {} | undefined | null,

0 commit comments

Comments
 (0)