parent
3705ca9c5c
commit
b6f33bcddf
@ -1,11 +1,12 @@
|
|||||||
class templaterFunc {
|
class templaterFunc {
|
||||||
createNewFile(tp) {
|
createNewFile(tp) {
|
||||||
const fileName = await tp.system.prompt("File name")
|
const fileName = this.getUserInput(tp, "File name")
|
||||||
const templateName = await tp.system.prompt("Template name") tp.file.create_new(tp.file.find_tfile("Template " + templateName), fileName, true, tp.file.folder())
|
const templateName = this.getUserInput(tp, "File name")
|
||||||
|
return tp.file.create_new(tp.file.find_tfile("Template ") + templateName, filename, true, tp.file.folder())
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileName(tp, prompt) {
|
getUserInput(tp, promptScript) {
|
||||||
const tempresult = await tp.system.prompt(prompt)
|
const tempresult = await tp.system.prompt(promptScript)
|
||||||
return tempresult
|
return tempresult
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<%*
|
<%*
|
||||||
const fileName = await tp.system.prompt("File name")
|
const fileName = await tp.system.prompt("File name")
|
||||||
const templateName = await tp.system.prompt("Template name")
|
const templateName = await tp.system.suggester(tp.frontmatter.ChildrenType, tp.frontmatter.ChildrenType)
|
||||||
tp.file.create_new(tp.file.find_tfile("Template " + templateName), fileName, tp.file.folder())
|
tp.file.create_new(tp.file.find_tfile("Template " + templateName), fileName, tp.file.folder())
|
||||||
%>
|
%>
|
@ -0,0 +1,4 @@
|
|||||||
|
<%*
|
||||||
|
const {templaterFunc} = tp.obsidian.plugins.plugins.CustomJS
|
||||||
|
templaterFunc.createNewFile(tp)
|
||||||
|
%>
|
Loading…
Reference in new issue