summaryrefslogtreecommitdiff
path: root/addons/web_editor
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-07-29 14:10:30 +0200
committerChristophe Simonis <chs@odoo.com>2019-07-29 14:10:30 +0200
commitd5e1fd16b4fd796cc25b2b2d694dadb375110ce7 (patch)
tree35d130b4161985cd9ca3071a59980b52e8401be5 /addons/web_editor
parentae71f95371b4a5c99c10a23e3553c5badc45a1ac (diff)
parentcda4f3c308ca233aead81f5ae97d250b5b7bf82f (diff)
[MERGE] forward port branch saas-12.4 up to cda4f3c308c
Diffstat (limited to 'addons/web_editor')
-rw-r--r--addons/web_editor/i18n/km.po4
-rw-r--r--addons/web_editor/i18n/vi.po2
-rw-r--r--addons/web_editor/models/ir_ui_view.py18
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/history.js6
-rw-r--r--addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js4
5 files changed, 21 insertions, 13 deletions
diff --git a/addons/web_editor/i18n/km.po b/addons/web_editor/i18n/km.po
index 702cddccbb2..0ca4f16327a 100644
--- a/addons/web_editor/i18n/km.po
+++ b/addons/web_editor/i18n/km.po
@@ -378,7 +378,7 @@ msgstr ""
#: code:addons/web_editor/static/src/xml/snippets.xml:15
#, python-format
msgid "Customize"
-msgstr ""
+msgstr "អតិថិជន"
#. module: web_editor
#. openerp-web
@@ -1017,7 +1017,7 @@ msgstr ""
#: code:addons/web_editor/static/src/xml/editor.xml:309
#, python-format
msgid "Preview"
-msgstr ""
+msgstr "ពីមុន"
#. module: web_editor
#. openerp-web
diff --git a/addons/web_editor/i18n/vi.po b/addons/web_editor/i18n/vi.po
index 8bcf0142fcb..9b93ed3e375 100644
--- a/addons/web_editor/i18n/vi.po
+++ b/addons/web_editor/i18n/vi.po
@@ -1072,7 +1072,7 @@ msgstr ""
#. module: web_editor
#: model:ir.model,name:web_editor.model_ir_qweb_field_float
msgid "Qweb Field Float"
-msgstr ""
+msgstr "Qweb Field Float"
#. module: web_editor
#: model:ir.model,name:web_editor.model_ir_qweb_field_html
diff --git a/addons/web_editor/models/ir_ui_view.py b/addons/web_editor/models/ir_ui_view.py
index 653bdd038f1..edda3ba6887 100644
--- a/addons/web_editor/models/ir_ui_view.py
+++ b/addons/web_editor/models/ir_ui_view.py
@@ -199,7 +199,7 @@ class IrUiView(models.Model):
self.write({'arch': self._pretty_arch(new_arch)})
@api.model
- def _view_get_inherited_children(self, view, options):
+ def _view_get_inherited_children(self, view):
return view.inherit_children_ids
@api.model
@@ -216,7 +216,7 @@ class IrUiView(models.Model):
# Used by translation mechanism, SEO and optional templates
@api.model
- def _views_get(self, view_id, options=True, bundles=False, root=True):
+ def _views_get(self, view_id, get_children=True, bundles=False, root=True):
""" For a given view ``view_id``, should return:
* the view itself
* all views inheriting from it, enabled or not
@@ -245,17 +245,17 @@ class IrUiView(models.Model):
except ValueError:
continue
if called_view and called_view not in views_to_return:
- views_to_return += self._views_get(called_view, options=options, bundles=bundles)
+ views_to_return += self._views_get(called_view, get_children=get_children, bundles=bundles)
- extensions = self._view_get_inherited_children(view, options)
- if not options:
- # only active children
- extensions = extensions.filtered(lambda view: view.active)
+ if not get_children:
+ return views_to_return
- # Keep options in a deterministic order regardless of their applicability
+ extensions = self._view_get_inherited_children(view)
+
+ # Keep children in a deterministic order regardless of their applicability
for extension in extensions.sorted(key=lambda v: v.id):
# only return optional grandchildren if this child is enabled
- for ext_view in self._views_get(extension, options=extension.active, root=False):
+ for ext_view in self._views_get(extension, get_children=extension.active, root=False):
if ext_view not in views_to_return:
views_to_return += ext_view
return views_to_return
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/history.js b/addons/web_editor/static/src/js/wysiwyg/plugin/history.js
index a60ab41523b..addf6383783 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/history.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/history.js
@@ -19,6 +19,12 @@ var HistoryPlugin = Plugins.history.extend({
console.error(e);
}
this.context.invoke('editor.focus');
+ var newRange = this.context.invoke('editor.createRange');
+ if (!this.options.isEditableNode(newRange.sc)) {
+ var firstEditableSel = '[contenteditable="true"]:not(":hidden")';
+ var sc = this.$editable.find(firstEditableSel)[0];
+ this.context.invoke('editor.setRange', sc, 0, sc, 0).select();
+ }
},
/**
* Clear the history.
diff --git a/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js b/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js
index 9bc9124688b..d13ddf63038 100644
--- a/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js
+++ b/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js
@@ -358,6 +358,8 @@ var SnippetEditor = Widget.extend({
ev.preventDefault();
this.trigger_up('cover_will_change');
+ this.trigger_up('snippet_will_be_cloned', {$target: this.$target});
+
var $clone = this.$target.clone(false);
this.trigger_up('request_history_undo_record', {$target: this.$target});
@@ -372,7 +374,7 @@ var SnippetEditor = Widget.extend({
}
},
});
- this.trigger_up('snippet_cloned', {$target: $clone});
+ this.trigger_up('snippet_cloned', {$target: $clone, $origin: this.$target});
$clone.trigger('content_changed');
},
/**