feat: render sync server messages as rich text#4560
Open
timarnoldev wants to merge 1 commit intoankitects:mainfrom
Open
feat: render sync server messages as rich text#4560timarnoldev wants to merge 1 commit intoankitects:mainfrom
timarnoldev wants to merge 1 commit intoankitects:mainfrom
Conversation
The sync message from the server is displayed using QTextBrowser, which natively supports HTML rendering. By passing type="rich" to showText(), server operators can send formatted messages (tables, bold, links, etc.) while plain-text messages continue to render identically.
e4645ab to
e151564
Compare
Collaborator
|
We'll need to confirm if this won't cause issues with messages returned by AnkiWeb. |
Author
|
@abdnh Are there public tests available? Since AnkiWeb is proprietary I can't review every possible case. Is there a list of messages coming from AnkiWeb available? |
Collaborator
|
It's not publicly available. We're still in the process of transitioning management and private access to AnkiHub. I'll check and get back to this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
type="rich"toshowText()when displaying the sync server message, enabling HTML rendering viaQTextBrowser.setHtml()setHtml()handles plain strings the same assetPlainText()Context
The
/sync/metaresponse includes amsgfield that is displayed to the user after sync. The display widget is already aQTextBrowser(which supports Qt rich text/HTML), butshowText()is called with the defaulttype="text", routing throughsetPlainText().The
showTexthelper already has full HTML support — it just needstype="rich":Security:
QTextBrowserdoes not execute JavaScript — only static HTML/CSS. The sync server is explicitly configured and trusted by the user.