From c272b4f9371e3681fd19fdf48cc4447069fb5a31 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 8 May 2014 16:32:46 +0200 Subject: [PATCH] [WO-323] Render HTML content in sandboxed iframe --- src/js/controller/read.js | 14 +++++++++----- src/sass/views/_read.scss | 27 +++++++++++++++++---------- src/tpl/read.html | 37 +++++++++++++++++++++++-------------- 3 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/js/controller/read.js b/src/js/controller/read.js index 8a054ab..da173fb 100644 --- a/src/js/controller/read.js +++ b/src/js/controller/read.js @@ -330,11 +330,15 @@ define(function(require) { }; }); - ngModule.directive('frameLoad', function() { - return function(scope, elm) { - elm.bind('load', function() { - var frame = elm[0]; - frame.height = frame.contentWindow.document.body.scrollHeight + 'px'; + ngModule.directive('frameLoad', function($parse, $sce, $timeout) { + return function(scope, elm, attrs) { + scope.$watch(attrs.frameLoad, function(value) { + scope.html = undefined; + if (value) { + $timeout(function() { + scope.html = $sce.trustAsHtml(value); + }); + } }); }; }); diff --git a/src/sass/views/_read.scss b/src/sass/views/_read.scss index 7ebb8de..d9694c5 100644 --- a/src/sass/views/_read.scss +++ b/src/sass/views/_read.scss @@ -87,13 +87,9 @@ } } - .body { + .working-wrapper { flex-grow: 1; position: relative; - margin-top: 1.75em; - line-height: 1.5em; - overflow-y: scroll; - user-select: text; .working { @include scut-vcenter-tt; @@ -106,6 +102,22 @@ vertical-align: middle; } } + } + + iframe { + flex-grow: 1; + margin-top: 1.75em; + width: 100%; + height: 100%; + border: none; + } + + .body { + flex-grow: 1; + margin-top: 1.75em; + line-height: 1.5em; + overflow-y: scroll; + user-select: text; .line { cursor: text; @@ -147,11 +159,6 @@ } } - iframe { - flex-grow: 1; - width: 100%; - } - .reply-selection { .popover-content { padding: 0; diff --git a/src/tpl/read.html b/src/tpl/read.html index ce0dcba..f3d7862 100644 --- a/src/tpl/read.html +++ b/src/tpl/read.html @@ -1,4 +1,5 @@
+
@@ -43,21 +44,28 @@
-
-
- - -
-
- -
-
+ +
+
- +
+
+ + + + + +
+
+
@@ -74,4 +82,5 @@
  • -
    + +
    \ No newline at end of file