diff --git a/src/__block-container-template/block.json b/src/__block-container-template/block.json index 40f8a30e69..f66ba01f3c 100644 --- a/src/__block-container-template/block.json +++ b/src/__block-container-template/block.json @@ -4,7 +4,13 @@ "title": "New Block", "description": "A new block.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Keywords that are not in the title" ], diff --git a/src/__block-template/block.json b/src/__block-template/block.json index 40f8a30e69..f66ba01f3c 100644 --- a/src/__block-template/block.json +++ b/src/__block-template/block.json @@ -4,7 +4,13 @@ "title": "New Block", "description": "A new block.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Keywords that are not in the title" ], diff --git a/src/block-components/typography/index.js b/src/block-components/typography/index.js index 33f5d196a5..f2de936f11 100644 --- a/src/block-components/typography/index.js +++ b/src/block-components/typography/index.js @@ -20,6 +20,7 @@ import { useDynamicContent } from '~stackable/components/dynamic-content-control /** * WordPress dependencies */ +import { Spinner } from '@wordpress/components' import { RichText } from '@wordpress/block-editor' import { useEffect, @@ -92,6 +93,9 @@ export const Typography = memo( forwardRef( ( props, ref ) => { }, [ debouncedText, onChange ] ) // Don't include `value` in the dependency list because it will cause a double triggering of the `onChange`. const dynamicContentText = useDynamicContent( debouncedText ) + if ( dynamicContentText.includes( 'data-stk-dynamic=' ) && dynamicContentText.includes( '>' ) ) { + return + } if ( ! editable ) { return { dynamicContentText } diff --git a/src/block/accordion/block.json b/src/block/accordion/block.json index 4582c7ea38..c3e8c6e93a 100644 --- a/src/block/accordion/block.json +++ b/src/block/accordion/block.json @@ -4,7 +4,13 @@ "title": "Accordion", "description": "A title that your visitors can toggle to view more text. Use as FAQs or multiple ones for an Accordion.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Toggle", "Faq" diff --git a/src/block/blockquote/block.json b/src/block/blockquote/block.json index 5f10563d53..61043e4002 100644 --- a/src/block/blockquote/block.json +++ b/src/block/blockquote/block.json @@ -4,7 +4,13 @@ "title": "Blockquote", "description": "Display a quote in style", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "textdomain": "stackable-ultimate-gutenberg-blocks", "stk-type": "section", "stk-demo": "https://wpstackable.com/blockquote-block/?utm_source=welcome&utm_medium=settings&utm_campaign=view_demo&utm_content=demolink" diff --git a/src/block/button-group/block.json b/src/block/button-group/block.json index 838f9adf2c..50ee2b09ec 100644 --- a/src/block/button-group/block.json +++ b/src/block/button-group/block.json @@ -4,7 +4,13 @@ "title": "Button Group", "description": "Add a customizable button.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Link" ], diff --git a/src/block/button/block.json b/src/block/button/block.json index 9f79e69747..bc98a31c47 100644 --- a/src/block/button/block.json +++ b/src/block/button/block.json @@ -4,7 +4,13 @@ "title": "Button", "description": "Add a customizable button.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "parent": [ "stackable/button-group" ], diff --git a/src/block/call-to-action/block.json b/src/block/call-to-action/block.json index 1b38094be3..03de1987b5 100644 --- a/src/block/call-to-action/block.json +++ b/src/block/call-to-action/block.json @@ -4,7 +4,13 @@ "title": "Call to Action", "description": "A small section you can use to call the attention of your visitors. Great for calling attention to your products or deals.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" }, diff --git a/src/block/card/block.json b/src/block/card/block.json index 2025e1f7dd..86a7e66587 100644 --- a/src/block/card/block.json +++ b/src/block/card/block.json @@ -4,7 +4,13 @@ "title": "Card", "description": "Describe a single subject in a small card. You can use this to describe your product, service or a person.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" }, diff --git a/src/block/carousel/block.json b/src/block/carousel/block.json index d712313c0a..d68e44b691 100644 --- a/src/block/carousel/block.json +++ b/src/block/carousel/block.json @@ -4,7 +4,13 @@ "title": "Carousel", "description": "A carousel slider.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Slider" ], diff --git a/src/block/column/block.json b/src/block/column/block.json index fce9089cc5..e593ceb086 100644 --- a/src/block/column/block.json +++ b/src/block/column/block.json @@ -4,7 +4,14 @@ "title": "Inner Column", "description": "A single column with advanced layout options.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId", "stackable/innerBlockOrientation", "stackable/columnWrapDesktop" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/columnWrapDesktop", + "stackable/repeaterValue" + ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" }, diff --git a/src/block/columns/block.json b/src/block/columns/block.json index 93ff48c38a..4801cb30cd 100644 --- a/src/block/columns/block.json +++ b/src/block/columns/block.json @@ -7,7 +7,8 @@ "usesContext": [ "postId", "postType", - "queryId" + "queryId", + "stackable/repeaterValue" ], "keywords": [ "Section rows", diff --git a/src/block/count-up/block.json b/src/block/count-up/block.json index fba299396f..8f2ed08dad 100644 --- a/src/block/count-up/block.json +++ b/src/block/count-up/block.json @@ -4,7 +4,13 @@ "title": "Count Up", "description": "Showcase your stats. Display how many customers you have or the number of downloads of your app.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Number" ], diff --git a/src/block/countdown/block.json b/src/block/countdown/block.json index a6b6817c73..ac7e05cc8b 100644 --- a/src/block/countdown/block.json +++ b/src/block/countdown/block.json @@ -4,7 +4,13 @@ "title": "Countdown", "description": "Display a countdown timer on your website.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Timer" ], diff --git a/src/block/design-library/block.json b/src/block/design-library/block.json index cf56eaba99..f9bb7aaa37 100644 --- a/src/block/design-library/block.json +++ b/src/block/design-library/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "keywords": [ "Template" diff --git a/src/block/divider/block.json b/src/block/divider/block.json index 3b28da93d0..6b05888785 100644 --- a/src/block/divider/block.json +++ b/src/block/divider/block.json @@ -4,7 +4,13 @@ "title": "Divider", "description": "Add a pause between your content.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Horizontal Rule", "HR" diff --git a/src/block/expand/block.json b/src/block/expand/block.json index ed0bcba11a..61c7cf9ab6 100644 --- a/src/block/expand/block.json +++ b/src/block/expand/block.json @@ -4,7 +4,13 @@ "title": "Expand / Show More", "description": "Display a small snippet of text. Your readers can toggle it to show more information.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Hide", "Less" diff --git a/src/block/feature-grid/block.json b/src/block/feature-grid/block.json index bb62bda42d..faeb6039f7 100644 --- a/src/block/feature-grid/block.json +++ b/src/block/feature-grid/block.json @@ -4,7 +4,13 @@ "title": "Feature Grid", "description": "Display multiple product features or services. You can use Feature Grids one after another.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/columnWrapDesktop": "columnWrapDesktop" }, diff --git a/src/block/feature/block.json b/src/block/feature/block.json index 422623c381..fa923cf6d5 100644 --- a/src/block/feature/block.json +++ b/src/block/feature/block.json @@ -4,7 +4,13 @@ "title": "Feature", "description": "Display a product feature or a service in a large area.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/columnWrapDesktop": "columnWrapDesktop" }, diff --git a/src/block/heading/block.json b/src/block/heading/block.json index 5a72bd0a6b..14cc2f6c06 100644 --- a/src/block/heading/block.json +++ b/src/block/heading/block.json @@ -4,7 +4,13 @@ "title": "Heading", "description": "Introduce new sections of your content in style.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Title" ], diff --git a/src/block/hero/block.json b/src/block/hero/block.json index e7946996bc..c1ac4b79a0 100644 --- a/src/block/hero/block.json +++ b/src/block/hero/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" diff --git a/src/block/horizontal-scroller/block.json b/src/block/horizontal-scroller/block.json index e306971d5d..5cd501bd20 100644 --- a/src/block/horizontal-scroller/block.json +++ b/src/block/horizontal-scroller/block.json @@ -4,7 +4,13 @@ "title": "Horizontal Scroller", "description": "A slider that scrolls horizontally.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId", "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Slider", "Carousel" diff --git a/src/block/icon-box/block.json b/src/block/icon-box/block.json index bca7d3200a..ddd4558a54 100644 --- a/src/block/icon-box/block.json +++ b/src/block/icon-box/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "textdomain": "stackable-ultimate-gutenberg-blocks", "stk-type": "section", diff --git a/src/block/icon-button/block.json b/src/block/icon-button/block.json index 10ccb4bf68..3a6c4d937e 100644 --- a/src/block/icon-button/block.json +++ b/src/block/icon-button/block.json @@ -4,7 +4,13 @@ "title": "Icon Button", "description": "Add a customizable button.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "parent": [ "stackable/button-group" ], diff --git a/src/block/icon-label/block.json b/src/block/icon-label/block.json index 8d0df07d5e..fa3222880e 100644 --- a/src/block/icon-label/block.json +++ b/src/block/icon-label/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "keywords": [ "SVG" diff --git a/src/block/icon-list-item/block.json b/src/block/icon-list-item/block.json index 5e82ef662b..16b8b3d89d 100644 --- a/src/block/icon-list-item/block.json +++ b/src/block/icon-list-item/block.json @@ -4,7 +4,15 @@ "title": "Icon List Item", "description": "A single list entry in the Icon List block", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation", "stackable/ordered", "stackable/uniqueId" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/ordered", + "stackable/uniqueId", + "stackable/repeaterValue" + ], "keywords": [], "parent": [ "stackable/icon-list" diff --git a/src/block/icon-list/block.json b/src/block/icon-list/block.json index 7f07d74145..87b5759141 100644 --- a/src/block/icon-list/block.json +++ b/src/block/icon-list/block.json @@ -4,7 +4,13 @@ "title": "Icon List", "description": "An unordered list with icons. You can use this as a list of features or benefits.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Checklist", "Bullets", diff --git a/src/block/icon/block.json b/src/block/icon/block.json index 7bd36d9fd0..679ae03046 100644 --- a/src/block/icon/block.json +++ b/src/block/icon/block.json @@ -4,7 +4,13 @@ "title": "Icon", "description": "Pick an icon or upload your own SVG icon to decorate your content.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "SVG" ], diff --git a/src/block/image-box/block.json b/src/block/image-box/block.json index 4cc47bd030..3d12d7fcb6 100644 --- a/src/block/image-box/block.json +++ b/src/block/image-box/block.json @@ -4,7 +4,13 @@ "title": "Image Box", "description": "Display an image that shows more information when hovered on. Can be used as a fancy link to other pages.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "textdomain": "stackable-ultimate-gutenberg-blocks", "stk-type": "special", "stk-demo": "https://wpstackable.com/image-box-block/?utm_source=welcome&utm_medium=settings&utm_campaign=view_demo&utm_content=demolink" diff --git a/src/block/image/block.json b/src/block/image/block.json index f47e4426c2..6db39559ac 100644 --- a/src/block/image/block.json +++ b/src/block/image/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "textdomain": "stackable-ultimate-gutenberg-blocks", "stk-type": "essential", diff --git a/src/block/map/block.json b/src/block/map/block.json index 301f43bf4c..871fa9700b 100644 --- a/src/block/map/block.json +++ b/src/block/map/block.json @@ -8,10 +8,14 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "textdomain": "stackable-ultimate-gutenberg-blocks", - "keywords": [ "location", "address" ], + "keywords": [ + "location", + "address" + ], "stk-type": "special", "stk-demo": "https://wpstackable.com/map-block/?utm_source=welcome&utm_medium=settings&utm_campaign=view_demo&utm_content=demolink" } diff --git a/src/block/notification/block.json b/src/block/notification/block.json index a7bf51c75a..14bcc87b59 100644 --- a/src/block/notification/block.json +++ b/src/block/notification/block.json @@ -4,7 +4,13 @@ "title": "Notification", "description": "Show a notice to your readers. People can dismiss the notice to permanently hide it.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" }, diff --git a/src/block/number-box/block.json b/src/block/number-box/block.json index 6b4d227724..f46527d2dd 100644 --- a/src/block/number-box/block.json +++ b/src/block/number-box/block.json @@ -4,7 +4,13 @@ "title": "Number Box", "description": "Display steps or methods that your users will do in your service.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Steps" ], diff --git a/src/block/posts/block.json b/src/block/posts/block.json index 1444a8b651..99a249a2b4 100644 --- a/src/block/posts/block.json +++ b/src/block/posts/block.json @@ -4,7 +4,13 @@ "title": "Posts", "description": "Your latest blog posts. Use this to showcase a few of your posts in your landing pages.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Blog Posts", "Lastest Posts", diff --git a/src/block/price/block.json b/src/block/price/block.json index c907c9bbb5..ec6b84e2ca 100644 --- a/src/block/price/block.json +++ b/src/block/price/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "keywords": [ "Currency", diff --git a/src/block/pricing-box/block.json b/src/block/pricing-box/block.json index 4e4deb83d9..1a0d6aa723 100644 --- a/src/block/pricing-box/block.json +++ b/src/block/pricing-box/block.json @@ -4,7 +4,13 @@ "title": "Pricing Box", "description": "Display the different pricing tiers of your business.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" }, diff --git a/src/block/progress-bar/block.json b/src/block/progress-bar/block.json index 13df6f1d89..550ed62459 100644 --- a/src/block/progress-bar/block.json +++ b/src/block/progress-bar/block.json @@ -4,7 +4,13 @@ "title": "Progress Bar", "description": "Visualize a progress value or percentage in a bar.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "percentage status" ], diff --git a/src/block/progress-circle/block.json b/src/block/progress-circle/block.json index a4e7e9abfe..79595c3cce 100644 --- a/src/block/progress-circle/block.json +++ b/src/block/progress-circle/block.json @@ -4,7 +4,13 @@ "title": "Progress Circle", "description": "Visualize a progress value or percentage in a circle.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "percentage status" ], diff --git a/src/block/separator/block.json b/src/block/separator/block.json index 6d6ea171ad..ab6b63c3a3 100644 --- a/src/block/separator/block.json +++ b/src/block/separator/block.json @@ -4,7 +4,13 @@ "title": "Separator", "description": "A fancy separator to be placed between content.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Svg Divider" ], diff --git a/src/block/spacer/block.json b/src/block/spacer/block.json index 5bfe52cea5..4d26d6dd96 100644 --- a/src/block/spacer/block.json +++ b/src/block/spacer/block.json @@ -4,7 +4,13 @@ "title": "Spacer", "description": "Sometimes you just need some space.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "textdomain": "stackable-ultimate-gutenberg-blocks", "stk-type": "special" } diff --git a/src/block/subtitle/block.json b/src/block/subtitle/block.json index 0a66cd8c3b..1302875f11 100644 --- a/src/block/subtitle/block.json +++ b/src/block/subtitle/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "textdomain": "stackable-ultimate-gutenberg-blocks", "stk-type": "special", diff --git a/src/block/tab-content/block.json b/src/block/tab-content/block.json index c6952dce57..05b16f0507 100644 --- a/src/block/tab-content/block.json +++ b/src/block/tab-content/block.json @@ -4,7 +4,15 @@ "title": "Tab Content", "description": "A wrapper for tab panels.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation", "stackable/tabPanelEffect", "stackable/equalTabHeight" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/tabPanelEffect", + "stackable/equalTabHeight", + "stackable/repeaterValue" + ], "keywords": [], "parent": [ "stackable/tabs" diff --git a/src/block/tab-labels/block.json b/src/block/tab-labels/block.json index b6623b6c59..f578ece009 100644 --- a/src/block/tab-labels/block.json +++ b/src/block/tab-labels/block.json @@ -4,7 +4,15 @@ "title": "Tab Labels", "description": "Create interactive navigation within tabs.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation", "stackable/initialTabOpen", "stackable/tabOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/initialTabOpen", + "stackable/tabOrientation", + "stackable/repeaterValue" + ], "keywords": [], "parent": [ "stackable/tabs" diff --git a/src/block/table-of-contents/block.json b/src/block/table-of-contents/block.json index 3b7263eed4..9004725729 100644 --- a/src/block/table-of-contents/block.json +++ b/src/block/table-of-contents/block.json @@ -8,7 +8,8 @@ "postId", "postType", "queryId", - "stackable/innerBlockOrientation" + "stackable/innerBlockOrientation", + "stackable/repeaterValue" ], "keywords": [ "ToC", diff --git a/src/block/tabs/block.json b/src/block/tabs/block.json index 191e922803..5ce93fc874 100644 --- a/src/block/tabs/block.json +++ b/src/block/tabs/block.json @@ -4,7 +4,13 @@ "title": "Tabs", "description": "Organize and display content in multiple tabs.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "toggle" ], diff --git a/src/block/team-member/block.json b/src/block/team-member/block.json index 6c108fd96b..bd83ac1f44 100644 --- a/src/block/team-member/block.json +++ b/src/block/team-member/block.json @@ -4,7 +4,13 @@ "title": "Team Member", "description": "Display members of your team or your office. Use multiple Team Member blocks if you have a large team.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" }, diff --git a/src/block/testimonial/block.json b/src/block/testimonial/block.json index 5ff892c680..028855a9b8 100644 --- a/src/block/testimonial/block.json +++ b/src/block/testimonial/block.json @@ -4,7 +4,13 @@ "title": "Testimonial", "description": "Showcase what your users say about your product or service.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "providesContext": { "stackable/innerBlockOrientation": "innerBlockOrientation" }, diff --git a/src/block/text/block.json b/src/block/text/block.json index 3d4e31502c..b82de216f3 100644 --- a/src/block/text/block.json +++ b/src/block/text/block.json @@ -4,7 +4,13 @@ "title": "Text", "description": "Start with the building block of all page layouts.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId", "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "Paragraph" ], diff --git a/src/block/timeline/block.json b/src/block/timeline/block.json index 80c3927889..bf969abd50 100644 --- a/src/block/timeline/block.json +++ b/src/block/timeline/block.json @@ -4,7 +4,13 @@ "title": "Timeline", "description": "Show events in chronological order", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "history", "milestone" diff --git a/src/block/video-popup/block.json b/src/block/video-popup/block.json index 958aa67679..fa828d2291 100644 --- a/src/block/video-popup/block.json +++ b/src/block/video-popup/block.json @@ -4,7 +4,13 @@ "title": "Video Popup", "description": "Display a large thumbnail that your users can click to play a video full-screen. Great for introductory or tutorial videos.", "category": "stackable", - "usesContext": [ "postId", "postType", "queryId" , "stackable/innerBlockOrientation" ], + "usesContext": [ + "postId", + "postType", + "queryId", + "stackable/innerBlockOrientation", + "stackable/repeaterValue" + ], "keywords": [ "YouTube", "Vimeo", diff --git a/src/components/advanced-select-control/index.js b/src/components/advanced-select-control/index.js index 8c89008952..c72556c022 100644 --- a/src/components/advanced-select-control/index.js +++ b/src/components/advanced-select-control/index.js @@ -8,7 +8,7 @@ import { ResetButton } from '../base-control2/reset-button' /** * WordPress dependencies */ -import { SelectControl } from '@wordpress/components' +import { SelectControl, Spinner } from '@wordpress/components' import { memo } from '@wordpress/element' /** @@ -30,12 +30,14 @@ const AdvancedSelectControl = memo( props => { { ...controlProps } className={ classnames( 'ugb-advanced-select-control', props.className ) } > - } + { ! props.isBusy && + } { { + // If there's a '.' it means the attribute value is an object, and we want + // to change a single property inside that object. + const willUpdateObjectProperty = _attribute.includes( '.' ) + const attribute = willUpdateObjectProperty ? _attribute.split( '.' )[ 0 ] : _attribute -export const useControlHandlers = ( attribute, responsive = false, hover = false, valueCallback = null, changeCallback = null ) => { const setAttributes = useBlockSetAttributesContext() const attrName = useAttributeName( attribute, responsive, hover ) const _value = useBlockAttributesContext( attributes => attributes[ attrName ] ) - const originalValue = _value !== undefined ? _value : '' - let value = _value !== undefined ? _value : '' + // We're just updating the attribute directly. + if ( ! willUpdateObjectProperty ) { + const originalValue = _value !== undefined ? _value : '' + let value = originalValue + if ( valueCallback ) { + value = valueCallback( value ) + } + + const onChange = _value => { + const value = changeCallback ? changeCallback( _value, originalValue ) : _value + setAttributes( { [ attrName ]: value } ) + } + + return [ value, onChange ] + } + + // If we reach here, then the attribute's value is an object and we're + // updating one property in it. _attribute is the path in the format of + // 'attribute.property' or 'attribute.property1.property2' + const path = _attribute.substring( _attribute.indexOf( '.' ) + 1 ) + const originalObjectValue = _value !== undefined ? _value : {} + const originalValue = _value !== undefined ? get( _value, path, '' ) : '' + let value = originalValue if ( valueCallback ) { value = valueCallback( value ) } const onChange = _value => { const value = changeCallback ? changeCallback( _value, originalValue ) : _value - setAttributes( { [ attrName ]: value } ) + const newObjectValue = set( cloneDeep( originalObjectValue ), path, value ) + setAttributes( { [ attrName ]: newObjectValue } ) } return [ value, onChange ] diff --git a/src/components/custom-attributes-control/index.js b/src/components/custom-attributes-control/index.js index 0682985f67..23a9a43071 100644 --- a/src/components/custom-attributes-control/index.js +++ b/src/components/custom-attributes-control/index.js @@ -117,6 +117,9 @@ const CustomAttributesControl = props => { { hasError && { __( 'There is an error in your custom attribute', i18n ) } } ) } + isDynamic={ true } + isFormatType={ false } + rawValue={ customAttributes } /> ) } diff --git a/src/components/dynamic-content-control/index.js b/src/components/dynamic-content-control/index.js index 10dc05296f..ac7388bf9a 100644 --- a/src/components/dynamic-content-control/index.js +++ b/src/components/dynamic-content-control/index.js @@ -13,7 +13,7 @@ import { QueryLoopContext } from '~stackable/higher-order/with-query-loop-contex /** * WordPress dependencies */ -import { __ } from '@wordpress/i18n' +import { __, sprintf } from '@wordpress/i18n' import { useBlockEditContext } from '@wordpress/block-editor' import { Button, @@ -120,12 +120,17 @@ export const useDynamicContentControlProps = props => { const isPressed = isPopoverOpen || activeAttributes.length const activeAttribute = first( activeAttributes ) || '' - const onChange = ( newValue, editorQueryString, frontendQueryString ) => { + const onChange = ( newValue, editorQueryString, frontendQueryString, format = '' ) => { // If `isFormatType` is true, the onChange function will generate a `stackable/dynamic-content` format type. - const willChangeValue = props.isFormatType + let willChangeValue = props.isFormatType ? `${ newValue }` : `!#stk_dynamic/${ frontendQueryString }!#` + // If `format` is set, then we will use it to format the value. + if ( format ) { + willChangeValue = sprintf( format, willChangeValue ) + } + props.onChange( willChangeValue ) setDebouncedValue( willChangeValue ) @@ -165,7 +170,9 @@ export const hasDynamicContent = ( value = '' ) => { return value.includes( '!#stk_dynamic' ) || value.includes( 'data-stk-dynamic' ) } -export const getDynamicContent = ( value = '', queryLoopContext = null ) => { +/* +// Unused +export const ____getDynamicContent = ( value = '', queryLoopContext = null ) => { if ( ! select( 'stackable/dynamic-content' ) ) { return value } @@ -215,6 +222,7 @@ export const getDynamicContent = ( value = '', queryLoopContext = null ) => { return select( 'stackable/dynamic-content' ).parseDynamicContents( tempValue ) } +*/ export const useQueryLoopContext = () => { return useContext( QueryLoopContext ) @@ -229,13 +237,41 @@ export const useQueryLoopContext = () => { * const value = useDynamicContent( 'Post Title: !#stk_dynamic/current-page/post-title!#' ) * // returns `Post Title: The actual post title` * ``` + * @param context * @param {string} value */ export const useDynamicContent = ( value = '' ) => { const { clientId } = useBlockEditContext() - const blockDetails = select( 'core/block-editor' ).getBlock( clientId ) - const queryLoopContext = useContext( QueryLoopContext ) + // We need to create a new object here. + const blockDetails = { + ...select( 'core/block-editor' ).getBlock( clientId ), + context: useContext( QueryLoopContext ), + } + return useSelect( select => { + if ( ! value || ! isString( value ) ) { + return value + } + + if ( ! value.includes( '!#stk_dynamic' ) && ! value.includes( 'data-stk-dynamic' ) ) { + return value + } + + if ( ! select( 'stackable/dynamic-content' ) ) { + return value + } + + const parsedContent = select( 'stackable/dynamic-content' ).parseDynamicContents( value, blockDetails ) + return parsedContent + }, [ value, blockDetails.context?.postId, blockDetails.context?.[ 'stackable/repeaterValue' ] ] ) + + return value + '-' + blockDetails.context?.postId + + // TODO: Below is the old method, there was a lot going on here. Instead of + // passing the context, we tried inserting the current post id and then + // parsing that. but now we're passing the context, so no need for this. But + // keep this for now because we need to know if our new method works for any + // currently saved blocks that use dynamic data. return useSelect( select => { if ( ! value || ! isString( value ) ) { return value @@ -300,7 +336,6 @@ export const useDynamicContent = ( value = '' ) => { return '!#stk_dynamic/' + splitFieldString.join( '/' ) + '!#' } ) } - // Get the correct value for the dynamic content. let parsedContent = select( 'stackable/dynamic-content' ).parseDynamicContents( tempValue, blockDetails ) @@ -332,7 +367,7 @@ export const useDynamicContent = ( value = '' ) => { } return parsedContent - }, [ value, queryLoopContext?.postId ] ) + }, [ value, queryLoopContext?.postId, queryLoopContext?.[ 'stackable/repeaterValue' ] ] ) } // This is the same as with the useDynamicContent hook, but it's a function @@ -499,6 +534,11 @@ export const useValueWithFieldsTitle = ( value = '' ) => { const dynamicContent = export const DynamicContentButton = memo( props => { + const { clientId } = useBlockEditContext() + const queryLoopContext = useContext( QueryLoopContext ) + const block = select( 'core/block-editor' ).getBlock( clientId ) + block.context = queryLoopContext + if ( ! isPro && ! showProNotice ) { return null } @@ -530,6 +570,10 @@ export const DynamicContentButton = memo( props => { onChange={ props.onChange } activeAttribute={ props.activeAttribute } type={ props.type } + blockDetails={ block } + value={ props.value } + hasFormat={ props.hasFormat || !! props.value?.includes( 'class="stk-dynamic-content"' ) } + rawValue={ props.rawValue } /> ) } diff --git a/src/components/image-control2/index.js b/src/components/image-control2/index.js index 1203522c3a..83d28f2e3e 100644 --- a/src/components/image-control2/index.js +++ b/src/components/image-control2/index.js @@ -136,6 +136,8 @@ const ImageControl = memo( props => { enable={ props.isDynamic } hasPanelModifiedIndicator={ props.hasPanelModifiedIndicator } type="image-url" + hasFormat={ true } + rawValue={ attributes[ attrNameUrl ] } { ...dynamicContentProps } > { + const { + tabs = [ 'layout', 'style', 'advanced' ], + tabOverrides = {}, + hasLayoutPanel = true, + } = props + const { name } = useBlockEditContext() const defaultTab = getBlockSupport( name, 'stkDefaultTab' ) || 'style' - const [ activeTab, setActiveTab ] = useGlobalState( `tabCache-${ name }`, props.tabs.includes( defaultTab ) ? defaultTab : 'style' ) + const [ activeTab, setActiveTab ] = useGlobalState( `tabCache-${ name }`, tabs.includes( defaultTab ) ? defaultTab : 'style' ) return ( <> @@ -79,7 +86,7 @@ const InspectorTabs = props => { { /* Make sure the layout panel is the very first one */ } - { props.hasLayoutPanel && ( + { hasLayoutPanel && ( { ) } -InspectorTabs.defaultProps = { - tabs: [ 'layout', 'style', 'advanced' ], - hasLayoutPanel: true, -} - export default memo( InspectorTabs ) diff --git a/src/components/link-control/index.js b/src/components/link-control/index.js index 3f61d874e9..baec5df27b 100644 --- a/src/components/link-control/index.js +++ b/src/components/link-control/index.js @@ -6,9 +6,8 @@ import classnames from 'classnames' /** * WordPress dependencies */ -import { - __experimentalLinkControl as _LinkControl, // eslint-disable-line @wordpress/no-unsafe-wp-apis -} from '@wordpress/block-editor' +// eslint-disable-next-line @wordpress/no-unsafe-wp-apis +import { __experimentalLinkControl as _LinkControl } from '@wordpress/block-editor' import { BaseControl as _BaseControl } from '@wordpress/components' import { __ } from '@wordpress/i18n' @@ -45,6 +44,8 @@ const LinkControl = props => {
diff --git a/src/components/panel-tabs/index.js b/src/components/panel-tabs/index.js index 8724b60856..15e78d8aac 100644 --- a/src/components/panel-tabs/index.js +++ b/src/components/panel-tabs/index.js @@ -153,12 +153,23 @@ class PanelTabs extends Component { ref={ this.containerDiv } >
- { applyFilters( 'stackable.inspector.tabs', TABS ).map( ( { - value, title, label, icon, - }, i ) => { + { applyFilters( 'stackable.inspector.tabs', TABS ).map( ( tabProps, i ) => { + let { + value, title, label, icon, + } = tabProps + if ( ! this.tabsToUse.includes( value ) ) { return null } + + // Allow the different display attributes of the tab to be overridden. + if ( this.props.tabOverrides && this.props.tabOverrides[ value ] ) { + const override = this.props.tabOverrides[ value ] + title = override.title ? override.title : title + label = override.label ? override.label : label + icon = override.icon ? override.icon : icon + } + return (