笔记创建界面

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

View File

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

View File

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