diff --git a/qml/pages/NotePage.qml b/qml/pages/NotePage.qml index 71d2fb2..7b9cf45 100644 --- a/qml/pages/NotePage.qml +++ b/qml/pages/NotePage.qml @@ -41,20 +41,21 @@ Dialog { note = account.getNote(note.id, false) var convertedText = converter.makeHtml(note.content) var occurence = -1 - convertedText = convertedText.replace(/^
  • (

    )?\[ \] (.*)<\/li>$/gm, - function(match, p1, p2, offset) { + convertedText = convertedText.replace(/^

  • (

    )?\[ \] (.*)(<.*)$/gmi, + function(match, p1, p2, p3, offset) { occurence++ - return '

  • ' + (p1 ? p1 : "") + '☐ ' + p2 + '
  • ' + return '
  • ' + (p1 ? p1 : "") + '☐ ' + p2 + '' + p3 } ) occurence = -1 - convertedText = convertedText.replace(/^
  • (

    )?\[[xX]\] (.*)<\/li>$/gm, - function(match, p1, p2, offset) { + convertedText = convertedText.replace(/^

  • (

    )?\[[xX]\] (.*)(<.*)$/gmi, + function(match, p1, p2, p3, offset) { occurence++ - return '

  • ' + (p1 ? p1 : "") + '☑ ' + p2 + '
  • ' + return '
  • ' + (p1 ? p1 : "") + '☑ ' + p2 + '' + p3 } ) convertedText = convertedText.replace("", "
    ") contentLabel.text = "" + convertedText console.log(contentLabel.text) } @@ -113,10 +114,11 @@ Dialog { linkColor: Theme.primaryColor defaultLinkActions: false onLinkActivated: { + console.log(link) var occurence = -1 var newContent = note.content if (/^tasklist:checkbox_(\d+)$/m.test(link)) { - newContent = newContent.replace(/^- \[ \] (.*)$/gm, + newContent = newContent.replace(/- \[ \] (.*)$/gm, function(match, p1, offset, string) { occurence++ if (occurence === parseInt(link.split('_')[1])) { @@ -128,7 +130,7 @@ Dialog { account.updateNote(note.id, { 'content': note.content } ) } else if (/^tasklist:uncheckbox_(\d+)$/m.test(link)) { - newContent = newContent.replace(/^- \[[xX]\] (.*)$/gm, + newContent = newContent.replace(/- \[[xX]\] (.*)$/gm, function(match, p1, offset, string) { occurence++ if (occurence === parseInt(link.split('_')[1])) {