Updated to support script inside a tag Updated tradeview sample
This commit is contained in:
parent
3dd0ee134c
commit
1fe2cd381b
|
@ -31,26 +31,28 @@ As an example add the following scripts to the web part in order to show stock t
|
|||
```html
|
||||
<!-- TradingView Widget BEGIN -->
|
||||
<div class="tradingview-widget-container">
|
||||
<div id="tradingview_ab4e5"></div>
|
||||
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/symbols/NASDAQ-MSFT/" rel="noopener" target="_blank"><span class="blue-text">MSFT chart</span></a> by TradingView</div>
|
||||
</div>
|
||||
<div id="tradingview_e7aa0"></div>
|
||||
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/symbols/NASDAQ-AAPL/" rel="noopener" target="_blank"><span class="blue-text">AAPL Chart</span></a> by TradingView</div>
|
||||
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
|
||||
<script type="text/javascript">
|
||||
new TradingView.widget({
|
||||
"width": 400,
|
||||
"height": 200,
|
||||
"symbol": "NASDAQ:MSFT",
|
||||
new TradingView.widget(
|
||||
{
|
||||
"width": 980,
|
||||
"height": 610,
|
||||
"symbol": "NASDAQ:AAPL",
|
||||
"interval": "D",
|
||||
"timezone": "Etc/UTC",
|
||||
"theme": "Light",
|
||||
"theme": "light",
|
||||
"style": "1",
|
||||
"locale": "en",
|
||||
"toolbar_bg": "#f1f3f6",
|
||||
"enable_publishing": false,
|
||||
"allow_symbol_change": true,
|
||||
"container_id": "tradingview_ab4e5"
|
||||
});
|
||||
"container_id": "tradingview_e7aa0"
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</div>
|
||||
<!-- TradingView Widget END -->
|
||||
```
|
||||
|
||||
|
|
|
@ -140,12 +140,11 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart<IScriptEd
|
|||
|
||||
// main section of function
|
||||
const scripts = [];
|
||||
const children_nodes = element.childNodes;
|
||||
const children_nodes = element.getElementsByTagName("script");
|
||||
|
||||
for (let i = 0; children_nodes[i]; i++) {
|
||||
const child: any = children_nodes[i];
|
||||
if (this.nodeName(child, "script") &&
|
||||
(!child.type || child.type.toLowerCase() === "text/javascript")) {
|
||||
if (!child.type || child.type.toLowerCase() === "text/javascript") {
|
||||
scripts.push(child);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,26 +29,28 @@ As an example add the following scripts to the web part in order to show stock t
|
|||
```html
|
||||
<!-- TradingView Widget BEGIN -->
|
||||
<div class="tradingview-widget-container">
|
||||
<div id="tradingview_ab4e5"></div>
|
||||
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/symbols/NASDAQ-MSFT/" rel="noopener" target="_blank"><span class="blue-text">MSFT chart</span></a> by TradingView</div>
|
||||
</div>
|
||||
<div id="tradingview_e7aa0"></div>
|
||||
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/symbols/NASDAQ-AAPL/" rel="noopener" target="_blank"><span class="blue-text">AAPL Chart</span></a> by TradingView</div>
|
||||
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
|
||||
<script type="text/javascript">
|
||||
new TradingView.widget({
|
||||
"width": 400,
|
||||
"height": 200,
|
||||
"symbol": "NASDAQ:MSFT",
|
||||
new TradingView.widget(
|
||||
{
|
||||
"width": 980,
|
||||
"height": 610,
|
||||
"symbol": "NASDAQ:AAPL",
|
||||
"interval": "D",
|
||||
"timezone": "Etc/UTC",
|
||||
"theme": "Light",
|
||||
"theme": "light",
|
||||
"style": "1",
|
||||
"locale": "en",
|
||||
"toolbar_bg": "#f1f3f6",
|
||||
"enable_publishing": false,
|
||||
"allow_symbol_change": true,
|
||||
"container_id": "tradingview_ab4e5"
|
||||
});
|
||||
"container_id": "tradingview_e7aa0"
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</div>
|
||||
<!-- TradingView Widget END -->
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue