Skip to content

Commit

Permalink
Add docs for unsafe attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 24, 2018
1 parent 7791809 commit 4da1464
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/site/config_html_features.md
Expand Up @@ -38,6 +38,7 @@ JBrowse HTMLFeatures tracks, the default legacy track type for range-based featu
|` style->trackLabelCss `|Add arbitrary CSS to the track label|
|` style->histCss `|Add arbitrary CSS to the histogram. Used for HTMLFeatures histograms only|
|` style->featureCss `|Add arbitrary CSS to the features. Used for HTMLFeatures features only|
|`unsafeHTMLFeatures`|Allows rendering raw HTML in the feature labels and descriptions|


<link rel="stylesheet" type="text/css" href="assets/css/track_styles.css"></link>
Expand Down
11 changes: 9 additions & 2 deletions docs/site/mouse_configs.md
Expand Up @@ -34,6 +34,12 @@ Addendum: If the field has multiple values (e.g. multiple DBXrefs or GO terms),
```
This shows that you could, in essence, pre-process the array if you wanted, but the same callback is then called on the individual elements, so you handle both these cases.


### Rendering HTML in popups

If you are using the fmtDetailValue callbacks it is assumed that HTML can be returned. Otherwise if your data contains actual HTML that you want to render you must set `unsafePopup` on your track


### Additional customizations to the pop-up boxes

In JBrowse 1.11.5, some additional customizations to the pop-up boxes were added.
Expand Down Expand Up @@ -163,14 +169,15 @@ The onClick→label attribute from the [previous section](#customizing-left-clic

In JBrowse 1.11.6, the onClick→label attribute was extended further to allow the mouse-over description to be customized using callbacks and template strings.

Example for CanvasFeatures, allows full HTML tooltips. Here the {name} template is automatically filled in with the feature info:
Example for CanvasFeatures, allows full HTML tooltips if you set `unsafeMouseover`. Here the {name} template is automatically filled in with the feature info:

~~~~ {.javascript}
"onClick": {
"label" : "<div style='font:normal 12px Univers,Helvetica,Arial,sans-serif'>Feature name: {name}</div>",
"title" : "{name} {type}",
"action": "defaultDialog"
}
},
"unsafeMouseover": true
~~~~

Example for HTMLFeatures, which only allows plain text descriptions but can support newlines (essentially uses \<div title="..."\> for mouseover).
Expand Down

0 comments on commit 4da1464

Please sign in to comment.