From 8f4880b4e649bd35aef988b408eb64af6f2ebdb6 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 5 May 2014 17:23:32 +0300 Subject: [PATCH] use iftame for wysiwig --- .../res/templates/fields/wysiwyg/detail.tpl | 6 ++++- frontend/client/src/views/fields/wysiwyg.js | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/frontend/client/res/templates/fields/wysiwyg/detail.tpl b/frontend/client/res/templates/fields/wysiwyg/detail.tpl index 741894a44f..0b0eae55ba 100644 --- a/frontend/client/res/templates/fields/wysiwyg/detail.tpl +++ b/frontend/client/res/templates/fields/wysiwyg/detail.tpl @@ -1 +1,5 @@ -{{{value}}} + + + + + diff --git a/frontend/client/src/views/fields/wysiwyg.js b/frontend/client/src/views/fields/wysiwyg.js index 901e5aeff1..2111f2610e 100644 --- a/frontend/client/src/views/fields/wysiwyg.js +++ b/frontend/client/src/views/fields/wysiwyg.js @@ -68,6 +68,31 @@ Espo.define('Views.Fields.Wysiwyg', 'Views.Fields.Text', function (Dep) { this.enableWysiwygMode(); } } + + if (this.mode == 'detail') { + var iframe = this.$el.find('iframe').get(0); + var document = iframe.contentWindow.document; + + document.open('text/html', 'replace'); + var body = this.model.get('body'); + + body = '' + body; + + + document.write(body); + document.body.style.fontFamily = 'Open Sans'; + + document.close(); + iframe.style.height = document.body.scrollHeight + 'px'; + } }, enableWysiwygMode: function () {