Changed #34: Do not underline lines with tick boxes. Began implementing #18: Page with Markdown syntax

This commit is contained in:
Scharel 2018-12-11 13:34:17 +01:00
parent 413d3e3486
commit a01fe96830
7 changed files with 116 additions and 61 deletions

View file

@ -35,7 +35,8 @@ DISTFILES += qml/harbour-nextcloudnotes.qml \
qml/pages/UnencryptedDialog.qml \ qml/pages/UnencryptedDialog.qml \
qml/pages/NotesApi.qml \ qml/pages/NotesApi.qml \
qml/pages/MITLicense.qml \ qml/pages/MITLicense.qml \
qml/pages/GPLLicense.qml qml/pages/GPLLicense.qml \
qml/pages/SyntaxPage.qml
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172

View file

@ -33,7 +33,7 @@ Dialog {
} }
MenuItem { MenuItem {
text: qsTr("Markdown syntax") text: qsTr("Markdown syntax")
onClicked: Qt.openUrlExternally("https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax") onClicked: pageStack.push(Qt.resolvedUrl("SyntaxPage.qml")) //Qt.openUrlExternally("https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax")
} }
} }

View file

@ -47,20 +47,23 @@ Dialog {
convertedText = convertedText.replace(/^<li>(<p>)?\[ \] (.*)(<.*)$/gmi, convertedText = convertedText.replace(/^<li>(<p>)?\[ \] (.*)(<.*)$/gmi,
function(match, p1, p2, p3, offset) { function(match, p1, p2, p3, offset) {
occurence++ occurence++
return '<li class="tasklist"><a href="tasklist:checkbox_' + occurence + '">' + (p1 ? p1 : "") + '☐ ' + p2 + '</a>' + p3 return '<li class="tasklist"><a class="checkbox" href="tasklist:checkbox_' + occurence + '">' + (p1 ? p1 : "") + '☐ ' + p2 + '</a>' + p3
} ) } )
occurence = -1 occurence = -1
convertedText = convertedText.replace(/^<li>(<p>)?\[[xX]\] (.*)(<.*)$/gmi, convertedText = convertedText.replace(/^<li>(<p>)?\[[xX]\] (.*)(<.*)$/gmi,
function(match, p1, p2, p3, offset) { function(match, p1, p2, p3, offset) {
occurence++ occurence++
return '<li class="tasklist"><a href="tasklist:uncheckbox_' + occurence + '">' + (p1 ? p1 : "") + '☑ ' + p2 + '</a>' + p3 return '<li class="tasklist"><a class="checkbox" href="tasklist:uncheckbox_' + occurence + '">' + (p1 ? p1 : "") + '☑ ' + p2 + '</a>' + p3
} ) } )
convertedText = convertedText.replace("<table>", "<table border='1' cellpadding='" + Theme.paddingMedium + "'>") convertedText = convertedText.replace("<table>", "<table border='1' cellpadding='" + Theme.paddingMedium + "'>")
contentLabel.text = "<style>ul,ol,table,img { margin-bottom: " + Theme.paddingLarge + "px; margin-top: " + Theme.paddingLarge + "px; }\n" + contentLabel.text = "<style>\n" +
"ul,ol,table,img { margin: " + Theme.paddingLarge + "px 0px; }\n" +
"a:link { color: " + Theme.primaryColor + "; }\n" + "a:link { color: " + Theme.primaryColor + "; }\n" +
"li.tasklist { font-size:large; margin-bottom: " + Theme.paddingMedium + "px; margin-top: " + Theme.paddingMedium + "px; }\n" + "a.checkbox { text-decoration: none; padding: " + Theme.paddingSmall + "px; display: inline-block; }\n" +
"li.tasklist { font-size:large; margin: " + Theme.paddingMedium + "px 0px; }\n" +
"del { text-decoration: line-through; }\n" + "del { text-decoration: line-through; }\n" +
"table { border-color: " + Theme.secondaryColor + "; }</style>" + convertedText "table { border-color: " + Theme.secondaryColor + "; }\n" +
"</style>\n" + convertedText
//console.log(contentLabel.text) //console.log(contentLabel.text)
} }

47
qml/pages/SyntaxPage.qml Normal file
View file

@ -0,0 +1,47 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
SilicaFlickable {
id: flickable
anchors.fill: parent
contentHeight: column.height
Column {
id: column
width: parent.width
PageHeader {
title: qsTr("Markdown Syntax")
}
SectionHeader {
text: qsTr("Header")
}
Drawer {
id: headerDrawer
width: parent.width
background: LinkedLabel {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
textFormat: Text.RichText
linkColor: Theme.primaryColor
text: "Formatted Text"
}
BackgroundItem {
anchors.fill: parent
onClicked: headerDrawer.open = !headerDrawer.open
Label {
text: "Raw Text"
}
}
}
}
VerticalScrollDecorator {}
}
allowedOrientations: defaultAllowedOrientations
}

View file

@ -12,6 +12,10 @@
# * date Author's Name <author's email> version-release # * date Author's Name <author's email> version-release
# - Summary of changes # - Summary of changes
* Mon Dec 11 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-6
- Changed #34: "Do not underline lines with tick boxes"
- Began implementing #18: Page with Markdown syntax
* Mon Dec 11 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-5 * Mon Dec 11 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-5
- Fixed an issue that prevented to edit accounts - Fixed an issue that prevented to edit accounts

View file

@ -14,7 +14,7 @@ Name: harbour-nextcloudnotes
%{?qtc_builddir:%define _builddir %qtc_builddir} %{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Nextcloud Notes Summary: Nextcloud Notes
Version: 0.2 Version: 0.2
Release: 5 Release: 6
Group: Applications/Editors Group: Applications/Editors
License: MIT License: MIT
URL: https://github.com/scharel/harbour-nextcloudnotes URL: https://github.com/scharel/harbour-nextcloudnotes

View file

@ -1,7 +1,7 @@
Name: harbour-nextcloudnotes Name: harbour-nextcloudnotes
Summary: Nextcloud Notes Summary: Nextcloud Notes
Version: 0.2 Version: 0.2
Release: 5 Release: 6
# The contents of the Group field should be one of the groups listed here: # The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Applications/Editors Group: Applications/Editors