Skip to content

Commit 68ecb80

Browse files
committed
updates
- add default placeholder - fix adding background scheme - fix adding margins on root
1 parent ee3d178 commit 68ecb80

File tree

4 files changed

+164
-10
lines changed

4 files changed

+164
-10
lines changed

src/block/design-library/edit.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { substitutionRules } from '../../blocks'
2020
* WordPress dependencies
2121
*/
2222
import { __ } from '@wordpress/i18n'
23-
import { dispatch } from '@wordpress/data'
23+
import { dispatch, select } from '@wordpress/data'
2424
import {
2525
createBlock, createBlocksFromInnerBlocksTemplate, getBlockVariations, getBlockType,
2626
} from '@wordpress/blocks'
@@ -75,7 +75,7 @@ const checkIfImageUrl = async value => {
7575
}
7676

7777
// Replaces the current block with a block made out of attributes.
78-
const createBlockWithAttributes = async ( blockName, attributes, innerBlocks, substituteBlocks ) => {
78+
const createBlockWithAttributes = async ( blockName, attributes, innerBlocks, substituteBlocks, parentClientId ) => {
7979
const disabledBlocks = settings.stackable_block_states || {} // eslint-disable-line camelcase
8080

8181
// Recursively substitute core blocks to disabled Stackable blocks
@@ -162,14 +162,14 @@ const createBlockWithAttributes = async ( blockName, attributes, innerBlocks, su
162162
attributes = block[ 0 ].attributes
163163
innerBlocks = block[ 0 ].innerBlocks
164164

165-
if ( attributes.hasBackground ) {
165+
if ( ! parentClientId && attributes.hasBackground ) {
166166
attributes.blockMargin = {
167167
top: '',
168168
right: '',
169169
bottom: '0',
170170
left: '',
171171
}
172-
} else {
172+
} else if ( ! parentClientId ) {
173173
attributes.blockMargin = {
174174
top: '120',
175175
right: '',
@@ -199,6 +199,9 @@ const Edit = props => {
199199
} )
200200

201201
const addDesigns = async substituteBlocks => {
202+
const { getBlockRootClientId } = select( 'core/block-editor' )
203+
const parentClientId = getBlockRootClientId( clientId )
204+
202205
if ( ! designsRef.current?.length ) {
203206
console.error( 'Design library selection failed: No designs found' ) // eslint-disable-line no-console
204207
}
@@ -211,7 +214,7 @@ const Edit = props => {
211214
name, attributes, innerBlocks,
212215
} = designData
213216
if ( name && attributes ) {
214-
const block = await createBlockWithAttributes( name, applyFilters( 'stackable.design-library.attributes', attributes ), innerBlocks || [], substituteBlocks )
217+
const block = await createBlockWithAttributes( name, applyFilters( 'stackable.design-library.attributes', attributes ), innerBlocks || [], substituteBlocks, parentClientId )
215218
blocks.push( block )
216219
} else {
217220
console.error( 'Design library selection failed: No block data found' ) // eslint-disable-line no-console

src/components/design-library-list/default.json

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
{
2+
"Call to Action": {
3+
"heading_placeholder": "Transform Your Business Today",
4+
"description_placeholder": "Unlock your full potential with our cutting-edge solutions. We empower businesses of all sizes to achieve their goals through innovative technology and unparalleled support.",
5+
"kicker_placeholder": "Seize the Opportunity",
6+
"btn-1_placeholder": "Get Started Now",
7+
"btn-2_placeholder": "Learn More",
8+
"item-1_placeholder": "Streamline your operations and boost efficiency.",
9+
"item-2_placeholder": "Gain actionable insights with advanced analytics."
10+
},
11+
"Card": {
12+
"heading_placeholder": "Unlock Your Full Potential",
13+
"long-description_placeholder": "At XYZ Company, we partner for your growth. Our solutions leverage cutting-edge technology, provide expert guidance, and ensure seamless integration for measurable results. We empower you with the tools and support to confidently navigate challenges, building your success on innovation and reliability.",
14+
"description_placeholder": "Discover how our comprehensive solutions empower your journey.",
15+
"subtitle_placeholder": "Your Path to Innovation and Growth",
16+
"title_placeholder": "Solutions Designed to Propel You Forward",
17+
"c-btn_placeholder": "Learn More",
18+
"c-title-1_placeholder": "Innovative Solutions",
19+
"c-subtitle-1_placeholder": "Cutting-Edge Technology",
20+
"c-description-1_placeholder": "Discover how our advanced solutions can revolutionize your approach, providing efficiency and unprecedented growth.",
21+
"c-title-2_placeholder": "Expert Guidance",
22+
"c-subtitle-2_placeholder": "Personalized Support",
23+
"c-description-2_placeholder": "Benefit from our team's extensive knowledge and receive tailored advice to meet your unique challenges.",
24+
"c-title-3_placeholder": "Seamless Integration",
25+
"c-subtitle-3_placeholder": "Effortless Setup",
26+
"c-description-3_placeholder": "Our products are designed for easy integration, ensuring a smooth transition and immediate productivity.",
27+
"c-title-4_placeholder": "Measurable Results",
28+
"c-subtitle-4_placeholder": "Data-Driven Outcomes",
29+
"c-description-4_placeholder": "Track your progress with comprehensive analytics and see the tangible impact of our services on your goals.",
30+
"c-title-5_placeholder": "Community & Support",
31+
"c-subtitle-5_placeholder": "Connect and Collaborate",
32+
"c-description-5_placeholder": "Join a thriving community of users and access dedicated support to help you every step of the way.",
33+
"c-title-6_placeholder": "Future-Proof Design",
34+
"c-subtitle-6_placeholder": "Scalable and Adaptable",
35+
"c-description-6_placeholder": "Invest in solutions built for tomorrow, with the flexibility to grow and evolve with your needs."
36+
},
237
"FAQ": {
338
"heading_placeholder": "Frequently Asked Questions (FAQs)",
439
"description_placeholder": "Find answers to the most common questions about [Your Product/Service]. If you can't find what you're looking for here, please contact us.",
@@ -26,5 +61,125 @@
2661

2762
"question-8_placeholder": "How can I provide feedback?",
2863
"answer-8_placeholder": "We highly value your feedback as it helps us improve. You can provide feedback through several methods: Use the feedback form on our website, or email your suggestions or comments to [email protected]. You can also participate in surveys. We review all feedback submitted."
64+
},
65+
"Gallery": {
66+
"heading_placeholder": "Nature's Grand Canvas",
67+
"description_placeholder": "Explore breathtaking landscapes and the serene beauty of our planet. Each image unveils a unique story from the heart of nature.",
68+
"kicker_placeholder": "Earth's Masterpieces",
69+
"btn_placeholder": "Explore More",
70+
"img-subtitle-1_placeholder": "Dolomite Majesty",
71+
"img-title-1_placeholder": "Peaks of Tre Cime di Lavaredo",
72+
"img-description-1_placeholder": "Towering rock formations of the Dolomites, including the formidable Tre Cime di Lavaredo, emerge through a misty sky, showcasing raw geological power.",
73+
74+
"img-subtitle-2_placeholder": "Alpine Valleys",
75+
"img-title-2_placeholder": "South Tyrol's Autumn Embrace",
76+
"img-description-2_placeholder": "A tranquil scene in South Tyrol, Italy, where golden larch trees dot verdant hillsides, backed by snow-dusted mountains under a soft light.",
77+
78+
"img-subtitle-3_placeholder": "Winter Wonderland",
79+
"img-title-3_placeholder": "Phelps Lake Winter Reflection",
80+
"img-description-3_placeholder": "A serene winter landscape featuring Phelps Lake, perfectly mirroring snow-covered mountains and frost-dusted pine trees under a clear, crisp sky.",
81+
82+
"img-subtitle-4_placeholder": "Twilight Glow",
83+
"img-title-4_placeholder": "Valley Lights at Dusk",
84+
"img-description-4_placeholder": "As twilight settles, a valley below glows with the golden lights of a town, nestled against dark, silhouetted mountains under a streaked sky.",
85+
86+
"img-subtitle-5_placeholder": "Ethereal Forest",
87+
"img-title-5_placeholder": "Misty Woodland Pathways",
88+
"img-description-5_placeholder": "A hauntingly beautiful forest shrouded in mist, where tall, bare trees stand solemnly above a carpet of rust-colored ferns, creating a sense of deep mystery.",
89+
90+
"img-subtitle-6_placeholder": "Autumn Slopes",
91+
"img-title-6_placeholder": "Golden Larches of the Alps",
92+
"img-description-6_placeholder": "A stunning view across a mountain valley where vibrant golden larch trees cascade down slopes, contrasting with darker evergreens and distant peaks.",
93+
"img-subtitle-7_placeholder": "Dolomite Grandeur",
94+
"img-title-7_placeholder": "Pale di San Martino's Fiery Peaks",
95+
"img-description-7_placeholder": "The dramatic, sun-kissed peaks of the Pale di San Martino in the Dolomites catch the warm light, revealing their rugged textures and imposing scale.",
96+
"img-subtitle-8_placeholder": "Reflective Waters",
97+
"img-title-8_placeholder": "Lago di Limides Mirror",
98+
"img-description-8_placeholder": "The still, clear waters of Lago di Limides flawlessly reflect the cloudy sky and distant, mist-shrouded Dolomites, framed by pine trees along the shore."
99+
},
100+
"Hero": {
101+
"heading_placeholder": "Elevate Your Digital Future",
102+
"long-description_placeholder": "At XYZ Company, we don't just build products; we forge partnerships. Our dedicated team works tirelessly to understand your unique challenges, crafting tailored strategies for sustainable growth. From concept to execution, we ensure a seamless and transformative experience.",
103+
"description_placeholder": "Driving global business growth through innovative solutions and unparalleled expertise.",
104+
"kicker_placeholder": "Future-Ready Solutions",
105+
"btn-1_placeholder": "Get Started Today",
106+
"btn-2_placeholder": "Learn More",
107+
"item-1_placeholder": "Scalable Solutions",
108+
"item-2_placeholder": "Expert Guidance",
109+
"item-3_placeholder": "Proven Impact",
110+
"metric-1_placeholder": "10M",
111+
"metric-label-1_placeholder": "Users Engaged",
112+
"metric-2_placeholder": "250",
113+
"metric-label-2_placeholder": "Solutions",
114+
"metric-3_placeholder": "20",
115+
"metric-label-3_placeholder": "Years of Expertise"
116+
},
117+
"List": {
118+
"heading_placeholder": "Solutions for Your Growth",
119+
"long-description_placeholder": "We offer tailored solutions designed to meet your unique needs, from initial consultation to ongoing support. Our team of experts is dedicated to delivering high-quality results and ensuring your satisfaction.",
120+
"description_placeholder": "Here's a glimpse into the comprehensive services we provide to help you succeed. ",
121+
"kicker_placeholder": "Our Offerings",
122+
"btn_placeholder": "Learn More",
123+
"group-title-1_placeholder": "Core Services",
124+
"group-title-2_placeholder": "Specialized Solutions",
125+
"title-1_placeholder": "Strategic Planning",
126+
"item-1_placeholder": "Develop a clear roadmap for your business with our expert strategic planning services.",
127+
"title-2_placeholder": "Market Research",
128+
"item-2_placeholder": "Gain valuable insights into your target audience and industry trends through our in-depth market research.",
129+
"title-3_placeholder": "Brand Development",
130+
"item-3_placeholder": "Build a strong and recognizable brand identity that resonates with your customers.",
131+
"title-4_placeholder": "Digital Marketing",
132+
"item-4_placeholder": "Expand your online reach and engage with your audience through our comprehensive digital marketing strategies.",
133+
"title-5_placeholder": "Financial Consulting",
134+
"item-5_placeholder": "Optimize your financial performance and make informed decisions with our expert financial guidance.",
135+
"title-6_placeholder": "Operational Efficiency",
136+
"item-6_placeholder": "Streamline your processes and boost productivity with our operational efficiency consulting."
137+
},
138+
"Logo Farm": {
139+
"heading_placeholder": "Trusted by Industry Leaders",
140+
"description_placeholder": "We're proud to collaborate with a diverse range of companies that trust us to deliver exceptional results. Our partnerships are built on mutual success and shared innovation, driving progress across various sectors.",
141+
"kicker_placeholder": "Our Valued Partners",
142+
"btn_placeholder": "Learn More"
143+
},
144+
"Media and Text": {
145+
"long-subheading_placeholder": "Revolutionizing how we interact with the world.",
146+
"heading_placeholder": "Future of Connectivity",
147+
"long-description_placeholder": "Discover seamless integration and enhanced experiences designed to elevate your daily life. Our innovations transcend traditional boundaries, creating a more interconnected and intuitive world for everyone.",
148+
"description_placeholder": "Explore groundbreaking advancements that are shaping tomorrow's digital landscape.",
149+
"kicker_placeholder": "Tech Spotlight",
150+
"btn_placeholder": "Learn More",
151+
"title-1_placeholder": "Seamless Integration",
152+
"text-1_placeholder": "Experience unparalleled ease as our technology effortlessly blends into your existing systems, enhancing productivity without disruption.",
153+
"title-2_placeholder": "Intuitive Design",
154+
"text-2_placeholder": "Crafted with the user in mind, our interfaces are simple, elegant, and exceptionally easy to navigate, ensuring a smooth experience for everyone.",
155+
"title-3_placeholder": "Robust Security",
156+
"text-3_placeholder": "Your data's safety is our top priority. Benefit from multi-layered security protocols and advanced encryption that keep your information protected around the clock.",
157+
"title-4_placeholder": "Scalable Solutions",
158+
"text-4_placeholder": "Whether you're a small startup or a large enterprise, our flexible solutions are designed to grow with your needs, adapting to future demands seamlessly.",
159+
"title-5_placeholder": "Global Reach",
160+
"text-5_placeholder": "Connect with confidence. Our services extend worldwide, providing reliable and high-performance access no matter where you are.",
161+
"title-6_placeholder": "Dedicated Support",
162+
"text-6_placeholder": "Our expert team is always ready to assist you. Enjoy comprehensive support and resources designed to ensure your success."
163+
},
164+
"Text": {
165+
"heading_placeholder": "Innovating for a Sustainable Future",
166+
"long-subtitle_placeholder": "Pioneering Global Solutions for a Greener Tomorrow's Challenges",
167+
"long-description-1_placeholder": "We invest in cutting-edge research to create tangible solutions for environmental challenges, integrating sustainable practices across our operations. Our holistic approach aims for long-term benefits for the planet and its inhabitants. True innovation stems from understanding ecological principles and technological advancement.",
168+
"long-description-2_placeholder": "By fostering collaborations globally, we build a robust framework for environmental stewardship. Our efforts empower communities to embrace sustainability and thrive in harmony with nature. This ensures solutions are groundbreaking, scalable, and adaptable.",
169+
"description_placeholder": "We are dedicated to creating a sustainable future through innovative solutions and responsible practices.",
170+
"kicker_placeholder": "Driving Global Change",
171+
"btn_placeholder": "Learn More",
172+
"title-1_placeholder": "Renewable Energy",
173+
"text-1_placeholder": "Developing advanced solar, wind, and hydro technologies to reduce reliance on fossil fuels.",
174+
"title-2_placeholder": "Circular Economy",
175+
"text-2_placeholder": "Implementing waste reduction, resource recovery, and product lifecycle optimization strategies.",
176+
"title-3_placeholder": "Sustainable Agriculture",
177+
"text-3_placeholder": "Promoting eco-friendly farming methods and resilient food systems.",
178+
"title-4_placeholder": "Biodiversity Conservation",
179+
"text-4_placeholder": "Protecting habitats, supporting endangered species, and promoting ecological balance.",
180+
"title-5_placeholder": "Smart Cities",
181+
"text-5_placeholder": "Designing urban environments with green spaces and efficient infrastructure.",
182+
"title-6_placeholder": "Environmental Education",
183+
"text-6_placeholder": "Empowering communities with knowledge to adopt sustainable lifestyles."
29184
}
30185
}

src/components/design-library-list/design-library-list-item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const DesignLibraryListItem = forwardRef( ( props, ref ) => {
138138
let _content = template
139139
if ( defaultValues ) {
140140
Object.keys( defaultValues ).forEach( key => {
141-
_content = _content.replace( key, defaultValues[ key ] )
141+
_content = _content.replaceAll( key, defaultValues[ key ] )
142142
} )
143143
}
144144

src/components/design-library-list/util.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ export const addBackgroundScheme = (
128128
return block
129129
}
130130

131-
if ( block.attributes.hasBackground ) {
132-
return block
133-
}
134-
135131
const customAttributes = block.attributes.customAttributes
136132

137133
if ( ! customAttributes?.length ) {

0 commit comments

Comments
 (0)