summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorSamuel Degueldre <sad@odoo.com>2019-10-18 09:06:09 +0000
committerqsm-odoo <qsm@odoo.com>2019-11-18 09:56:08 +0000
commitf615cfda89dae2e9a550d25868b11bc06b97cfcb (patch)
tree03a13d7a551ffd5bab684a72ad4692f45877dd35 /addons/web_editor/static/src
parentbf5b4b69330747af7b09d48e59218b78a29a4b14 (diff)
[IMP] website, *: rework snippet anchor system
* web_editor Previously, the user could choose their anchor names using a modal window, anchor names also have weird rules, this was not a great user experience. This commit makes the anchor button generate anchors automatically based on the first title in a section, or the snippet name if there are none. If the anchor name is already taken, it is suffixed by a number. After it has been generated, it is also copied to the clipboard and the user is shown a toast to tell them the anchor has been generated and copied. The anchor is displayed in the toast along with an edit button that will open the same edition modal as previously, but it is now less restrictive. Part of https://github.com/odoo/odoo/pull/38959 maintask-2066614 task-2088270
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.editor.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js
index 3b3b6f8fd86..417d0daabb2 100644
--- a/addons/web_editor/static/src/js/editor/snippets.editor.js
+++ b/addons/web_editor/static/src/js/editor/snippets.editor.js
@@ -453,7 +453,7 @@ var SnippetEditor = Widget.extend({
this,
val.base_target ? this.$target.find(val.base_target).eq(0) : this.$target,
this.$el,
- val.data,
+ _.extend({snippetName: this._getName()}, val.data),
this.options
);
var key = optionName || _.uniqueId('option');
@@ -813,7 +813,7 @@ var SnippetsMenu = Widget.extend({
if (!$target.closest('body > *').length) {
return;
}
- if ($target.closest('#web_editor-top-edit, #oe_snippets, #oe_manipulators, .o_technical_modal, .oe_drop_zone').length) {
+ if ($target.closest('#web_editor-top-edit, #oe_snippets, #oe_manipulators, .o_technical_modal, .oe_drop_zone, .o_notification_manager').length) {
return;
}
this._activateSnippet($target);