question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Callout Content - docs specify "HTML" but renders markup

See original GitHub issue

Category

  • Enhancement
  • Bug
  • Question

Version

Please specify what version of the library you are using: [ 1.16.0 ]

Expected / Desired Behavior / Question

The docs for any control with Callouts for example state that the callout content can be any HTML -

Callout content - any HTML

Pop in some HTML into the calloutContent prop, e.g. <h1>This is a test</h1>

I’d hope the HTML to be rendered in the callout.

Observed Behavior

The callout is rendered with the HTML markup (as if it were escaped).

It may be that you need to pass in a React element, however this control is used in the base Web Part class which is .ts rather than .tsx. When I renamed my base webpart class to .tsx however, a strings file (from locales) failed to load, so I’m wondering if renaming to .tsx isn’t supported in the SPFX toolchain.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AJIXuMuKcommented, Apr 26, 2020

Hi @jimmywim! Sorry for the confusion with the documentation. If you provide a string, even if it contains HTML, it will just render the string as text. If you want to provide HTML, you should create a React.ReactNode object. In the web part you can do it like that:

PropertyFieldLinkWithCallout('fakeProp', {
  calloutTrigger: CalloutTriggers.Click,
  key: 'linkWithCalloutFieldId',
  calloutContent: React.createElement('p', {}, 'Click the link to open a new page with Application Terms & Conditions'),
  calloutWidth: 200,
  text: 'Terms & Conditions',
  href: 'https://github.com/SharePoint/sp-dev-fx-property-controls',
  target: '_blank'
})

Hope it helps!

0reactions
msftbot[bot]commented, May 1, 2020

Closing issue as “answered”. If you encounter similar issue(s), please open up a NEW issue. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide to Markdown Features (Legacy) | Formation Help Center
Markdown is a lightweight markup language and is currently used as the text format for content stored in the Formation APIs. Unlike HTML,...
Read more >
stationery: vignettes/HTML_special_features.Rmd - Rdrr.io
This is about preparing Rmarkdown documents that exploit the special features ... The rendered output is an HTML file that can be opened...
Read more >
Callout Blocks - Quarto
Using callouts is an effective way to highlight content that your reader give special consideration or attention. Format Support. The following formats render...
Read more >
Code Blocks and Callouts | Couchbase Docs
Listing block content is displayed exactly as entered, and any indents and endlines are preserved. If the source style and a language are...
Read more >
callouts warning for code without comments - Google Groups
when generating html from asciidoc (asciidoc article.txt) I often got ... presents a good callouts (which are rendered without warnings) and bad
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found