|
|
@ -117,29 +117,30 @@ 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">/;
|
|
|
|
var bogusCheckPtn = /<input checked="" disabled="" type="checkbox">/;
|
|
|
|
|
|
|
|
var bogusUncheckPtn = /<input 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);
|
|
|
|
var hasBogusCheckedInput = bogusCheckPtn.test(text);
|
|
|
|
|
|
|
|
var hasBogusUncheckedInput = bogusUncheckPtn.test(text);
|
|
|
|
|
|
|
|
var isCheckbox = true;
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
} else if (isUncheckedTaskItem) {
|
|
|
|
if (isUncheckedTaskItem) {
|
|
|
|
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
} else if (hasBogusCheckedInput) {
|
|
|
|
if (!isCheckedTaskItem && !isUncheckedTaskItem && hasBogusInput) {
|
|
|
|
|
|
|
|
if (/checked/.test(text)) {
|
|
|
|
|
|
|
|
text = text.replace(bogusCheckPtn,
|
|
|
|
text = text.replace(bogusCheckPtn,
|
|
|
|
'<i class="fa fa-check-square" aria-hidden="true"></i>') + '\n';
|
|
|
|
'<i class="fa fa-check-square" aria-hidden="true"></i>') + '\n';
|
|
|
|
} else if (/disabled/.test(text)) {
|
|
|
|
} else if (hasBogusUncheckedInput) {
|
|
|
|
text = text.replace(bogusCheckPtn,
|
|
|
|
text = text.replace(bogusUncheckPtn,
|
|
|
|
'<i class="fa fa-square-o" aria-hidden="true"></i>') + '\n';
|
|
|
|
'<i class="fa fa-square-o" aria-hidden="true"></i>') + '\n';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
isCheckbox = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var cls = (isCheckbox) ? ' class="todo-list-item"' : '';
|
|
|
|
var cls = (isCheckedTaskItem || isUncheckedTaskItem || hasBogusInput) ? ' class="todo-list-item"' : '';
|
|
|
|
|
|
|
|
return '<li'+ cls + '>' + text + '</li>\n';
|
|
|
|
return '<li'+ cls + '>' + text + '</li>\n';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
restrictedRenderer.listitem = function (text) {
|
|
|
|
restrictedRenderer.listitem = function (text) {
|
|
|
|