import QtQuick 2.0 import Sailfish.Silica 1.0 Dialog { id: noteDialog acceptDestination: Qt.resolvedUrl("EditPage.qml") acceptDestinationProperties: { account: account; noteIndex: noteIndex } /*onAcceptPendingChanged: { if (acceptPending) { acceptDestinationInstance.note = note } }*/ Component.onCompleted: acceptDestinationProperties = { account: account, noteIndex: noteIndex }//acceptDestinationInstance.note = note property var account property int noteIndex property var markdown: [ { regex: new RegExp(/(^#\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^##\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^###\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^####\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^#####\s)(.*)$/gm), replace: '
$2
' }, { regex: new RegExp(/(^######\s)(.*)$/gm), replace: '
$2
' }, { regex: new RegExp(/(^-\s)(.*)$/gm), replace: '' }, { regex: new RegExp(/(^\d{1,}.\s)(.*)$/gm), replace: '
  1. $2
' } ] SilicaFlickable { anchors.fill: parent contentHeight: column.height /*PullDownMenu { quickSelect: true MenuItem { text: qsTr("Edit") onClicked: pageStack.push(Qt.resolvedUrl("EditPage.qml"), { note: note } ) } }*/ Column { id: column width: parent.width DialogHeader { title: account.model.get(noteIndex).title acceptText: qsTr("Edit") cancelText: qsTr("Notes") } LinkedLabel { x: Theme.horizontalPageMargin width: parent.width - 2*x textFormat: Text.StyledText Component.onCompleted: { var lines = account.model.get(noteIndex).content.split('\n') lines.splice(0,1); text = lines.join('\n'); for (var i=0; i < markdown.length; i++) { text = text.replace(markdown[i].regex, markdown[i].replace) } console.log(text) } } } VerticalScrollDecorator {} } }