summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2018-10-31 10:42:06 +0000
committerXavier Morel <xmo@odoo.com>2019-01-29 10:22:17 +0000
commit42fbee83ad2f3f33188cf27a1449b8875c2d8a2a (patch)
treec607de0f5bdaba2a246650ff96499d6eab3edac7 /addons/web_editor/static/src/js
parentbf4a8b3de81783cf2da1145a618e97c18f780719 (diff)
[IMP] qweb: stop requiring t-name-flagged sub-node
QWeb's rendering currently *requires* that when loading a document instead of rendering the document itself it will render a sub-node with a properly labeled t-name. If a view is invoked by id, ir.qweb will look for a child with a t-name and fix up that t-name such that the base qweb object will find and render it. This feature mostly exists for JS compatibility (because a single document can contain multiple cross-linkable templates, and it was useful for cross-implementation tests though I'm not sue they're even checked anymore), and the <template> tag kinda took care of it, however with a more proper qweb view it becomes more of a liability / pain in the ass. Note: turns out there are bits of javascript which read server templates (???) and need to be altered to correctly handle the lack of <templates> wrapping.
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/font.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/font.js b/addons/web_editor/static/src/js/wysiwyg/plugin/font.js
index 91ac93470ba..c52712d7a02 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/font.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/font.js
@@ -549,6 +549,9 @@ registry.addJob(function (wysiwyg) {
context: options.context,
},
}).then(function (template) {
+ if (!/^<templates>/.test(template)) {
+ template = _.str.sprintf('<templates>%s</templates>', template);
+ }
QWeb.add_template(template);
});
});