[FIX] website: allow to re-edit social media title

This commit allows you to change the title of the social media block
after the first save. If an element is in a parent that has the class
`o_not_editable` then it is only editable if it has the contenteditable
attribute set to true. We rightfully remove this attribute at saving but
without putting it back when we return to edit mode. This commit allows
to fix this case. Note that we have to improve this system in the future
(so we can get rid of this patch).

This part of the fix is very similar to [this other fix] for the team
block.

[this other fix]: https://github.com/odoo/odoo/commit/b7d53d2fcb20a447fd3098adf94ffb33bc49dda9

task-3073171

closes odoo/odoo#134281

Part-of: odoo/odoo#105964
X-original-commit: 44b0bcbdd67721e3b45567d26da00e4a3910f541
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
This commit is contained in:
Guillaume (gdi)
2023-09-06 11:50:58 +00:00
parent 620cf19574
commit b16ab7b997
2 changed files with 9 additions and 0 deletions
@@ -489,6 +489,11 @@ export class WysiwygAdapterComponent extends Wysiwyg {
$extraEditableZones = $extraEditableZones.add($editableSavableZones
.find('.s_social_media a > i'));
// TODO find a similar system for texts.
// grep: SOCIAL_MEDIA_TITLE_CONTENTEDITABLE
$extraEditableZones = $extraEditableZones.add($editableSavableZones
.find('.s_social_media .s_social_media_title'));
// To make sure the selection remains bounded to the active tab,
// each tab is made non editable while keeping its nested
// oe_structure editable. This avoids having a selection range span
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--
For the moment we hack the contenteditable system so that the social media
title stay editable after a save (see SOCIAL_MEDIA_TITLE_CONTENTEDITABLE).
-->
<template id="s_social_media" name="Social Media">
<div class="s_social_media text-start o_not_editable" contenteditable="false">
<h4 class="s_social_media_title d-none" contenteditable="true">Social Media</h4>