/** * WordPress dependencies */ import type { dispatch as Dispatch, select as Select, } from '@safe-wordpress/data'; /* eslint-disable */ const parent = window.parent as any; const dispatch = parent.wp.data.dispatch as typeof Dispatch; const select = parent.wp.data.select as typeof Select; /* eslint-enable */ // NOTE. No @nab packages in front. import type { store as dataStore } from '@nab/data'; const NAB_DATA = 'nab/data' as unknown as typeof dataStore; export function markTestPreviewAsActive( active: boolean ): void { const editor = select( NAB_DATA ).getPageAttribute( 'css-editor/cssEditorState' ); if ( ! editor ) { return; } void dispatch( NAB_DATA ).setPageAttribute( 'css-editor/cssEditorState', { ...editor, isPreviewInScope: active, } ); }