Skip to content
Snippets Groups Projects
Commit 7b85286c authored by Tögl, Christina's avatar Tögl, Christina
Browse files

Add possibility for interactive, clickable HTML content to info tooltip

parent 727a8190
No related branches found
No related tags found
No related merge requests found
Pipeline #55459 failed
...@@ -61,7 +61,7 @@ export class TooltipDemo extends ScopedElementsMixin(DBPLitElement) { ...@@ -61,7 +61,7 @@ export class TooltipDemo extends ScopedElementsMixin(DBPLitElement) {
</div> </div>
<div class="container"> <div class="container">
<p>Mind the gap! <p>Mind the gap!
<dbp-info-tooltip text-content="tippy info tooltip demo text"></dbp-info-tooltip> <dbp-info-tooltip text-content="tippy info tooltip demo text" interactive></dbp-info-tooltip>
</p> </p>
<p>Mind the gap! <p>Mind the gap!
......
...@@ -12,6 +12,7 @@ export class InfoTooltip extends ScopedElementsMixin(DBPLitElement) { ...@@ -12,6 +12,7 @@ export class InfoTooltip extends ScopedElementsMixin(DBPLitElement) {
super(); super();
this.tippy = ''; this.tippy = '';
this.textContent = 'missing text.'; this.textContent = 'missing text.';
this.interactive = false;
} }
static get properties() { static get properties() {
...@@ -19,6 +20,7 @@ export class InfoTooltip extends ScopedElementsMixin(DBPLitElement) { ...@@ -19,6 +20,7 @@ export class InfoTooltip extends ScopedElementsMixin(DBPLitElement) {
...super.properties, ...super.properties,
tippy: { type: Object, attribute: false }, tippy: { type: Object, attribute: false },
textContent: { type: String, attribute: 'text-content' }, textContent: { type: String, attribute: 'text-content' },
interactive: { type: Boolean, attribute: true },
}; };
} }
...@@ -27,6 +29,9 @@ export class InfoTooltip extends ScopedElementsMixin(DBPLitElement) { ...@@ -27,6 +29,9 @@ export class InfoTooltip extends ScopedElementsMixin(DBPLitElement) {
tippy(this._('#info-tooltip-icon'), { tippy(this._('#info-tooltip-icon'), {
content: this.textContent, content: this.textContent,
appendTo: this.shadowRoot, appendTo: this.shadowRoot,
interactive: this.interactive,
allowHTML: this.interactive ? true : false,
hideOnClick: this.interactive ? false : true,
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment