|
@@ -699,13 +699,15 @@
|
|
function generateOutputForNode(_node) {
|
|
function generateOutputForNode(_node) {
|
|
let template = (_node.attr('prefix') ? _node.attr('prefix') : '') + _node.attr('template'),
|
|
let template = (_node.attr('prefix') ? _node.attr('prefix') : '') + _node.attr('template'),
|
|
value = template;
|
|
value = template;
|
|
- if(value.indexOf('{text}') !== -1) {
|
|
|
|
|
|
+ let hasChildText = !!_node.find('>.note-template-children>textarea,>.note-template-children>input[type="number"],>.note-template-children>input[type="date"]').length;
|
|
|
|
+ let hasChildren = !!_node.find('>.note-template-children>.note-template-item').length;
|
|
|
|
+ if(hasChildText) {
|
|
value = value.replace('{text}',
|
|
value = value.replace('{text}',
|
|
_node
|
|
_node
|
|
.find('>.note-template-children')
|
|
.find('>.note-template-children')
|
|
.find('>textarea,>input[type="number"],>input[type="date"]').first().val());
|
|
.find('>textarea,>input[type="number"],>input[type="date"]').first().val());
|
|
}
|
|
}
|
|
- else if(value.indexOf('{children}') !== -1) {
|
|
|
|
|
|
+ else if(hasChildren) {
|
|
let values = [];
|
|
let values = [];
|
|
_node.find('>.note-template-children>.note-template-item.selected').each(function() {
|
|
_node.find('>.note-template-children>.note-template-item.selected').each(function() {
|
|
values.push(generateOutputForNode($(this)));
|
|
values.push(generateOutputForNode($(this)));
|
|
@@ -722,7 +724,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- value = value.replace('{children}', ' ' + combined);
|
|
|
|
|
|
+ value = value.replace('{children}', ' ' + combined).replace('{text}', ' ' + combined);
|
|
}
|
|
}
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|