md 显示
parent
6f5355d909
commit
51a7b1f1fc
|
@ -47,7 +47,6 @@ 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
|
||||||
|
@ -94,7 +93,9 @@ FluArea {
|
||||||
content_page.title = data.name
|
content_page.title = data.name
|
||||||
content_page.fileId = data.knowledgeFileAttribute.id
|
content_page.fileId = data.knowledgeFileAttribute.id
|
||||||
|
|
||||||
content_area.type = data.knowledgeFileAttribute.suffix
|
content_area.type = getType(
|
||||||
|
data.knowledgeFileAttribute.suffix)
|
||||||
|
console.log(content_area.type)
|
||||||
|
|
||||||
var tagString = ""
|
var tagString = ""
|
||||||
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
|
for (var j = 0; j < data.knowledgeFileAttribute.tags.length; j++) {
|
||||||
|
@ -112,9 +113,11 @@ 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)
|
console.log(content_area.type)
|
||||||
} else if (content_area.type === "VIDEO") {
|
FileTransferManager.getMarkdown(
|
||||||
|
content_page.fileId)
|
||||||
|
} else if (content_area.type == "VIDEO") {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Request.get("knowledge/" + knowledgeFileId + "/preview/external",
|
Request.get("knowledge/" + knowledgeFileId + "/preview/external",
|
||||||
|
@ -130,11 +133,13 @@ FluArea {
|
||||||
Connections {
|
Connections {
|
||||||
target: FileTransferManager
|
target: FileTransferManager
|
||||||
onMarkdownData: data => {
|
onMarkdownData: data => {
|
||||||
content_view.push(text_view, {contentMd: data})
|
console.log(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)
|
||||||
|
@ -234,7 +239,6 @@ FluArea {
|
||||||
FileTransferManager.download(content_page.fileId,
|
FileTransferManager.download(content_page.fileId,
|
||||||
content_page.title)
|
content_page.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +300,7 @@ FluArea {
|
||||||
StackView {
|
StackView {
|
||||||
id: content_view
|
id: content_view
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: width*10/16
|
height: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
@ -312,14 +316,15 @@ FluArea {
|
||||||
noteId: "255454"
|
noteId: "255454"
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: width * 9 / 16
|
height: width * 9 / 16
|
||||||
|
isEditable: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: other_view
|
id: other_view
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: width * 9 / 16
|
||||||
backgroundColor: "transparent"
|
backgroundColor: "transparent"
|
||||||
implicitHeight: 200
|
|
||||||
settings.javascriptEnabled: true
|
settings.javascriptEnabled: true
|
||||||
settings.pluginsEnabled: true
|
settings.pluginsEnabled: true
|
||||||
url: "https://www.baidu.com"
|
url: "https://www.baidu.com"
|
||||||
|
|
|
@ -66,7 +66,6 @@ FluArea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluText {
|
FluText {
|
||||||
padding: 10
|
padding: 10
|
||||||
text: "内容"
|
text: "内容"
|
||||||
|
@ -82,6 +81,7 @@ FluArea {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: width * 9 / 16
|
height: width * 9 / 16
|
||||||
isEditable: true
|
isEditable: true
|
||||||
|
isEditing: true
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
@ -25,14 +25,31 @@ FluArea {
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
if (isEditing) {
|
||||||
|
button_edit.visible = false
|
||||||
|
button_save.visible = true
|
||||||
|
button_preview.visible = true
|
||||||
|
button_subfield.visible = true
|
||||||
|
button_editing.visible = true
|
||||||
|
button_cancel.visible = true
|
||||||
|
md_show_view.isEditShowing = true
|
||||||
|
md_show_view.isPreviewShowing = false
|
||||||
|
} else {
|
||||||
|
button_edit.visible = edit_area.isEditable
|
||||||
|
button_save.visible = false
|
||||||
|
button_preview.visible = false
|
||||||
|
button_subfield.visible = false
|
||||||
|
button_editing.visible = false
|
||||||
|
button_cancel.visible = false
|
||||||
|
md_show_view.isEditShowing = false
|
||||||
|
md_show_view.isPreviewShowing = true
|
||||||
|
}
|
||||||
|
|
||||||
textArea_edit.text = edit_area.contentMd
|
textArea_edit.text = edit_area.contentMd
|
||||||
edit_area.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_area.contentMd
|
return edit_area.contentMd
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ void FileTransferManager::getMarkdown(const QString &fileId)
|
||||||
auto fileUrl = std::format("File/{}?rangeStart={}&rangeEnd={}", fileId.toStdString(), 0, size);
|
auto fileUrl = std::format("File/{}?rangeStart={}&rangeEnd={}", fileId.toStdString(), 0, size);
|
||||||
std::string fileData;
|
std::string fileData;
|
||||||
auto res = httpGet(fileUrl, fileData);
|
auto res = httpGet(fileUrl, fileData);
|
||||||
//qDebug() << fileData.c_str();
|
qDebug() << fileData.c_str();
|
||||||
emit markdownData(QString::fromStdString(fileData));
|
emit markdownData(QString::fromStdString(fileData));
|
||||||
//qDebug() << "End Get" << res;
|
//qDebug() << "End Get" << res;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue