diff --git a/AicsKnowledgeBase/qml/MainWindow.qml b/AicsKnowledgeBase/qml/MainWindow.qml index 0e18052..00c8aac 100644 --- a/AicsKnowledgeBase/qml/MainWindow.qml +++ b/AicsKnowledgeBase/qml/MainWindow.qml @@ -60,7 +60,7 @@ FluWindow { Layout.topMargin: 45 Layout.bottomMargin: 4 Layout.rightMargin: 4 - type: "video" + type: "md" } diff --git a/AicsKnowledgeBase/qml/page/ContentPage.qml b/AicsKnowledgeBase/qml/page/ContentPage.qml index 626fdfb..debb554 100644 --- a/AicsKnowledgeBase/qml/page/ContentPage.qml +++ b/AicsKnowledgeBase/qml/page/ContentPage.qml @@ -6,6 +6,7 @@ import QtQuick.Controls.Basic import QtWebEngine 1.2 import FluentUI import AicsKB.FileTransferManager +import "qrc:///AicsKnowledgeBase/qml/page" FluArea { id: content_area @@ -140,41 +141,6 @@ FluArea { } } - Loader { - id: content_view - Layout.fillWidth: true - sourceComponent: video_view - } - - Component { - id: video_view - FluMediaPlayer { - Layout.fillWidth: true - implicitHeight: width * 9 / 16. - } - } - Component { - id: text_view - Text { - id: text_md - text: content_page.contentMd - textFormat: TextEdit.MarkdownText - focus: true - } - } - Component { - id: other_view - WebEngineView { - Layout.fillWidth: true - id: sitemonitory_view - backgroundColor: "transparent" - implicitHeight: 200 - settings.javascriptEnabled: true - settings.pluginsEnabled: true - url: "https://www.baidu.com" - } - } - FluArea { Layout.fillWidth: true implicitHeight: 100 @@ -220,28 +186,64 @@ FluArea { } } } - Item { + + Loader { + id: content_view Layout.fillWidth: true - implicitHeight: 50 - FluText { - id: text_note - text: "笔记" - padding: 10 - font { - pointSize: 15 - bold: true - } - } - FluTextButton { - id: button_publish - text: "发布笔记" - hoverColor: "blue" - normalColor: "black" - anchors { - verticalCenter: text_note.verticalCenter - right: parent.right - } + sourceComponent: video_view + } + + Component { + id: video_view + FluMediaPlayer { + Layout.fillWidth: true + implicitHeight: width * 9 / 16. } } + Component { + id: text_view + NoteEditPage { + noteId: "255454" + Layout.fillWidth: true + implicitHeight: 400 + } + + } + Component { + id: other_view + WebEngineView { + Layout.fillWidth: true + id: sitemonitory_view + backgroundColor: "transparent" + implicitHeight: 200 + settings.javascriptEnabled: true + settings.pluginsEnabled: true + url: "https://www.baidu.com" + } + } + +// Item { +// Layout.fillWidth: true +// implicitHeight: 50 +// FluText { +// id: text_note +// text: "笔记" +// padding: 10 +// font { +// pointSize: 15 +// bold: true +// } +// } +// FluTextButton { +// id: button_publish +// text: "发布笔记" +// hoverColor: "blue" +// normalColor: "black" +// anchors { +// verticalCenter: text_note.verticalCenter +// right: parent.right +// } +// } +// } } } diff --git a/AicsKnowledgeBase/qml/page/NoteEditPage.qml b/AicsKnowledgeBase/qml/page/NoteEditPage.qml index 70c7cbb..8fc750f 100644 --- a/AicsKnowledgeBase/qml/page/NoteEditPage.qml +++ b/AicsKnowledgeBase/qml/page/NoteEditPage.qml @@ -15,9 +15,9 @@ FluArea { FluScrollablePage { id: edit_page anchors.fill: parent - leftPadding: 10 - topPadding: 10 - rightPadding: 10 + leftPadding: 5 + topPadding: 5 + rightPadding: 5 bottomPadding: 0 property string contentMd: "**ssijfdijgo**\ndfdgfdggggggggggggggggggggggggggggggggggggggggggggggggggg" @@ -40,14 +40,16 @@ FluArea { Item { Layout.fillWidth: true - implicitHeight: 50 + implicitHeight: 30 FluIconButton { id: button_edit iconSource: FluentIcons.Edit - visible: true + iconSize: 12 + visible: edit_page.isEditable anchors { right: parent.right + verticalCenter: parent.verticalCenter } onClicked: { button_edit.visible = false @@ -62,10 +64,12 @@ FluArea { FluIconButton { id: button_cancel iconSource: FluentIcons.Cancel + iconSize: 12 text: "取消" visible: false anchors { right: parent.right + verticalCenter: parent.verticalCenter } onClicked: { button_edit.visible = edit_page.isEditable @@ -80,16 +84,19 @@ FluArea { FluIconButton { id: button_save iconSource: FluentIcons.Save + iconSize: 12 text: "保存" visible: false anchors { right: button_cancel.left + verticalCenter: parent.verticalCenter } } FluIconButton { id: button_preview iconSource: FluentIcons.PreviewLink + iconSize: 12 text: "预览" visible: false onClicked: { @@ -99,26 +106,35 @@ FluArea { anchors { right: button_save.left + verticalCenter: parent.verticalCenter } } FluIconButton { id: button_subfield iconSource: md_show_view.isPreviewShowing ? FluentIcons.ClosePane: FluentIcons.OpenPane + iconSize: 12 text: "分栏" visible: false onClicked: { - md_show_view.isEditShowing = true - md_show_view.isPreviewShowing = !md_show_view.isPreviewShowing + if(md_show_view.isEditShowing ^ md_show_view.isPreviewShowing) { + md_show_view.isEditShowing = true + md_show_view.isPreviewShowing = true + } else { + md_show_view.isEditShowing = true + md_show_view.isPreviewShowing = false + } } anchors { right: button_preview.left + verticalCenter: parent.verticalCenter } } FluIconButton { id: button_editing iconSource: FluentIcons.ClipboardList + iconSize: 12 text: "编辑" visible: false onClicked: { @@ -127,6 +143,7 @@ FluArea { } anchors { right: button_subfield.left + verticalCenter: parent.verticalCenter } } } @@ -137,6 +154,7 @@ FluArea { Layout.fillWidth: true implicitHeight: 300 + ScrollView { id: edit_show_view implicitWidth: parent.width / 2 @@ -145,6 +163,11 @@ FluArea { TextArea { id: textArea_edit wrapMode: TextEdit.Wrap + background: Rectangle { + color: customTextArea.focus ? "#E0E0E0" : "white" + border.color: FluColors.Grey30 + radius: 10 + } } } @@ -157,6 +180,16 @@ FluArea { id: textArea_preview wrapMode: TextEdit.Wrap textFormat: TextEdit.MarkdownText + background: Rectangle { + color: customTextArea.focus ? "#E0E0E0" : "white" + border.color: FluColors.Grey30 + radius: 10 + } + readOnly: true + MouseArea { + anchors.fill: parent + enabled: false + } } } }