feat(editor): 增加MD文件预览功能 - #522
Conversation
- Add MarkdownPreview widget (QTextBrowser + QTextDocument::setMarkdown, Qt >= 6.5) - Show live side-by-side preview automatically for .md/.markdown files - Add checkable 'Markdown preview' menu action and Ctrl+Shift+M shortcut - Sync action state with current tab and save-as path changes - Update AT-SPI expected names and add unit tests
There was a problem hiding this comment.
Sorry @humanfans, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: humanfans The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @humanfans. Thanks for your PR. 😃 |
|
CLA Assistant Lite bot: Meteorology Platform seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
Hi @humanfans. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's GuideIntroduce a Qt-based MarkdownPreview widget and wire it into the editor/window so that markdown files can be previewed side-by-side, with menu/shortcut control, accessibility naming, and unit tests. Sequence diagram for toggling Markdown preview in the editorsequenceDiagram
actor User
participant Window
participant EditWrapper
participant MarkdownPreview
User->>Window: markdownPreviewAction.triggered / toggleMarkdownPreview
Window->>Window: toggleMarkdownPreview()
Window->>EditWrapper: currentWrapper()
alt wrapper == nullptr or !MarkdownPreview::isSupported() or !MarkdownPreview::isMarkdownFile(filePath)
Window-->>User: [no-op]
else validMarkdownPreview
Window->>EditWrapper: filePath()
Window->>EditWrapper: isMarkdownPreviewVisible()
Window->>EditWrapper: setMarkdownPreviewVisible(!isMarkdownPreviewVisible)
Note over EditWrapper,MarkdownPreview: setMarkdownPreviewVisible triggers MarkdownPreview::updatePreview
Window->>Window: updateMarkdownPreviewActionState()
Window->>EditWrapper: currentWrapper()
Window->>MarkdownPreview: isMarkdownFile(wrapper->filePath())
Window->>Window: m_markdownPreviewAction->setEnabled(isMarkdown)
Window->>Window: m_markdownPreviewAction->setChecked(isMarkdown && wrapper->isMarkdownPreviewVisible())
end
EditWrapper->>MarkdownPreview: updatePreview(m_pTextEdit->toPlainText())
EditWrapper->>MarkdownPreview: [on QPlainTextEdit::textChanged when visible] updatePreview(m_pTextEdit->toPlainText())
EditWrapper->>MarkdownPreview: [on updatePath for .md/.markdown] setMarkdownPreviewVisible(isMarkdownFile(file))
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by Sourcery
Add an optional, accessible markdown preview pane to the editor with menu and shortcut controls, active for markdown files when supported by the Qt version.
New Features:
Enhancements:
Tests: