[FIX] web_editor: fix custom snippets thumbnail

This commit fixes 3 issues with the custom snippets thumbnail:

- The tooltip ("Drag and drop the building block") appears during
edition of the name of the custom snippet, it should not.

- There was no space between the "Confirm" and "Cancel" buttons when
editing the name of the custom snippet.

- Starting from version 16.2 (although already fixed in the 16.0
commit), the "Cancel" button was positioned below the "Confirm" button
instead of being on the same line. This was due to JQuery 3.6.3, which
no longer correctly supported self-closing elements like "<we-button>"
for this particular issue.

task-3572270

closes odoo/odoo#140998

X-original-commit: 9f682306a9d4c1fc9bcd55a41d411ccc190573ad
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
Benjamin Vray
2023-11-06 11:16:45 +00:00
parent 407f1b1d7e
commit f504bb7bc3
2 changed files with 5 additions and 3 deletions
@@ -4024,8 +4024,8 @@ var SnippetsMenu = Widget.extend({
<we-input class="o_we_user_value_widget w-100 mx-1">
<div>
<input type="text" autocomplete="chrome-off" value="${snippetName}" class="text-start"/>
<we-button class="o_we_confirm_btn o_we_text_success fa fa-check" title="${confirmText}"/>
<we-button class="o_we_cancel_btn o_we_text_danger fa fa-times" title="${cancelText}"/>
<we-button class="o_we_confirm_btn o_we_text_success fa fa-check" title="${confirmText}"></we-button>
<we-button class="o_we_cancel_btn o_we_text_danger fa fa-times" title="${cancelText}"></we-button>
</div>
</we-input>
`);
@@ -4079,7 +4079,8 @@ var SnippetsMenu = Widget.extend({
*/
_onMouseUp(ev) {
const snippetEl = ev.target.closest('.oe_snippet');
if (snippetEl) {
if (snippetEl && !snippetEl.querySelector(".o_we_already_dragging")
&& !ev.target.matches(".o_rename_btn")) {
this._showSnippetTooltip($(snippetEl));
}
},
@@ -451,6 +451,7 @@
@extend %we-generic-clickable;
cursor: pointer;
flex: 1 1 auto;
padding: 0 $o-we-sidebar-content-field-button-group-button-spacing;
line-height: 17px;
text-align: center;