PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/Agent/hooks/useSiteVibesOverride.js +4 -1 3.1.5 → trunk View file →
@@ -1,4 +1,5 @@
1 +import { useSiteVibesVariations } from '@agent/hooks/useSiteVibesVariations';
1 2 import { refreshBlockHighlight } from '@agent/lib/block-highlight';
2 3 import { isInEditor } from '@agent/lib/util';
3 4 import { useCallback, useEffect, useRef, useState } from '@wordpress/element';
4 5
@@ -13,12 +14,14 @@
13 14
14 15 // update the CSS so that it won't affect the switcher preview area
15 16 const transformVibeCSS = (css, slug) => css.replaceAll(slug, 'natural-1');
16 17
17 -export const useSiteVibesOverride = ({ css, slug }) => {
18 +export const useSiteVibesOverride = ({ css: vibeCss, slug }) => {
18 19 const blockStyles = useRef(null);
19 20 const [theDocument, setDocument] = useState(null);
20 21 const onEditor = isInEditor();
22 + const { data } = useSiteVibesVariations();
23 + const css = vibeCss ? `${data?.resets?.[slug] ?? ''}${vibeCss}` : vibeCss;
21 24
22 25 useEffect(() => {
23 26 if (!css || onEditor || !slug) return;
24 27 const style = document.getElementById(styleId);