summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-07-26 15:12:29 +0200
committerChristophe Simonis <chs@odoo.com>2019-07-26 15:12:29 +0200
commitbfd34e14b1be97465e135d85c76b9e626a219e7a (patch)
tree8de54ec8f504158e965ab92e21658cab539024ee /addons/web_editor/static/src
parent26b5b446b3dab3d66b7db054ca77e7b1a811c28a (diff)
parent40e8b67179f212551a176d72b3851671febc1fba (diff)
[MERGE] forward port branch saas-12.3 up to 40e8b67179f
Diffstat (limited to 'addons/web_editor/static/src')
-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
2 files changed, 9 insertions, 1 deletions
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');
},
/**