diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/link.js b/addons/web_editor/static/src/js/wysiwyg/widgets/link.js
index 76a8438d952..32f0ba20662 100644
--- a/addons/web_editor/static/src/js/wysiwyg/widgets/link.js
+++ b/addons/web_editor/static/src/js/wysiwyg/widgets/link.js
@@ -1,6 +1,8 @@
/** @odoo-module **/
import * as OdooEditorLib from "@web_editor/js/editor/odoo-editor/src/OdooEditor";
+import { _t } from "@web/core/l10n/translation";
+import { isVisible } from "@web/core/utils/ui";
import weUtils from "@web_editor/js/common/utils";
import {
Component,
@@ -15,7 +17,6 @@ import {
const getDeepRange = OdooEditorLib.getDeepRange;
const getInSelection = OdooEditorLib.getInSelection;
const EMAIL_REGEX = OdooEditorLib.EMAIL_REGEX;
-import { _t } from "@web/core/l10n/translation";
/**
* Allows to customize link content and style.
@@ -133,6 +134,15 @@ export class Link extends Component {
}
}
}
+ // When multiple buttons follow each other, they may break on 2 lines
+ // or more on mobile, so they need a margin-bottom.
+ if (data.classes.split(" ").includes("btn")) {
+ const closestButtonSiblingEls = this._getDirectButtonSiblings(this.linkEl);
+ if (closestButtonSiblingEls.length) {
+ data.classes += " mb-2";
+ closestButtonSiblingEls.forEach(btnEl => btnEl.classList.add("mb-2"));
+ }
+ }
if (['btn-custom', 'btn-outline-custom', 'btn-fill-custom'].some(className =>
data.classes.includes(className)
)) {
@@ -552,16 +562,45 @@ export class Link extends Component {
const allBtnColorPrefixes = /(^|\s+)(bg|text|border)(-[a-z0-9_-]*)?/gi;
const allBtnClassSuffixes = /(^|\s+)btn(-[a-z0-9_-]*)?/gi;
const allBtnShapes = /\s*(rounded-circle|flat)\s*/gi;
+ const btnMarginBottom = /(? {
+ let siblingNode = el[`${side}Sibling`];
+ while (siblingNode) {
+ // If the node is an empty text node, or if it is a
tag or
+ // an invisible element, it is not taken into account.
+ if ((siblingNode.nodeType === 3 && !!siblingNode.textContent.match(/^\s*$/)) ||
+ (siblingNode.nodeType === 1 &&
+ (siblingNode.nodeName === "BR" || !isVisible(siblingNode)))) {
+ siblingNode = siblingNode[`${side}Sibling`];
+ continue;
+ }
+ if (siblingNode.nodeType === 1 && siblingNode.classList.contains("btn")) {
+ buttonSiblingsEls.push(siblingNode);
+ }
+ break;
+ }
+ return buttonSiblingsEls;
+ }, []);
+ }
//--------------------------------------------------------------------------
// Handlers
diff --git a/addons/website/views/snippets/s_banner.xml b/addons/website/views/snippets/s_banner.xml
index 7cc6a07de67..fd7dfda7f2a 100644
--- a/addons/website/views/snippets/s_banner.xml
+++ b/addons/website/views/snippets/s_banner.xml
@@ -9,7 +9,7 @@
This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.
-
-
Use this snippet to presents your content in a slideshow-like format. Don't write about products or services here, write about solutions.
- Contact us + Contact us
@@ -37,7 +37,7 @@Storytelling is powerful.
It draws readers in and engages them.
Color blocks are a simple and effective way to present and highlight your content. Choose an image or a color for the background. You can even resize and duplicate the blocks to create your own layout. Add images or icons to customize the blocks.
- More Details + More DetailsColor blocks are a simple and effective way to present and highlight your content. Choose an image or a color for the background. You can even resize and duplicate the blocks to create your own layout. Add images or icons to customize the blocks.
- More Details + More DetailsWrite one or two paragraphs describing your product, services or a specific feature.
To be successful your content needs to be useful to your readers.
-
Write one or two paragraphs describing your product or services. To be successful your content needs to be useful to your readers.
Start with the customer – find out what they want and give it to them.
- + diff --git a/addons/website/views/snippets/s_media_list.xml b/addons/website/views/snippets/s_media_list.xml index 176c1a165bb..0c200cf1561 100644 --- a/addons/website/views/snippets/s_media_list.xml +++ b/addons/website/views/snippets/s_media_list.xml @@ -13,7 +13,7 @@Use this snippet to build various types of components that feature a left- or right-aligned image alongside textual content. Duplicate the element to create a list that fits your needs.
- Discover + DiscoverWrite one or two paragraphs describing your product, services or a specific feature. To be successful your content needs to be useful to your readers.
-Write one or two paragraphs describing your product or services. To be successful your content needs to be useful to your readers.
Start with the customer – find out what they want and give it to them.
- +