As per the image, I would like to add extra style for the table block.
Tag: editor
Gutenberg editor add default WP blocks inside a custom block
I created a simple custom block (adds a <p></p>
wrapper), and while I am inside the block, I want to have ALL (common, formatting etc) blocks available as well. At the moment, I only see RichText options in the toolbar. Is it possible to add an option for ALL blocks instead of nesting them one-by-one?
Getting meta in editor plugin, and event triggering issue
I have a Custom Post Type defined with custom-fields
support. I then registered a meta field.
The first issue is that select( 'core/editor' ).getEditedPostAttribute( 'meta' )._vaenc_actu_roles_scope_roles
always returns undefined
on first call (before being updated by dispatch( 'core/editor' ).editPost
). Also, when I save the Custom post Type the value isn’t modified in the database.
The other issue is, when check any of the checkboxes, on first click, isChecked()
is properly called, on next clicks it doesn’t happen, but updateMeta()
is triggered. If I fold/unfold the control or uncheck a checkbox, all the checkboxes do get updated by calling isChecked()
:
Here is my code:
class Metaboxes extends Base { /** * Setup user. */ public function setup() { add_action('init', [$ this, 'init'] ); } public function init () { register_post_meta( 'vaenc_actu', '_vaenc_actu_roles_scope_roles', [ 'show_in_rest' => true, 'single' => true, 'type' => 'array', 'default' => [], 'auth_callback' => function() { return current_user_can( 'edit_posts' ); } ] ); } }
My javascript is like so:
const {registerPlugin} = wp.plugins; const {PluginDocumentSettingPanel} = wp.editPost; const {PanelBody, CheckboxControl} = wp.components; const {useSelect, select, withSelect, withDispatch} = wp.data; const {Fragment, useState} = wp.element; const {__} = wp.i18n; const {compose} = wp.compose; const RolesControl = ( {isChecked, updateMeta} ) => { return ( <> <Fragment intialOpen={true}> <CheckboxControl label={__( "PRI", "vae" )} checked={isChecked( 'vae-pri' )} onChange={( value ) => updateMeta( 'vae-pri', value )} /> <CheckboxControl label={__( "PRC", "vae" )} checked={isChecked( 'vae-prc' )} onChange={( value ) => updateMeta( 'vae-prc', value )} /> <CheckboxControl label={__( "Certificateurs", "vae" )} checked={isChecked( 'vae-certif' )} onChange={( value ) => updateMeta( 'vae-certif', value )} /> </Fragment> </> ) } const RolesField = compose( [ withSelect( () => { return { actu_scope_meta: select( 'core/editor' ).getEditedPostAttribute( 'meta' )._vaenc_actu_roles_scope_roles, }; } ), withDispatch( ( dispatch ) => ({ isChecked ( prop ) { let meta = select( 'core/editor' ).getEditedPostAttribute( 'meta' )._vaenc_actu_roles_scope_roles; if ( meta ) { return meta.includes( prop ); } return false }, updateMeta ( prop, value ) { let meta = select( 'core/editor' ).getEditedPostAttribute( 'meta' )._vaenc_actu_roles_scope_roles; if ( !meta ) meta = [] if ( meta.includes( prop ) && !value ) { meta = meta.filter( arrayItem => arrayItem !== prop ); } else if ( !meta.includes( prop ) ) { meta.push( prop ); } dispatch( 'core/editor' ).editPost( {meta: {_vaenc_actu_roles_scope_roles: meta}} ); }, }) ), ] )( RolesControl ); const Render = () => { const postType = useSelect( select => select( 'core/editor' ).getCurrentPostType() ); if ( 'vaenc_actu' !== postType ) { return null; } return ( <> <PluginDocumentSettingPanel name="vae-role-scope-sidebar" title={__( 'Restrictions', 'vae' )} > <RolesField/> </PluginDocumentSettingPanel> </> ) } registerPlugin( 'vae-role-scope-sidebar', { render: Render } )
Prevent block from being used in main editor, use only as inner block
I am currently using the allowed_block_type
filter to control the available blocks in my theme, similar to the following example:
function acf_allowed_blocks($ allowed_blocks, $ post) { // Register core blocks $ core_blocks = array( 'core/buttons', 'core/heading', 'core/image', 'core/list', 'core/paragraph', ); // Register custom blocks $ custom_blocks = array( 'acf/test-block', ); // Register plugin specific blocks $ plugin_blocks = array( 'gravityforms/form', ); // Specify block groupings available on specific post types switch ($ post->post_type) { case 'post_type_example': $ allowed_blocks = array_merge($ core_blocks); break; default: $ allowed_blocks = array_merge($ core_blocks, $ custom_blocks, $ plugin_blocks); } return $ allowed_blocks; } add_filter('allowed_block_types', 'acf_allowed_blocks', 10, 2);
While this works perfectly, I am trying to determine whether or not it’s possible to remove the gravityforms/form
block, but allow it inside the acf/test-block
. Currently, if I remove the block from this function, it’s also becomes unavailable as an inner block in my ACF block markup, which looks like this:
$ allowed_blocks = array( 'gravityforms/form' ); echo '<InnerBlocks allowedBlocks="' . esc_attr(wp_json_encode($ allowed_blocks)) . '" />';
Does anyone have any idea on whether or not this is even possible with the current state of Gutenberg? I can just as easily live with it being available as both a main and an inner block, but it would be my preference to only use it as an inner block.
Are lines what differ machine code programming in a text editor from in memory directly?
I understand that at least theoretically a human could do programming with a given type of machine code in a text editor OR in the memory directly somehow.
I also understand that in a (human invented?) computer memory, in each cell, data is sequential, scattered in addresses each of which contains a word in a fixed size which always contain bit/s to a full capacity.
I am not sure what would theoretically differ machine code programming in a text editor from machine code programming in memory directly; perhaps the very usage of lines ("the absence of sequence", I guess) as available in text editors, is the answer.
How do I run LibGDX’s Particle Editor in Netbeans?
I am trying to run the Particle Editor that comes with LibGDX in Netbeans. The gdx-tools-1.9.10.jar
file shows up in my dependencies, and I can see all of the packages and class files inside it:
Normally, when I want to run a file, I open the file by double-clicking it in the "Projects" panel, right click anywhere in the file, and then click the "Run File" option. However, when I use the same process to try to run a class file in gdx-tools, the "Run File" option appears to be grayed out:
I have also tried using the Shift+F6 shortcut, with no effect. Just as a sanity check, I did also make sure that the class file I am trying to run has a main
method:
I have also tried running the Particle Editor from the command line (I’m using Windows). I navigated to the gdx-tools directory using the following command:
cd C:\Users\<user>\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-tools.9.10\<hash>
I then tried to run the Particle Editor using the following command:
java -cp gdx-tools-1.9.10.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor.class
And the result is simply:
Error: Could not find or load main class com.badlogic.gdx.tools.particleeditor.ParticleEditor.class
How do I run the Particle Editor? I would prefer to be able to run it in Netbeans, but I would be happy to get it to run at all. I am using LibGDX 1.9.10, Netbeans 8.2, and Java (JDK and JRE) 8u111 on Windows 10. I installed LibGDX using their setup app found here.
Video Editor Software
Hello guys
Anyone here in this forum knows any video software alternative to Vidnami and Content Samurai, but instead of having monthly fee i can actually buy the software for life?
Thank You guys
Can a game world be made using a 3D editor?
I’m just wondering it it’s possible to create and render a game world in a 3D modelling program, such as Blender, with landscapes and trees and such, and then import it into a game engine? Is that how open world games make their worlds, or do they use another method?
Display custom field under image in TinyMCE editor
I have a custom media field called “Source” with the key media_author
. I would like to display it under the image in the TinyMCE editor, like the caption field is:
The caption field is editable, but that’s not necessary for what I want to add. I found this code in /wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
. It looks like it’s part of how the caption is displayed.
return '<div class="mceTemp"><dl id="' + id + '" class="wp-caption ' + align + classes + '" style="width: ' + width + 'px">' + '<dt class="wp-caption-dt">'+ img +'</dt><dd class="wp-caption-dd">'+ caption +'</dd></dl></div>';
How to enable the option “edit physics shape” in the Sprite Editor?
I can successfully import .png
files, create tilesets, and use them in my tilemaps in Unity. Thanks to DMGregory, I just learned that there exists an option to customize the Tilemap Collider 2D
in the Sprite Editor
, which allows me to set a custom collider for every tile instead of going through them one by one.
The steps I follow while creating a tileset in Unity is as follows.
- Import the
.png
file. - Open the Sprite Editor.
- Select the option
Multiple
forSprite Mode
. - Select
Slice
from the Sprite Editor.
Then, I create a Tile Palette
in a folder, drop and drag my created tiles, and start creating my level.
I have never encountered the option to modify the colliders tile by tile. What am I doing wrong?