summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-09-21 12:21:34 +0200
committerqsm-odoo <qsm@odoo.com>2016-09-21 13:16:59 +0200
commitb51e8a8a03249b93a4a881f114a27f41114ee542 (patch)
tree9ea93ce383227abd883494ed6869fc0928033778 /addons/web_editor/static/src
parent1fa0990a9ab9e4d3975e20dd38f32764d568989d (diff)
[FIX] mass_mailing, *: allow to auto select default text of templates
* + web_editor The feature was only activated in the web_editor in snippet contents (before they are dropped in the page). Now, on first theme selection, the feature is activated in the template content.
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/snippets.editor.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js
index cc2d6fcbc38..f20b693c458 100644
--- a/addons/web_editor/static/src/js/snippets.editor.js
+++ b/addons/web_editor/static/src/js/snippets.editor.js
@@ -258,11 +258,7 @@ data.Class = Widget.extend({
$("body").toggleClass("editor_has_snippets", !!number);
// select all default text to edit (if snippet default text)
- self.$snippets.find('.oe_snippet_body, .oe_snippet_body *')
- .contents()
- .filter(function () {
- return this.nodeType === 3 && this.textContent.match(/\S/);
- }).parent().addClass("o_default_snippet_text");
+ this.add_default_snippet_text_classes();
$(document).on("click", ".o_default_snippet_text", function (event) {
$(event.target).selectContent();
});
@@ -304,6 +300,18 @@ data.Class = Widget.extend({
});
},
+ add_default_snippet_text_classes: function ($in) {
+ if ($in === undefined) {
+ $in = this.$snippets.find(".oe_snippet_body");
+ }
+
+ $in.find("*").addBack()
+ .contents()
+ .filter(function () {
+ return this.nodeType === 3 && this.textContent.match(/\S/);
+ }).parent().addClass("o_default_snippet_text");
+ },
+
cover_target: function ($el, $target) {
if ($el.data('not-cover_target')) {
return;