diff --git a/src/__block-container-template/block.json b/src/__block-container-template/block.json index ca76dd638..40f8a30e6 100644 --- a/src/__block-container-template/block.json +++ b/src/__block-container-template/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/new-block", "title": "New Block", "description": "A new block.", diff --git a/src/__block-template/block.json b/src/__block-template/block.json index ca76dd638..40f8a30e6 100644 --- a/src/__block-template/block.json +++ b/src/__block-template/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/new-block", "title": "New Block", "description": "A new block.", diff --git a/src/block-components/block-div/edit.js b/src/block-components/block-div/edit.js index 23cb0caaf..abc53163f 100644 --- a/src/block-components/block-div/edit.js +++ b/src/block-components/block-div/edit.js @@ -18,7 +18,6 @@ import { } from '~stackable/components' import { useBlockAttributesContext, - useBlockEl, useBlockSetAttributesContext, } from '~stackable/hooks' @@ -34,7 +33,6 @@ export const Edit = props => { } = props const hasBackground = useBlockAttributesContext( attributes => attributes.hasBackground ) const setAttributes = useBlockSetAttributesContext() - const blockEl = useBlockEl() return ( <> @@ -47,7 +45,6 @@ export const Edit = props => { > { /> { > diff --git a/src/block-components/block-div/use-unique-id.js b/src/block-components/block-div/use-unique-id.js index 294d4e4fb..ab4bcf3b9 100644 --- a/src/block-components/block-div/use-unique-id.js +++ b/src/block-components/block-div/use-unique-id.js @@ -8,13 +8,14 @@ import { useBlockSetAttributesContext } from '~stackable/hooks' */ import { useEffect } from '@wordpress/element' import { useBlockEditContext } from '@wordpress/block-editor' -import { dispatch } from '@wordpress/data' +import { dispatch, useSelect } from '@wordpress/data' export const createUniqueClass = uid => `${ uid.substring( 0, 7 ) }` export const useUniqueId = ( attributes, autoApplyUniqueId = true ) => { const { clientId } = useBlockEditContext() const setAttributes = useBlockSetAttributesContext() + const { getEditorDom } = useSelect( 'stackable/editor-dom' ) // Need to do this when the clientId changes (when a block is // cloned/duplicated). @@ -36,7 +37,8 @@ export const useUniqueId = ( attributes, autoApplyUniqueId = true ) => { } else if ( uniqueClass !== attributes.uniqueId ) { // There should only be one block each with the same unique ID, or // else we'll have styling conflicts. - const els = Array.prototype.filter.call( document.querySelectorAll( `[data-block-id="${ attributes.uniqueId }"]` ), el => { + const blocks = getEditorDom()?.querySelectorAll( `[data-block-id="${ attributes.uniqueId }"]` ) || [] + const els = Array.prototype.filter.call( blocks, el => { // Exclude reusable blocks because they can have the same unique ID. return ! el.closest( '[data-type="core/block"]' ) } ) diff --git a/src/block-components/container-div/edit.js b/src/block-components/container-div/edit.js index 53d0abc7d..077c236ee 100644 --- a/src/block-components/container-div/edit.js +++ b/src/block-components/container-div/edit.js @@ -19,7 +19,6 @@ import { } from '~stackable/components' import { useBlockAttributesContext, - useBlockEl, useBlockSetAttributesContext, } from '~stackable/hooks' @@ -30,15 +29,11 @@ import { __ } from '@wordpress/i18n' export const Edit = props => { const { - sizeSelector = '.stk-container', - borderSelector = '.stk-container', hasContentVerticalAlign = false, } = props const hasContainer = useBlockAttributesContext( attributes => attributes.hasContainer ) const setAttributes = useBlockSetAttributesContext() - const blockElSize = useBlockEl( sizeSelector ) - const blockElBorder = useBlockEl( borderSelector ) return ( <> @@ -53,7 +48,6 @@ export const Edit = props => { > { /> { > diff --git a/src/block-components/helpers/borders/edit.js b/src/block-components/helpers/borders/edit.js index df985c16a..5b6c4a832 100644 --- a/src/block-components/helpers/borders/edit.js +++ b/src/block-components/helpers/borders/edit.js @@ -106,7 +106,6 @@ export const BorderControls = props => { BorderControls.defaultProps = { attrNameTemplate: '%s', - blockEl: null, borderTypeValue: '', // If not supplied, the value from the attribute will be used, otherwise: '' for none, 'solid', 'dashed', 'dotted' hasBorderType: true, hasBorderControls: true, diff --git a/src/block/accordion/block.json b/src/block/accordion/block.json index 718e41338..4582c7ea3 100644 --- a/src/block/accordion/block.json +++ b/src/block/accordion/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/accordion", "title": "Accordion", "description": "A title that your visitors can toggle to view more text. Use as FAQs or multiple ones for an Accordion.", diff --git a/src/block/accordion/edit.js b/src/block/accordion/edit.js index 95242767e..7e8f6d444 100644 --- a/src/block/accordion/edit.js +++ b/src/block/accordion/edit.js @@ -68,6 +68,7 @@ const Edit = props => { const [ isOpen, setIsOpen ] = useState( props.attributes.startOpen ) const { hasInnerBlocks } = useBlockContext() const [ hasInitClickHandler, setHasInitClickHandler ] = useState( false ) + const { getEditorDom } = useSelect( 'stackable/editor-dom' ) const blockAlignmentClass = getAlignmentClasses( props.attributes ) @@ -76,7 +77,7 @@ const Edit = props => { if ( ! hasInitClickHandler ) { return } - const headerEl = document.querySelector( `[data-block="${ clientId }"] [data-type="stackable/column"]` ) + const headerEl = getEditorDom()?.querySelector( `[data-block="${ clientId }"] [data-type="stackable/column"]` ) const onClick = ev => { // Dom't open the accordion if the user is clicking on the icon. if ( ! ev.target.closest( '[data-type="stackable/icon"]' ) ) { @@ -87,7 +88,7 @@ const Edit = props => { return () => { headerEl?.removeEventListener( 'click', onClick ) } - }, [ clientId, isOpen, setIsOpen, hasInitClickHandler ] ) + }, [ clientId, isOpen, setIsOpen, hasInitClickHandler, getEditorDom ] ) // If the className changes (e.g. layout switch), we need to re-apply the // Accordion open/close click handler. @@ -99,7 +100,7 @@ const Edit = props => { // When first adding an accordion, the inner blocks may not be rendered yet, wait for it. if ( ! hasInitClickHandler ) { - const headerEl = document.querySelector( `[data-block="${ clientId }"] [data-type="stackable/column"]` ) + const headerEl = getEditorDom()?.querySelector( `[data-block="${ clientId }"] [data-type="stackable/column"]` ) if ( headerEl ) { setHasInitClickHandler( true ) } diff --git a/src/block/blockquote/block.json b/src/block/blockquote/block.json index b3e943f13..5f10563d5 100644 --- a/src/block/blockquote/block.json +++ b/src/block/blockquote/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/blockquote", "title": "Blockquote", "description": "Display a quote in style", diff --git a/src/block/button-group/block.json b/src/block/button-group/block.json index 93e46907a..838f9adf2 100644 --- a/src/block/button-group/block.json +++ b/src/block/button-group/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/button-group", "title": "Button Group", "description": "Add a customizable button.", diff --git a/src/block/button/block.json b/src/block/button/block.json index a89a314e5..9f79e6974 100644 --- a/src/block/button/block.json +++ b/src/block/button/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/button", "title": "Button", "description": "Add a customizable button.", diff --git a/src/block/call-to-action/block.json b/src/block/call-to-action/block.json index e7b5be11c..1b38094be 100644 --- a/src/block/call-to-action/block.json +++ b/src/block/call-to-action/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/call-to-action", "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.", diff --git a/src/block/card/block.json b/src/block/card/block.json index 8421e8dc3..2025e1f7d 100644 --- a/src/block/card/block.json +++ b/src/block/card/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/card", "title": "Card", "description": "Describe a single subject in a small card. You can use this to describe your product, service or a person.", diff --git a/src/block/carousel/block.json b/src/block/carousel/block.json index 051235aba..d712313c0 100644 --- a/src/block/carousel/block.json +++ b/src/block/carousel/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/carousel", "title": "Carousel", "description": "A carousel slider.", diff --git a/src/block/column/block.json b/src/block/column/block.json index b2f2506d6..4b4a25776 100644 --- a/src/block/column/block.json +++ b/src/block/column/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/column", "title": "Inner Column", "description": "A single column with advanced layout options.", diff --git a/src/block/columns/block.json b/src/block/columns/block.json index 12cf2568e..d68a38da9 100644 --- a/src/block/columns/block.json +++ b/src/block/columns/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/columns", "title": "Columns", "description": "Multiple columns with advanced layout options.", diff --git a/src/block/count-up/block.json b/src/block/count-up/block.json index 810c68fbc..fba299396 100644 --- a/src/block/count-up/block.json +++ b/src/block/count-up/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/count-up", "title": "Count Up", "description": "Showcase your stats. Display how many customers you have or the number of downloads of your app.", diff --git a/src/block/countdown/block.json b/src/block/countdown/block.json index 7110f28e6..a6b6817c7 100644 --- a/src/block/countdown/block.json +++ b/src/block/countdown/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/countdown", "title": "Countdown", "description": "Display a countdown timer on your website.", diff --git a/src/block/design-library/block.json b/src/block/design-library/block.json index 133ca1bf6..cf56eaba9 100644 --- a/src/block/design-library/block.json +++ b/src/block/design-library/block.json @@ -1,4 +1,5 @@ { + "apiVersion": 3, "name": "stackable/design-library", "title": "Design Library", "description": "Choose a layout or block from the Stackable Design Library.", diff --git a/src/block/divider/block.json b/src/block/divider/block.json index 687f8c217..3b28da93d 100644 --- a/src/block/divider/block.json +++ b/src/block/divider/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/divider", "title": "Divider", "description": "Add a pause between your content.", diff --git a/src/block/expand/block.json b/src/block/expand/block.json index 10b9f8057..ed0bcba11 100644 --- a/src/block/expand/block.json +++ b/src/block/expand/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/expand", "title": "Expand / Show More", "description": "Display a small snippet of text. Your readers can toggle it to show more information.", diff --git a/src/block/feature-grid/block.json b/src/block/feature-grid/block.json index da823c4a7..9bd502ae3 100644 --- a/src/block/feature-grid/block.json +++ b/src/block/feature-grid/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/feature-grid", "title": "Feature Grid", "description": "Display multiple product features or services. You can use Feature Grids one after another.", diff --git a/src/block/feature/block.json b/src/block/feature/block.json index 4b976a889..2177137de 100644 --- a/src/block/feature/block.json +++ b/src/block/feature/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/feature", "title": "Feature", "description": "Display a product feature or a service in a large area.", diff --git a/src/block/heading/block.json b/src/block/heading/block.json index e5de0eff1..5a72bd0a6 100644 --- a/src/block/heading/block.json +++ b/src/block/heading/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/heading", "title": "Heading", "description": "Introduce new sections of your content in style.", diff --git a/src/block/hero/block.json b/src/block/hero/block.json index 6f193b092..e7946996b 100644 --- a/src/block/hero/block.json +++ b/src/block/hero/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/hero", "title": "Hero", "description": "A large hero area. Typically used at the very top of a page.", diff --git a/src/block/horizontal-scroller/block.json b/src/block/horizontal-scroller/block.json index 7958497fe..e306971d5 100644 --- a/src/block/horizontal-scroller/block.json +++ b/src/block/horizontal-scroller/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/horizontal-scroller", "title": "Horizontal Scroller", "description": "A slider that scrolls horizontally.", diff --git a/src/block/icon-box/block.json b/src/block/icon-box/block.json index 3fb4879d8..bca7d3200 100644 --- a/src/block/icon-box/block.json +++ b/src/block/icon-box/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/icon-box", "title": "Icon Box", "description": "A small text area with an icon that can be used to summarize features or services", diff --git a/src/block/icon-button/block.json b/src/block/icon-button/block.json index ee7d1053b..10ccb4bf6 100644 --- a/src/block/icon-button/block.json +++ b/src/block/icon-button/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/icon-button", "title": "Icon Button", "description": "Add a customizable button.", diff --git a/src/block/icon-label/block.json b/src/block/icon-label/block.json index 90847c587..8d0df07d5 100644 --- a/src/block/icon-label/block.json +++ b/src/block/icon-label/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/icon-label", "title": "Icon Label", "description": "An Icon and Heading paired together.", diff --git a/src/block/icon-list/block.json b/src/block/icon-list/block.json index af054b7ae..41d9bfa13 100644 --- a/src/block/icon-list/block.json +++ b/src/block/icon-list/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/icon-list", "title": "Icon List", "description": "An unordered list with icons. You can use this as a list of features or benefits.", diff --git a/src/block/icon/block.json b/src/block/icon/block.json index 1b7fe726d..7bd36d9fd 100644 --- a/src/block/icon/block.json +++ b/src/block/icon/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/icon", "title": "Icon", "description": "Pick an icon or upload your own SVG icon to decorate your content.", diff --git a/src/block/image-box/block.json b/src/block/image-box/block.json index 12d99b63e..4cc47bd03 100644 --- a/src/block/image-box/block.json +++ b/src/block/image-box/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/image-box", "title": "Image Box", "description": "Display an image that shows more information when hovered on. Can be used as a fancy link to other pages.", diff --git a/src/block/image/block.json b/src/block/image/block.json index 5165fabf1..f47e4426c 100644 --- a/src/block/image/block.json +++ b/src/block/image/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/image", "title": "Image", "description": "An image with advanced controls to make a visual statement.", diff --git a/src/block/map/block.json b/src/block/map/block.json index 188836895..301f43bf4 100644 --- a/src/block/map/block.json +++ b/src/block/map/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/map", "title": "Map", "description": "Embedded Google Map with advanced controls.", diff --git a/src/block/notification/block.json b/src/block/notification/block.json index e6cc8268d..a7bf51c75 100644 --- a/src/block/notification/block.json +++ b/src/block/notification/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/notification", "title": "Notification", "description": "Show a notice to your readers. People can dismiss the notice to permanently hide it.", diff --git a/src/block/number-box/block.json b/src/block/number-box/block.json index b204e5a0e..6b4d22772 100644 --- a/src/block/number-box/block.json +++ b/src/block/number-box/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/number-box", "title": "Number Box", "description": "Display steps or methods that your users will do in your service.", diff --git a/src/block/posts/block.json b/src/block/posts/block.json index 8df36cdf2..1444a8b65 100644 --- a/src/block/posts/block.json +++ b/src/block/posts/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/posts", "title": "Posts", "description": "Your latest blog posts. Use this to showcase a few of your posts in your landing pages.", diff --git a/src/block/price/block.json b/src/block/price/block.json index adb7f3908..c907c9bbb 100644 --- a/src/block/price/block.json +++ b/src/block/price/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/price", "title": "Price", "description": "Show a price of a product or service with currency and a suffix styled with different weights", diff --git a/src/block/pricing-box/block.json b/src/block/pricing-box/block.json index 2486e43f7..4e4deb83d 100644 --- a/src/block/pricing-box/block.json +++ b/src/block/pricing-box/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/pricing-box", "title": "Pricing Box", "description": "Display the different pricing tiers of your business.", diff --git a/src/block/progress-bar/block.json b/src/block/progress-bar/block.json index 069918d91..13df6f1d8 100644 --- a/src/block/progress-bar/block.json +++ b/src/block/progress-bar/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/progress-bar", "title": "Progress Bar", "description": "Visualize a progress value or percentage in a bar.", diff --git a/src/block/progress-circle/block.json b/src/block/progress-circle/block.json index ab35fa15d..a4e7e9abf 100644 --- a/src/block/progress-circle/block.json +++ b/src/block/progress-circle/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/progress-circle", "title": "Progress Circle", "description": "Visualize a progress value or percentage in a circle.", diff --git a/src/block/separator/block.json b/src/block/separator/block.json index 9dc7cc0de..6d6ea171a 100644 --- a/src/block/separator/block.json +++ b/src/block/separator/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/separator", "title": "Separator", "description": "A fancy separator to be placed between content.", diff --git a/src/block/spacer/block.json b/src/block/spacer/block.json index 101b79802..5bfe52cea 100644 --- a/src/block/spacer/block.json +++ b/src/block/spacer/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/spacer", "title": "Spacer", "description": "Sometimes you just need some space.", diff --git a/src/block/subtitle/block.json b/src/block/subtitle/block.json index efb3a0d1b..0a66cd8c3 100644 --- a/src/block/subtitle/block.json +++ b/src/block/subtitle/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/subtitle", "title": "Subtitle", "description": "Subtitle text that you can add custom styling to from the global settings.", diff --git a/src/block/tab-content/block.json b/src/block/tab-content/block.json index d35c546b1..f7b546fde 100644 --- a/src/block/tab-content/block.json +++ b/src/block/tab-content/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/tab-content", "title": "Tab Content", "description": "A wrapper for tab panels.", diff --git a/src/block/tab-labels/block.json b/src/block/tab-labels/block.json index 59ce026e1..b6623b6c5 100644 --- a/src/block/tab-labels/block.json +++ b/src/block/tab-labels/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/tab-labels", "title": "Tab Labels", "description": "Create interactive navigation within tabs.", diff --git a/src/block/table-of-contents/block.json b/src/block/table-of-contents/block.json index 007349355..3b7263eed 100644 --- a/src/block/table-of-contents/block.json +++ b/src/block/table-of-contents/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/table-of-contents", "title": "Table of Contents", "description": "Automatically generated table of contents based on Heading blocks.", diff --git a/src/block/tabs/block.json b/src/block/tabs/block.json index 9f10a74c0..fdc7e61ef 100644 --- a/src/block/tabs/block.json +++ b/src/block/tabs/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/tabs", "title": "Tabs", "description": "Organize and display content in multiple tabs.", diff --git a/src/block/team-member/block.json b/src/block/team-member/block.json index bb6b12bf2..6c108fd96 100644 --- a/src/block/team-member/block.json +++ b/src/block/team-member/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/team-member", "title": "Team Member", "description": "Display members of your team or your office. Use multiple Team Member blocks if you have a large team.", diff --git a/src/block/testimonial/block.json b/src/block/testimonial/block.json index d86b2495e..5ff892c68 100644 --- a/src/block/testimonial/block.json +++ b/src/block/testimonial/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/testimonial", "title": "Testimonial", "description": "Showcase what your users say about your product or service.", diff --git a/src/block/text/block.json b/src/block/text/block.json index e07940147..3d4e31502 100644 --- a/src/block/text/block.json +++ b/src/block/text/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/text", "title": "Text", "description": "Start with the building block of all page layouts.", diff --git a/src/block/video-popup/block.json b/src/block/video-popup/block.json index 998608dba..958aa6767 100644 --- a/src/block/video-popup/block.json +++ b/src/block/video-popup/block.json @@ -1,5 +1,5 @@ { - "apiVersion": 2, + "apiVersion": 3, "name": "stackable/video-popup", "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.", diff --git a/src/hooks/index.js b/src/hooks/index.js index 6c23d9951..d86e5f326 100644 --- a/src/hooks/index.js +++ b/src/hooks/index.js @@ -10,7 +10,6 @@ export * from './use-saved-default-block-style' export * from './use-font-loader' export * from './use-attribute-edit-handlers' export * from './use-attribute-name' -export * from './use-block-el' export * from './use-linking' export * from './use-block-hover-state' export * from './use-on-screen' diff --git a/src/hooks/use-block-el.js b/src/hooks/use-block-el.js deleted file mode 100644 index 18b55c1c9..000000000 --- a/src/hooks/use-block-el.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Internal dependencies - */ -import { useBlockAttributesContext } from './use-block-attributes-context' - -/** - * WordPress dependencies - */ -import { useMemo } from '@wordpress/element' - -export const useBlockEl = selector => { - const uniqueId = useBlockAttributesContext( attributes => attributes.uniqueId ) - return useMemo( () => new BlockEl( uniqueId, selector ), [ uniqueId, selector ] ) -} - -class BlockEl { - constructor( uniqueId, selector ) { - this.selector = `.stk-${ uniqueId }${ selector ? ' ' + selector : '' }` - } - - el() { - return document.querySelector( this.selector ) - } -}