Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@wordpress/block-library
Advanced tools
Block library for the WordPress editor.
Install the module
npm install @wordpress/block-library --save
This package assumes that your code will run in an ES2015+ environment. If you're using an environment that has limited or no support for such language features and APIs, you should include the polyfill shipped in @wordpress/babel-preset-default
in your code.
If a view.js
file is present in the block's directory, this file will be built along other assets, making it available to load from the browser.
This enables us to, for instance, load this file when the block is present on the page in two ways:
render_callback
:function render_block_my_block() {
$script_path = __DIR__ . '/my-block/view.js';
if ( file_exists( $script_path ) ) {
wp_enqueue_script(
'wp-block-my-block-view',
plugins_url( 'view.js', $script_path ),
array(),
false,
true
);
}
}
function register_block_my_block() {
register_block_type(
__DIR__ . '/my-block',
array(
'render_callback' => 'render_block_my_block',
)
);
}
add_action( 'init', 'register_block_my_block' );
render_block
filter:function render_block_my_block() {
$script_path = __DIR__ . '/my-block/view.js';
if ( file_exists( $script_path ) ) {
wp_enqueue_script(
'wp-block-my-block-view',
plugins_url( 'view.js', $script_path ),
array(),
false,
true
);
}
}
apply_filter( 'render_block', 'render_block_my_block' );
Function to register core blocks provided by the block editor.
Usage
import { registerCoreBlocks } from '@wordpress/block-library';
registerCoreBlocks();
Parameters
Array
: An optional array of the core blocks being registered.FAQs
Block library for the WordPress editor.
The npm package @wordpress/block-library receives a total of 19,465 weekly downloads. As such, @wordpress/block-library popularity was classified as popular.
We found that @wordpress/block-library demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.