Forum Replies Created

Viewing 25 posts - 176 through 200 (of 475 total)
  • Author
    Posts
  • in reply to: isSelected and InspectorControls #46890
    Zac Gordon
    Keymaster

    That is correct! isSelected is no longer needed for toolbars or inspector controls 🙂

    I will add some notes to the course pages about this next week. Great catch!

    in reply to: New Blocks not available in new plugin #46888
    Zac Gordon
    Keymaster

    Sometimes how it goes 🙂 please post up if you have troubles again!

    in reply to: RichText move to editor #46886
    Zac Gordon
    Keymaster

    That is correct! It may still be backwards compatible for a time but that is correct moving forward 🙂

    I will add some notes to the videos next week 🙂

    in reply to: Code Editor #45633
    Zac Gordon
    Keymaster

    Nice! Thanks for posting updates about this! Hope you can get it easily working now ::

    Zac Gordon
    Keymaster

    I would check out the 1st and 2nd suggestions here for a discussion on this… like I said, not really a nice elegant solution unfortunately (that I’ve seen)

    https://stackoverflow.com/questions/28365233/inline-css-styles-in-react-how-to-implement-ahover

    Zac Gordon
    Keymaster

    What’s the specific use case you’re trying to do? There may be another appropriate works around native JS limitations on adding pseudo classes on the fly.

    in reply to: Dynamic block not showing in frontend #45412
    Zac Gordon
    Keymaster

    Sorry about that. That was not correct, you can remove that.

    Hmm, not seeing what the problem is. My suggestion is start with the working block example again and work through the steps of converting to your own block to see where it went wrong.

    in reply to: Enqueueing block assets #45409
    Zac Gordon
    Keymaster

    I believe these docs are outdated.

    The approach of registering the block on the server side is still being evolved, so I think it’s better and more flexible (and following existing WP conventions) to use enqueue_block_editor_assets and enqueue_block_assets but both approaches should still work I believe.

    in reply to: Dynamic block not showing in frontend #45355
    Zac Gordon
    Keymaster

    You have to enable rest api for your custom post type. This has to go somewhere in your code:

    
      register_meta( 'post', 'subheading', [
          'show_in_rest' => true,
      ] );
    

    That should be it

    in reply to: Error in #45210
    Zac Gordon
    Keymaster

    Okay so like it says you can’t do this:

    
    <div>1</div>
    <div>2</div>
    

    And have to have a single element returned like this:

    
    <div>
      <div>1</div>
      <div>2</div>
    </div>
    

    I think I see an example of this in your save method. There might be another instance but that is the situation you are looking for 🙂

    Hope that helps!

    in reply to: Content Requests #45087
    Zac Gordon
    Keymaster

    Hi Ebonie! Thank you for this suggestion!!! I have plans to do both of these hopefully once the course has become finalized. With having to do multiple revisions of the course and the cost of transcripts I unfortunately haven’t been able to do yet, but totally plan and hope to! Thank you for the spot on suggestion!!!

    in reply to: Inspector controls inside dynamic block #45036
    Zac Gordon
    Keymaster

    Okay, so this line here is actually taking props and destructuring it.

    
      } )( ( { attributes, posts, className, isSelected, setAttributes, RadioControl } ) => {
    

    You could instead just let props be passed down instead of destructuring it here and update your other code to props.posts etc or you can just pass down the specific things you need into the inspector rather than passing all of props.

    The other thing to mention here is that if changes in the inspector settings change the API request it will redraw the entire block and inspector, which is annoying.

    If you look at the core latest posts block you’ll see its much more complex. I have talked with a core dev about how to improve this and will likely have an example not using withAPIData and rather making the API call using some other options they are working on adding. This isn’t ready quite yet, but you can look at this example from V1 of the course for an alternative approach to withAPIData:

    https://github.com/zgordon/gutenberg-course/tree/v1/jsforwp-blocks/blocks/examples/13-dynamic-alt

    Hope that helps!

    in reply to: Conditional statements before/on save #44946
    Zac Gordon
    Keymaster

    Yup! Checkout that link on JSX conditionals for how to code without an else statement.

    Looks something like this (untested but something like this)

    
    { !isEmpty && ( <a href={ url }>
     { text }
    </a> ) }
    

    Hope that helps!!!

    in reply to: Conditional statements before/on save #44937
    Zac Gordon
    Keymaster

    Cool. If you set a default value for that attribute to be an empty string it should solve that problem 🙂

    in reply to: Conditional statements before/on save #44931
    Zac Gordon
    Keymaster

    Check the console log for the specific error

    in reply to: Conditional statements before/on save #44925
    Zac Gordon
    Keymaster

    Okay, I added an example block example to the repo called “11-url-input-conditional” that should give you a head start.

    https://github.com/zgordon/gutenberg-course/tree/master/jsforwp-example-blocks/blocks/11-url-input-conditional

    Might also want to explore this page a little bit on conditional logic in JSX 🙂

    https://reactjs.org/docs/conditional-rendering.html

    Hope that helps!

    in reply to: Conditional statements before/on save #44913
    Zac Gordon
    Keymaster

    Try taking a look at the URL Input example as a possible guide? You can see if that type of conditional statement could also be used in the save function.

    in reply to: Getting the colour value from ColorPalette #44897
    Zac Gordon
    Keymaster

    Nice! Most likely using the style attribute on an element 👍

    in reply to: 08-form-fields error adding block #44895
    Zac Gordon
    Keymaster

    Hi Steve!

    Just posted a patch that should resolve the issue. Looks like was just missing destructuring isSelected. Please let me know how it goes for you now.

    You may also want to update to Gutenberg 2.6.0 👍

    Thanks for this catch! Let me know if you have any issues still.

    in reply to: Broken inspector fields block #44785
    Zac Gordon
    Keymaster

    Okay, I was totally looking in the wrong place. I believe the error came from an issue with some wp.date library stuff I was playing with and broke with 2.6.

    I am *hoping* that everything works properly for you now!

    in reply to: Error in #44772
    Zac Gordon
    Keymaster

    Hey David,

    Do you mind trying to format this code a bit so can help you try to spot the error? Can put in a code block or use single backtick before and after 🙂

    
    Code
    

    I don’t know if I cover Fragments in this course. I do cover them in my JS course.

    Let’s get this formated or put in a gist and we’ll get fixed.

    in reply to: Gutenberg Development Course Video Not Displaying #44732
    Zac Gordon
    Keymaster

    Yup!

    I will keep everything up to date and will likely add a few more examples.

    If there is anything specific you’d like to see please post it up to the Content Request thread 🙂

    Yeah I think a lot of people will continue to take the ACF approach over GB for some content, especially for existing sites

    Zac Gordon
    Keymaster

    Hey folks! This is a delayed update but all these code samples should be fixed now!

    Zac Gordon
    Keymaster

    Nice! Good catch 🙂

    in reply to: offline availability #44704
    Zac Gordon
    Keymaster

    Hey there!

    At this time the videos are only available streaming on the site. Sorry for the inconvenience!

Viewing 25 posts - 176 through 200 (of 475 total)