From 88c05686521c8d1319a826046bf668f0e870a0ce Mon Sep 17 00:00:00 2001
From: Ratko Zagorac <90400759+zagi25@users.noreply.github.com>
Date: Tue, 18 Feb 2025 19:03:30 +0100
Subject: [PATCH] MWPW-164755:Add
when copying multiple blocks (#3684)
* MWPW-164755:Add
when copying multiple blocks
* MWPW-164755: Update mocks
* MWPW-164755: Add
after every element in the container
* MWPW-164755: Remove string from blob
Co-authored-by: Okan Sahin <39759830+mokimo@users.noreply.github.com>
---------
Co-authored-by: Okan Sahin <39759830+mokimo@users.noreply.github.com>
---
libs/blocks/library-config/lists/blocks.js | 5 +++--
test/blocks/library-config/mocks/blocks/chart/docx.html | 2 +-
.../mocks/blocks/container/docx-container.html | 6 +++---
.../mocks/blocks/container/docx-single-block.html | 2 +-
test/blocks/library-config/mocks/blocks/marquee/docx.html | 2 +-
test/blocks/library-config/mocks/blocks/text/docx.html | 2 +-
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/libs/blocks/library-config/lists/blocks.js b/libs/blocks/library-config/lists/blocks.js
index 19df5a7bcf..621564b493 100644
--- a/libs/blocks/library-config/lists/blocks.js
+++ b/libs/blocks/library-config/lists/blocks.js
@@ -116,7 +116,8 @@ export function getHtml(container, path) {
const isBlock = element.nodeName === 'DIV' && element.className;
const content = isBlock ? getTable(element) : element.outerHTML;
- return `${acc}${content}`;
+ const brTop = !acc || acc.endsWith('
') ? '' : BLOCK_SPACING;
+ return `${acc}${brTop}${content}${BLOCK_SPACING}`;
}, '');
}
@@ -283,7 +284,7 @@ export default async function loadBlocks(blocks, list, query, type) {
const containerHtml = getHtml(container, block.path);
e.target.classList.add('copied');
setTimeout(() => { e.target.classList.remove('copied'); }, 3000);
- const blob = new Blob([`${BLOCK_SPACING}${containerHtml}${BLOCK_SPACING}`], { type: 'text/html' });
+ const blob = new Blob([containerHtml], { type: 'text/html' });
createCopy(blob);
});
item.append(name, copy);
diff --git a/test/blocks/library-config/mocks/blocks/chart/docx.html b/test/blocks/library-config/mocks/blocks/chart/docx.html
index 957326f441..0269a8aa3c 100644
--- a/test/blocks/library-config/mocks/blocks/chart/docx.html
+++ b/test/blocks/library-config/mocks/blocks/chart/docx.html
@@ -1,3 +1,3 @@
chart (area, green, border) |
---|
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.- |
Revenue dollars: 2020 vs 2021 forecasted vs 2021 actuals. |
https://main--milo--adobecom.hlx.page/docs/library/blocks/chart_data/areachart.json |
Footnote lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
carousel (lightbox) |
---|
Carousel lightbox |
section-metadata | |
---|---|
style | xxl spacing |
---
+
carousel (lightbox) |
---|
Carousel lightbox |
section-metadata | |
---|---|
style | xxl spacing |
---
section-metadata | |
---|---|
carousel | Carousel lightbox |
style | Center |
---
+
section-metadata | |
---|---|
carousel | Carousel lightbox |
style | Center |
---
section-metadata | |
---|---|
carousel | Carousel lightbox |
style | Center |
---
+section-metadata | |
---|---|
carousel | Carousel lightbox |
style | Center |
---
carousel (container0) |
---|
Carousel container |
carousel (container0) |
---|
Carousel container |
Kick things off with hundreds of premium and free presets you can access with your Lightroom subscription.
Learn more Explore the premium collection
- +