This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhtml-content.tsx
More file actions
78 lines (70 loc) · 3.59 KB
/
html-content.tsx
File metadata and controls
78 lines (70 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* Loading HTML content sample
*/
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
import { TooltipComponent } from '@syncfusion/ej2-react-popups';
import * as React from 'react';
import { SampleBase } from '../common/sample-base';
import './html-content.css';
export class HtmlContentTooltip extends SampleBase<{}, {}> {
public tooltipObj: TooltipComponent;
public onClick(args: any): void {
if (!args.target.classList.contains('e-control') &&
!args.target.classList.contains('e-btn')) {
if (this.tooltipObj && document.getElementsByClassName('e-tooltip-wrap').length > 0) {
this.tooltipObj.close();
}
}
}
public onScroll(): void {
if (this.tooltipObj && document.getElementsByClassName('e-tooltip-wrap').length > 0) {
this.tooltipObj.close();
}
}
public created(): void {
if (document.getElementById('right-pane')) {
document.getElementById('right-pane').addEventListener('click', this.onClick.bind(this));
document.getElementById('right-pane').addEventListener('scroll', this.onScroll.bind(this));
}
}
render() {
function tooltipTemplate(): JSX.Element {
return (
<div id="democontent" className="democontent">
<h3 style={{ marginTop: '10px' }}>Eastern Bluebird</h3>
<img id="bird" src="./src/tooltip/images/bird.png" />
<p>The <a href="https://en.wikipedia.org/wiki/Eastern_bluebird" target="_blank"> Eastern Bluebird</a>
is easily found in open fields and sparse woodland areas, including along woodland edges. These
are cavity-nesting birds and a pair of eastern bluebirds will raise 2-3 broods annually, with 2-8 light blue
or whitish eggs per brood.</p>
<hr className="tooltip_hr"/>
<p>Eastern bluebirds can be very vocal in flocks.
Their calls include a rapid, mid-tone chatter and several long dropping pitch calls.</p>
<p>Source:<br />
<a href="https://en.wikipedia.org/wiki/Eastern_bluebird" target="_blank">https://en.wikipedia.org/wiki/Eastern_bluebird</a>
</p>
</div>
);
}
return (
<div className='control-pane'>
<div className='control-section'>
<div id="htmlTemplate" className="col-lg-12 control-section">
<TooltipComponent id='content' created={this.created.bind(this)} content={tooltipTemplate} opensOn='Click' cssClass='e-tooltip-template-css' ref={t => this.tooltipObj = t}>
<div id="customization">
<ButtonComponent cssClass='e-outline' isPrimary={true} className="text" id="content">HTML Template</ButtonComponent>
</div>
</TooltipComponent>
</div>
</div>
<div id="action-description">
<p>This sample demonstrates customizing tooltip content to display a HTML page.</p>
</div>
<div id="description">
<p> Tooltip content has been customized using HTML tags and CSS, i.e. the content can be loaded with HTML tags such as <img>,
<a>,<b>, etc. Title can also be added to the content. Overall, the tooltip content can be customized to appear like a web page.</p>
</div>
</div>
)
}
}