|
|
@ -25,9 +25,11 @@ define([
|
|
|
|
// Tasks list
|
|
|
|
// Tasks list
|
|
|
|
var checkedTaskItemPtn = /^\s*(<p>)?\[[xX]\](<\/p>)?\s*/;
|
|
|
|
var checkedTaskItemPtn = /^\s*(<p>)?\[[xX]\](<\/p>)?\s*/;
|
|
|
|
var uncheckedTaskItemPtn = /^\s*(<p>)?\[ ?\](<\/p>)?\s*/;
|
|
|
|
var uncheckedTaskItemPtn = /^\s*(<p>)?\[ ?\](<\/p>)?\s*/;
|
|
|
|
|
|
|
|
var bogusCheckPtn = /<input( checked=""){0,1} disabled="" type="checkbox">/;
|
|
|
|
renderer.listitem = function (text) {
|
|
|
|
renderer.listitem = function (text) {
|
|
|
|
var isCheckedTaskItem = checkedTaskItemPtn.test(text);
|
|
|
|
var isCheckedTaskItem = checkedTaskItemPtn.test(text);
|
|
|
|
var isUncheckedTaskItem = uncheckedTaskItemPtn.test(text);
|
|
|
|
var isUncheckedTaskItem = uncheckedTaskItemPtn.test(text);
|
|
|
|
|
|
|
|
var hasBogusInput = bogusCheckPtn.test(text);
|
|
|
|
if (isCheckedTaskItem) {
|
|
|
|
if (isCheckedTaskItem) {
|
|
|
|
text = text.replace(checkedTaskItemPtn,
|
|
|
|
text = text.replace(checkedTaskItemPtn,
|
|
|
|
'<i class="fa fa-check-square" aria-hidden="true"></i> ') + '\n';
|
|
|
|
'<i class="fa fa-check-square" aria-hidden="true"></i> ') + '\n';
|
|
|
@ -36,6 +38,15 @@ define([
|
|
|
|
text = text.replace(uncheckedTaskItemPtn,
|
|
|
|
text = text.replace(uncheckedTaskItemPtn,
|
|
|
|
'<i class="fa fa-square-o" aria-hidden="true"></i> ') + '\n';
|
|
|
|
'<i class="fa fa-square-o" aria-hidden="true"></i> ') + '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isCheckedTaskItem && !isUncheckedTaskItem && hasBogusInput) {
|
|
|
|
|
|
|
|
if (/checked/.test(text)) {
|
|
|
|
|
|
|
|
text = text.replace(bogusCheckPtn,
|
|
|
|
|
|
|
|
'<i class="fa fa-check-square" aria-hidden="true"></i> ') + '\n';
|
|
|
|
|
|
|
|
} else if (/disabled/.test(text)) {
|
|
|
|
|
|
|
|
text = text.replace(bogusCheckPtn,
|
|
|
|
|
|
|
|
'<i class="fa fa-square-o" aria-hidden="true"></i> ') + '\n';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
var cls = (isCheckedTaskItem || isUncheckedTaskItem) ? ' class="todo-list-item"' : '';
|
|
|
|
var cls = (isCheckedTaskItem || isUncheckedTaskItem) ? ' class="todo-list-item"' : '';
|
|
|
|
return '<li'+ cls + '>' + text + '</li>\n';
|
|
|
|
return '<li'+ cls + '>' + text + '</li>\n';
|
|
|
|
};
|
|
|
|
};
|
|
|
|