Warning, /maui/strike/src/views/editor/Editor.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.14 0002 import QtQuick.Controls 2.14 0003 import QtQuick.Layouts 1.3 0004 0005 import org.mauikit.controls 1.3 as Maui 0006 import org.mauikit.texteditor 1.0 as TE 0007 0008 import org.slike.strike 1.0 as Strike 0009 0010 Maui.SplitViewItem 0011 { 0012 id: control 0013 0014 property alias editor : _editor 0015 property alias fileUrl : _editor.fileUrl 0016 property alias title : _editor.title 0017 0018 TE.TextEditor 0019 { 0020 id: _editor 0021 anchors.fill: parent 0022 0023 showLineNumbers: settings.showLineNumbers 0024 body.color: settings.textColor 0025 body.font.family: settings.font.family 0026 body.font.pointSize: settings.font.pointSize 0027 document.backgroundColor: settings.backgroundColor 0028 Maui.Theme.backgroundColor: settings.backgroundColor 0029 document.theme: settings.theme 0030 document.autoSave: settings.autoSave 0031 document.tabSpace: ((settings.tabSpace+1) * body.font.pointSize) / 2 0032 document.enableSyntaxHighlighting: true 0033 onFileUrlChanged: editorView.outputPanel.syncTerminal(_editor.fileUrl) 0034 0035 Keys.enabled: true 0036 Keys.onPressed: 0037 { 0038 if((event.key === Qt.Key_S) && (event.modifiers & Qt.ControlModifier)) 0039 { 0040 saveFile(document.fileUrl, _editor) 0041 } 0042 0043 if((event.key === Qt.Key_T) && (event.modifiers & Qt.ControlModifier)) 0044 { 0045 syncTerminal(_editor.fileUrl) 0046 _editor.terminal.forceActiveFocus() 0047 } 0048 0049 if((event.key === Qt.Key_O) && (event.modifiers & Qt.ControlModifier)) 0050 { 0051 openFile() 0052 } 0053 0054 if((event.key === Qt.Key_N) && (event.modifiers & Qt.ControlModifier)) 0055 { 0056 openTab("") 0057 } 0058 0059 if((event.key === Qt.Key_L) && (event.modifiers & Qt.ControlModifier)) 0060 { 0061 settings.showLineNumbers = !settings.showLineNumbers 0062 } 0063 } 0064 0065 DropArea 0066 { 0067 id: _dropArea 0068 property var urls : [] 0069 anchors.fill: parent 0070 onDropped: 0071 { 0072 if(drop.urls) 0073 { 0074 var m_urls = drop.urls.join(",") 0075 _dropArea.urls = m_urls.split(",") 0076 _dropAreaMenu.show() 0077 0078 // Nota.Nota.requestFiles( _dropArea.urls ) 0079 } 0080 } 0081 0082 Maui.ContextualMenu 0083 { 0084 id: _dropAreaMenu 0085 0086 MenuItem 0087 { 0088 text: i18n("Open here") 0089 icon.name : "open-for-editing" 0090 onTriggered: 0091 { 0092 _editor.fileUrl = _dropArea.urls[0] 0093 } 0094 } 0095 0096 MenuItem 0097 { 0098 text: i18n("Open in new tab") 0099 icon.name: "tab-new" 0100 onTriggered: 0101 { 0102 Strike.Strike.requestFiles( _dropArea.urls ) 0103 } 0104 } 0105 0106 MenuItem 0107 { 0108 enabled: _dropArea.urls.length === 1 && currentTab.count <= 1 && settings.supportSplit 0109 text: i18n("Open in new split") 0110 icon.name: "view-split-left-right" 0111 onTriggered: 0112 { 0113 currentTab.split(_dropArea.urls[0]) 0114 } 0115 } 0116 0117 MenuSeparator{} 0118 0119 MenuItem 0120 { 0121 text: i18n("Cancel") 0122 icon.name: "dialog-cancel" 0123 onTriggered: 0124 { 0125 _dropAreaMenu.close() 0126 } 0127 } 0128 0129 onClosed: _editor.forceActiveFocus() 0130 } 0131 } 0132 0133 } 0134 }