soames-astro-theme 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -205,6 +205,17 @@ const handleShortcodes: HTMLReactParserOptions["replace"] = (node) => {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
if (classes.includes("wp-block-soames-text-list")) {
|
|
208
|
+
const attrs = (node as DomElement).attribs;
|
|
209
|
+
// ORBI-42: new blocks emit JSON `data-items` (one HTML chunk per list item).
|
|
210
|
+
// Old blocks emit their inner HTML directly — keep rendering that as-is.
|
|
211
|
+
if (attrs["data-items"]) {
|
|
212
|
+
try {
|
|
213
|
+
const items = JSON.parse(attrs["data-items"]);
|
|
214
|
+
if (Array.isArray(items)) return <SoamesTextList items={items} />;
|
|
215
|
+
} catch {
|
|
216
|
+
/* malformed JSON — fall through to the legacy passthrough below */
|
|
217
|
+
}
|
|
218
|
+
}
|
|
208
219
|
return (
|
|
209
220
|
<section className="soames-section article soames-list pb-0">
|
|
210
221
|
<div className="container">
|
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import parse from "html-react-parser";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
// ORBI-42 grouped format: one HTML chunk per list item.
|
|
5
|
+
interface TextItem {
|
|
4
6
|
content: string;
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
interface SoamesTextListProps {
|
|
10
|
+
// New (ORBI-42) grouped items from the block's data-items JSON.
|
|
11
|
+
items?: TextItem[];
|
|
12
|
+
// Legacy [soames-text-list] shortcode: a single string, split on the sentinel.
|
|
13
|
+
content?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const SoamesTextList: React.FC<SoamesTextListProps> = ({ items, content }) => {
|
|
17
|
+
// Prefer the grouped items; fall back to the legacy sentinel-split string.
|
|
18
|
+
const listItems: string[] =
|
|
19
|
+
items && items.length
|
|
20
|
+
? items.map((it) => it?.content ?? "")
|
|
21
|
+
: (content ?? "").split("__SOAMES_LI__");
|
|
22
|
+
|
|
23
|
+
const cleaned = listItems.filter((html) => (html ?? "").trim().length > 0);
|
|
9
24
|
|
|
25
|
+
// `soames-text-list` carries the top/bottom padding (ORBI-42) that replaces the
|
|
26
|
+
// old manual <br><br> spacers — see styles/soames/overrides.css. Note: no pt-0/
|
|
27
|
+
// pb-0 here (they previously zeroed the padding).
|
|
10
28
|
return (
|
|
11
|
-
<section className="soames-section article soames-list
|
|
29
|
+
<section className="soames-section article soames-list soames-text-list">
|
|
12
30
|
<div className="container">
|
|
13
31
|
<div className="media-container-row">
|
|
14
|
-
<div className="soames-text counter-container col-12 col-md-10 mbr-fonts-style
|
|
32
|
+
<div className="soames-text counter-container col-12 col-md-10 mbr-fonts-style display-7">
|
|
15
33
|
<ul>
|
|
16
|
-
{
|
|
17
|
-
<li key={key}>{
|
|
34
|
+
{cleaned.map((html, key) => (
|
|
35
|
+
<li key={key}>{parse(html)}</li>
|
|
18
36
|
))}
|
|
19
37
|
</ul>
|
|
20
38
|
</div>
|
|
@@ -1779,6 +1779,14 @@ section.lazy-placeholder:after {
|
|
|
1779
1779
|
color: #000000;
|
|
1780
1780
|
}
|
|
1781
1781
|
|
|
1782
|
+
/* ORBI-42: the refactored Soames Text List carries its own symmetric top/bottom
|
|
1783
|
+
padding (replacing the old manual <br><br> spacers). Scoped to this class so
|
|
1784
|
+
other .soames-list consumers keep their existing spacing. */
|
|
1785
|
+
.soames-text-list {
|
|
1786
|
+
padding-top: 45px;
|
|
1787
|
+
padding-bottom: 45px;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1782
1790
|
.soames-footer {
|
|
1783
1791
|
padding-top: 15px;
|
|
1784
1792
|
padding-bottom: 15px;
|