[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:
Samuel Degueldre
2019-11-18 09:56:08 +00:00
committed by qsm-odoo
parent bf5b4b6933
commit f615cfda89
4 changed files with 60 additions and 23 deletions
@@ -115,7 +115,6 @@
<div class="col-md-9">
<input type="text" class="form-control o_input_anchor_name" id="anchorName" t-attf-value="#{currentAnchor}" placeholder="Anchor name"/>
<div class="invalid-feedback">
<p class="d-none o_anchor_not_valid">The chosen name is not valid (use only a-Z A-Z 0-9 - _)</p>
<p class="d-none o_anchor_already_exists">The chosen name already exists</p>
</div>
</div>