From 0060823de68f44ba12d2cf0bf3f806fe4d2f6bb9 Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 7 Dec 2017 15:52:59 +0200 Subject: [PATCH] changes --- client/src/views/fields/wysiwyg.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/client/src/views/fields/wysiwyg.js b/client/src/views/fields/wysiwyg.js index 577f240ab3..eb11e425be 100644 --- a/client/src/views/fields/wysiwyg.js +++ b/client/src/views/fields/wysiwyg.js @@ -140,24 +140,26 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun this.$el.find('iframe').removeClass('hidden'); var $iframe = this.$el.find('iframe'); - var iframe = this.iframe = $iframe.get(0); - if (!iframe) return; + var iframeElement = this.iframe = $iframe.get(0); + if (!iframeElement) return; $iframe.load(function () { $iframe.contents().find('a').attr('target', '_blank'); }); - var doc = iframe.contentWindow.document; + var documentElement = iframeElement.contentWindow.document; - var link = ''; + var linkElement = documentElement.createElement('link'); + linkElement.type = 'text/css'; + linkElement.rel = 'stylesheet'; + linkElement.href = this.getBasePath() + 'client/css/iframe.css'; - doc.open('text/html', 'replace'); var body = this.sanitizeHtml(this.model.get(this.name) || ''); - body += link; + documentElement.write(body); + documentElement.close(); - doc.write(body); - doc.close(); + iframeElement.contentWindow.document.head.appendChild(linkElement); var processHeight = function () { var $body = $iframe.contents().find('html body'); @@ -166,7 +168,7 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun height = $body.children(0).height() + 100; } height += 30; - iframe.style.height = height + 'px'; + iframeElement.style.height = height + 'px'; }; setTimeout(function () {