summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/xml/wysiwyg.xml
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2019-01-28 09:39:56 +0000
committerChristophe Matthieu <chm@odoo.com>2019-02-14 15:11:19 +0000
commitb49745e52d7a7bc27afd416206dcd5fa242aa07a (patch)
treeae6a047da7e77b951db241e1342278ce543972e2 /addons/web_editor/static/src/xml/wysiwyg.xml
parent7daa85dd12ff522be510bc2f8db1d968cae7d891 (diff)
[IMP] web_editor: lazy load the wysiwyg
Issue: wysiwyg asset slow down the loading of the website, error inadvertently introduced: https://github.com/odoo/odoo/pull/29775 The assets are now loaded assynchroneously, when the editor is needed, its assets will be loaded. closes odoo/odoo#30700
Diffstat (limited to 'addons/web_editor/static/src/xml/wysiwyg.xml')
-rw-r--r--addons/web_editor/static/src/xml/wysiwyg.xml42
1 files changed, 42 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/xml/wysiwyg.xml b/addons/web_editor/static/src/xml/wysiwyg.xml
index 5d7754dd7c3..d28efeee92b 100644
--- a/addons/web_editor/static/src/xml/wysiwyg.xml
+++ b/addons/web_editor/static/src/xml/wysiwyg.xml
@@ -2,6 +2,48 @@
<templates id="template" xml:space="preserve">
<!--=================-->
+ <!-- Edition Iframe -->
+ <!--=================-->
+
+ <t t-name="wysiwyg.iframeContent"><head>
+ <meta charset="utf-8"/>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
+ <t t-foreach="asset.cssLibs || []" t-as="cssLib">
+ <link type="text/css" rel="stylesheet" t-att-href="cssLib"/>
+ </t>
+ <t t-foreach="asset.cssContents || []" t-as="cssContent">
+ <style type="text/css" t-raw="cssContent"/>
+ </t>
+ <t t-foreach="asset.jsContents || []" t-as="jsContent" t-if="jsContent.indexOf('inline asset') !== -1">
+ <script type="text/javascript" t-raw="jsContent"/>
+ </t>
+ </head>
+ <body class="o_in_iframe">
+ <div id="iframe_target" style="height: calc(100vh - 6px);"/>
+ <script type="text/javascript">
+ window.$ = window.jQuery = window.top.jQuery;
+ var _summernoteMaster = $.summernote;
+ var _fnSummernoteMaster = $.fn.summernote;
+ delete $.summernote;
+ delete $.fn.summernote;
+ </script>
+ <script type="text/javascript" src="/web_editor/static/lib/summernote/summernote.js"/>
+ <script type="text/javascript">
+ window._summernoteSlave = $.summernote;
+ window._summernoteSlave.iframe = true;
+ window._summernoteSlave.lang = _summernoteMaster.lang;
+ window._fnSummenoteSlave = $.fn.summernote;
+ $.summernote = _summernoteMaster;
+ $.fn.summernote = _fnSummernoteMaster;
+ if (window.top.<t t-esc="updateIframeId"/>) {
+ window.top.<t t-esc="updateIframeId"/>(<t t-esc="avoidDoubleLoad"/>);
+ }
+ </script>
+ </body>
+ </t>
+
+ <!--=================-->
<!-- Edition Dialogs -->
<!--=================-->