use iftame for wysiwig

This commit is contained in:
Yuri Kuznetsov
2014-05-05 17:23:32 +03:00
parent a090a046f6
commit 8f4880b4e6
2 changed files with 30 additions and 1 deletions
@@ -1 +1,5 @@
{{{value}}}
<iframe frameborder="0" scrolling="no" style="width: 100%;"></iframe>
@@ -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 = '<style>@font-face {' +
'font-family: Open Sans;' +
'src: url(\'client/fonts/open-sans-regular.eot?\') format(\'eot\'),' +
'url(\'client/fonts/open-sans-regular.woff\') format(\'woff\'),' +
'url(\'client/fonts/open-sans-regular.ttf\') format(\'truetype\'),' +
'url(\'client/fonts/open-sans-regular.svg#svgFontName\') format(\'svg\');' +
'}' +
'body {font-size: 14px;}' +
'</style>' + body;
document.write(body);
document.body.style.fontFamily = 'Open Sans';
document.close();
iframe.style.height = document.body.scrollHeight + 'px';
}
},
enableWysiwygMode: function () {