笔记创建界面

main
yang.yongquan 2023-07-06 21:36:58 +08:00
parent 691012903a
commit 1c9ce977bf
3 changed files with 27 additions and 20 deletions

View File

@ -47,6 +47,7 @@ FluArea {
signal download(string knowledgeFileId) signal download(string knowledgeFileId)
signal clickTags(string tagName) signal clickTags(string tagName)
// paddings: { // paddings: {
// top: 10 // top: 10
// right: 0 // right: 0
@ -112,7 +113,7 @@ FluArea {
// } // }
// content_page.favoriteCount = starers.length // content_page.favoriteCount = starers.length
if (content_area.type === "MD") { if (content_area.type === "MD") {
FileTransferManager.getMarkdown(content_page.fileId)
} else if (content_area.type === "VIDEO") { } else if (content_area.type === "VIDEO") {
} else { } else {
@ -126,6 +127,14 @@ FluArea {
}) })
} }
Connections {
target: FileTransferManager
onMarkdownData: data => {
content_view.push(text_view, {contentMd: data})
}
}
Component.onCompleted: { Component.onCompleted: {
loadFile(knowledgeFileId) loadFile(knowledgeFileId)
console.log(content_area.type) console.log(content_area.type)
@ -225,12 +234,7 @@ FluArea {
FileTransferManager.download(content_page.fileId, FileTransferManager.download(content_page.fileId,
content_page.title) content_page.title)
} }
// Connections {
// target: FileTransferManager
// onMarkdownData: data => {
// console.log(data)
// }
// }
} }
} }
@ -292,7 +296,7 @@ FluArea {
StackView { StackView {
id: content_view id: content_view
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: 400 height: width*10/16
} }
Component { Component {
@ -307,7 +311,7 @@ FluArea {
NoteEditPage { NoteEditPage {
noteId: "255454" noteId: "255454"
width: parent.width width: parent.width
implicitHeight: 400 height: width*9/16
} }
} }
Component { Component {

View File

@ -22,6 +22,9 @@ FluArea {
noteTitle = Qt.binding(function() { noteTitle = Qt.binding(function() {
return input_title.text return input_title.text
}) })
noteContent = Qt.binding(function() {
return input_md.contentMd
})
} }
FluScrollablePage { FluScrollablePage {
@ -74,10 +77,11 @@ FluArea {
} }
NoteEditPage { NoteEditPage {
id: text_view id: input_md
noteId: "255454" noteId: "255454"
width: parent.width width: parent.width
height: width*9/16 height: width*9/16
isEditable: true
} }
RowLayout { RowLayout {
@ -87,6 +91,7 @@ FluArea {
text: "上传" text: "上传"
onClicked: { onClicked: {
console.log(noteTitle) console.log(noteTitle)
console.log(noteContent)
} }
} }
FluButton { FluButton {

View File

@ -11,6 +11,9 @@ FluArea {
paddings: 0 paddings: 0
backgroundColor: "#f9f9f9" backgroundColor: "#f9f9f9"
property string noteId: "234" property string noteId: "234"
property string contentMd: ""
property bool isEditing: false
property bool isEditable: false
Layout.fillWidth: true Layout.fillWidth: true
FluScrollablePage { FluScrollablePage {
@ -21,21 +24,16 @@ FluArea {
rightPadding: 5 rightPadding: 5
bottomPadding: 0 bottomPadding: 0
property string contentMd: "**ssijfdijgo**\ndfdgfdggggggggggggggggggggggggggggggggggggggggggggggggggg"
property bool isEditing: false
property bool isEditable: false
Component.onCompleted: { Component.onCompleted: {
edit_page.isEditable = true
textArea_edit.text = edit_page.contentMd textArea_edit.text = edit_area.contentMd
edit_page.contentMd = Qt.binding( edit_area.contentMd = Qt.binding(
function() { function() {
return textArea_edit.text return textArea_edit.text
}) })
textArea_preview.text = Qt.binding( textArea_preview.text = Qt.binding(
function() { function() {
return edit_page.contentMd return edit_area.contentMd
}) })
} }
@ -47,7 +45,7 @@ FluArea {
id: button_edit id: button_edit
iconSource: FluentIcons.Edit iconSource: FluentIcons.Edit
iconSize: 12 iconSize: 12
visible: edit_page.isEditable visible: edit_area.isEditable
anchors { anchors {
right: parent.right right: parent.right
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -73,7 +71,7 @@ FluArea {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
onClicked: { onClicked: {
button_edit.visible = edit_page.isEditable button_edit.visible = edit_area.isEditable
button_save.visible = false button_save.visible = false
button_preview.visible = false button_preview.visible = false
button_subfield.visible = false button_subfield.visible = false