-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for basic HTML in popups #504
Conversation
The conversion starts with raw popup text, e.g. <p style='text-align:center;'><img src='https://inaturalist-open-data.s3.amazonaws.com/photos/117365592/medium.jpg?1616692245' alt='Specimen observed' width='250' /></p>
<p><strong>Figure.</strong> Dryobates villosus</p>
<hr />
<p><strong>Hairy Woodpecker</strong> belongs to the <span style='color:;'>Aves taxon</span> and are considered a non-captive/cultivated species within the Ottawa region. This particular specimen was observed on March 24, 2021.</p> It is converted to a list of HtmlToken objects by HtmlTokenParser, e.g.
Then tokens are built up into a tree of nodes by HtmlUtility.BuildDocumentTree:
Everything up to this point has been cross-platform, UI-framework-agnostic code. The next and final step is to translate the node tree into WPF elements. This is done by TextPopupElementView. The produced FlowDocument has this structure: FlowDocument
Paragraph { TextAlignment = Center }
InlineUIContainer
Image
Paragraph
Span { FontWeight = Bold }
Run { Text = "Figure." }
Run { Text = " Dryobates villosus" }
BlockUIContainer
Separator
Paragraph
Span { FontWeight = Bold }
Run { Text = "Hairy Woodpecker" }
Run { Text = " belongs to the " }
Span
Run { Text = "Aves taxon" }
Run { Text = " and are considered a non-captive/cultivated species within the Ottawa region. This particular specimen was observed on March 24, 2021." } |
* v200.1 * WPF Popupviewer updates (#491) * Switch to use PopupElements for popup viewer control * Address namespace changes * Update WindowsAppSDK version to match MAUI requirements (#500) * Update deprecated property * Add properties to allow compiling for .NET Framework * Fix typo * Avoid navigation string resources in toolkit package * Updates relevant to popupviewer enhancements (cherry picked from commit 273a7d7) * Update README.md Co-authored-by: Morten Nielsen <1378165+dotMorten@users.noreply.github.com> * Update docs/popup-viewer.md Co-authored-by: Morten Nielsen <1378165+dotMorten@users.noreply.github.com> * Fix min-version support in MAUI * Maui: Ensure fonts are packaged and deployed * Add support for basic HTML in popups (#504) * Work around asset deployment issues caused by WinAppSDK See microsoft/WindowsAppSDK#3546 for details * Also include assets in lib folder for library layout Follow-up to work around issue microsoft/WindowsAppSDK#3546 * Set background on toolbar --------- Co-authored-by: Morten Nielsen <mort5161@esri.com> Co-authored-by: Matvei Stefarov <mstefarov@esri.com> Co-authored-by: Preeti Maske <pmaske@esri.com>
Everything listed here is supported except:
There are tests (not checked in yet)
Examples: