Fix: Sources json viewer event binding

This commit is contained in:
surunzi
2016-10-19 15:02:16 +08:00
parent 1ff830a185
commit e092415318
2 changed files with 5 additions and 4 deletions

View File

@@ -204,7 +204,8 @@ export default class Sources extends Tool
}
_renderJson()
{
this._renderHtml(this._jsonTpl());
// Using cache will keep binding json events to the same elements.
this._renderHtml(this._jsonTpl(), false);
var val = this._data.val;
@@ -221,9 +222,9 @@ export default class Sources extends Tool
{
this._renderHtml(this._iframeTpl({src: this._data.val}));
}
_renderHtml(html)
_renderHtml(html, cache = true)
{
if (html === this._lastHtml) return;
if (cache && html === this._lastHtml) return;
this._lastHtml = html;
this._$el.html(html);
// Need setTimeout to make it work

View File

@@ -8,7 +8,7 @@ $font-size-s: 12px;
$font-size-l: 16px;
$font-family: 'Helvetica Neue', Helvetica, Arial, sans-seri;
$font-family-code: Consolas, "Liberation Mono", Menlo, Courier, monospace;
$font-family-code: Monaco, MonoSpace;
$anim-duration: .3s;