Giter VIP home page Giter VIP logo

Comments (3)

prevwong avatar prevwong commented on May 26, 2024 1

A possible solution would be to check if the prop value is null before trying to access it.

Oops, yeah you're probably right, we should check if the value is null first.

I'm also trying to understand why the null children prop is there to begin with.

Might be because all the Canvas had no child nodes to begin with, or that all child nodes were deleted by the user. Either ways, we should check if the prop is null during serialisation as well.

Thanks for reporting this 💯

from craft.js.

bladepop avatar bladepop commented on May 26, 2024

Hey @prevwong thanks for the super quick reply,
I wanted to update here that we managed to bypass this issue by creating the Canvas with a placeholder span, this causes the children: null prop to disappear from the props object altogether.

Example component:

const ContainerItemComponent = props => {
  const { connectors } = useEditor();

  return (
    <div
      className="field-item"
      key={'static-container-item'}
      ref={ref => connectors.create(ref, <Canvas is={Container}><span></span></Canvas>)}
    >

      <span className="field-item-text">Container</span>
    </div>
  );
}

from craft.js.

khusseini avatar khusseini commented on May 26, 2024

I'm having a similar issue where I cannot drop items into empty containers. I always have to have a placeholder element present to drop something in there.

from craft.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.