Warning, /office/klevernotes/src/contents/ui/textEditor/CheatSheet.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: GPL-2.0-or-later 0002 // SPDX-FileCopyrightText: 2022 Louis Schul <schul9louis@gmail.com> 0003 0004 import QtQuick 2.15 0005 import QtQuick.Controls 2.15 as Controls 0006 import QtQuick.Layouts 1.15 0007 0008 import org.kde.kirigami 2.19 as Kirigami 0009 import org.kde.kirigamiaddons.formcard 1.0 as FormCard 0010 0011 import org.kde.Klever 1.0 0012 0013 import "qrc:/contents/ui/textEditor/components/" 0014 0015 Kirigami.Dialog { 0016 id: cheatSheet 0017 0018 title: i18nc("@window:title","Markdown Cheat Sheet") 0019 0020 background: Rectangle { 0021 Kirigami.Theme.colorSet: Kirigami.Theme.Window 0022 Kirigami.Theme.inherit: false 0023 color: Kirigami.Theme.backgroundColor 0024 } 0025 0026 width: applicationWindow().width > Kirigami.Units.gridUnit * 31 ? Kirigami.Units.gridUnit * 30 : applicationWindow().width - Kirigami.Units.gridUnit 0027 height: applicationWindow().height - Kirigami.Units.gridUnit * 2//0 ? Kirigami.Units.gridUnit * 28 0028 0029 standardButtons: Controls.Dialog.NoButton 0030 0031 ColumnLayout { 0032 spacing: 0 0033 0034 TextEdit { // Don't move this, weird height issue with the OverlaySheet otherwise 0035 id: clipboardHelper 0036 visible: false 0037 onTextChanged: if (length > 0) { 0038 selectAll() 0039 copy() 0040 showPassiveNotification(i18n("Copied !")) 0041 cheatSheet.close() 0042 } 0043 } 0044 0045 FormCard.FormHeader { 0046 Layout.fillWidth: true 0047 title: i18nc("@title, cheat sheet section", "Basic syntax") 0048 } 0049 0050 FormCard.FormCard { 0051 Layout.fillWidth: true 0052 0053 CheatSheetEntry { 0054 element: "<h1>" + i18n("Heading") + "</h1>" 0055 syntax: "# " + i18nc("exemple","Heading1") 0056 onClicked: clipboardHelper.text = syntax 0057 } 0058 0059 CheatSheetEntry { 0060 element: "<b>" + i18n("Bold") + "</b>" 0061 syntax: "**" + i18nc("exemple","Bold text") + "**" 0062 onClicked: clipboardHelper.text = syntax 0063 } 0064 0065 CheatSheetEntry { 0066 element: "<i>" + i18n("Italic") + "</i>" 0067 syntax: "_" + i18nc("exemple","Italic text") + "_" 0068 onClicked: clipboardHelper.text = syntax 0069 } 0070 0071 CheatSheetEntry { 0072 element: i18n("Blockquote") 0073 syntax: "> " + i18nc("exemple","Quote") 0074 onClicked: clipboardHelper.text = syntax 0075 } 0076 0077 CheatSheetEntry { 0078 element: i18n("Ordered list") 0079 syntax: "1. " + i18nc("exemple","First item") + "\n" + 0080 "2. " + i18nc("exemple","Second item") 0081 onClicked: clipboardHelper.text = syntax 0082 } 0083 0084 CheatSheetEntry { 0085 element: i18n("Unordered list") 0086 syntax: "- " + i18nc("exemple","First item") + "\n" + 0087 "- " + i18nc("exemple","Second item") 0088 onClicked: clipboardHelper.text = syntax 0089 } 0090 0091 CheatSheetEntry { 0092 element: i18n("Code") 0093 syntax: "`" + i18nc("exemple","Inline code") + "`" 0094 onClicked: clipboardHelper.text = syntax 0095 } 0096 0097 CheatSheetEntry { 0098 element: i18nc("@label, horizontal rule => <hr> html tag", "Rule") 0099 syntax: "---" 0100 onClicked: clipboardHelper.text = syntax 0101 } 0102 0103 CheatSheetEntry { 0104 element: i18n("Link") 0105 syntax: "[" + i18nc("exemple","title") + "](" + i18nc("exemple", "https://www.example.com") + ")" 0106 onClicked: clipboardHelper.text = syntax 0107 } 0108 0109 CheatSheetEntry { 0110 element: i18n("Image") 0111 syntax: "![" + i18nc("exemple","alt text") + "](" + i18nc("exemple", "image") + ".jpg)" 0112 onClicked: clipboardHelper.text = syntax 0113 } 0114 } 0115 0116 FormCard.FormHeader { 0117 Layout.fillWidth: true 0118 title: i18nc("@title, cheat sheet section", "Extended syntax") 0119 } 0120 0121 FormCard.FormCard { 0122 Layout.fillWidth: true 0123 0124 CheatSheetEntry { 0125 element: i18n("Table") 0126 syntax: "|" + i18nc("@label, noun, 'The left side of something'","Left") + "|" + i18nc("@label, verb, 'To center something'","Center") + "|" + i18nc("@label, noun, 'The right side of something", "Right") + "|\n" + 0127 "| :------ | :------: | ------:|\n" + 0128 "|" + i18nc("exemple","Cell 1") + "|" + i18nc("exemple", "Cell 2") + "|" + i18nc("exemple", "Cell 3") + "|" 0129 onClicked: clipboardHelper.text = syntax 0130 } 0131 0132 CheatSheetEntry { 0133 element: i18n("Fenced code block") 0134 syntax: "```\n" + 0135 i18nc("exemple","Sample text here...") + "\n" + 0136 "```" 0137 onClicked: clipboardHelper.text = syntax 0138 } 0139 0140 CheatSheetEntry { 0141 element: i18n("Strikethrough") 0142 syntax: "~~" + i18nc("exemple, something wrong","The world is flat.") + "~~" 0143 onClicked: clipboardHelper.text = syntax 0144 } 0145 0146 CheatSheetEntry { 0147 element: i18n("Task list") 0148 syntax: "- [ ] " + i18nc("exemple", "Make more foo") + "\n" + 0149 "- [x] " + i18nc("exemple", "Make more bar") 0150 onClicked: clipboardHelper.text = syntax 0151 } 0152 } 0153 0154 FormCard.FormHeader { 0155 Layout.fillWidth: true 0156 title: i18nc("@title, cheat sheet section", "KleverNotes plugins") 0157 visible: Config.noteMapEnabled // Will change when more plugins are added 0158 } 0159 0160 FormCard.FormCard { 0161 Layout.fillWidth: true 0162 visible: Config.noteMapEnabled 0163 0164 CheatSheetEntry { 0165 element: i18n("Note link") 0166 syntax: "[[ " 0167 + i18nc("exemple, a note path ('/' are important), Category as in 'a category, Group 'a group', Note 'a note'", "Category/Group/Note") 0168 + ":# " + i18nc("exemple", "header") + " | " + i18nc("exemple", "displayed name") + " ]]" 0169 onClicked: clipboardHelper.text = syntax 0170 } 0171 } 0172 } 0173 }