[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
This commit is contained in:
committed by
qsm-odoo
parent
bf5b4b6933
commit
f615cfda89
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user