ji-devs / draft-canvas

https://jewish-interactive.github.io/draft-canvas
MIT License
0 stars 0 forks source link

Canvas should be "target" prop #20

Closed dakom closed 6 years ago

dakom commented 6 years ago

Instead of creating its own target canvas, it should be supplied as a prop.

This is conceptually two different different issues consolidated here:

  1. The split-screen demo and display of this canvas should actually be in the example, not the core lib
  2. There should be a new mandatory prop, "target", which must be passed to and be a canvas element

This would allow various use cases and make UI/layout concerns of displaying the canvas the responsibility of the calling app (which could even hide it, or make the UX a 2-step process, etc.)

jpuri commented 6 years ago

@dakom, if it helps I can even pass back reference of the canvas using a callback prop.

dakom commented 6 years ago

That can be expressed via issue #16 - it could pass back both the original and the cropped canvas. Will update that ticket now, thanks!

jpuri commented 6 years ago

Cool 👍 Should we close this one ?

dakom commented 6 years ago

Doesn't seem to me like it's been implemented yet?

Might help to break it down a bit further. There's really two separate issues:

  1. Accepting the canvas as a prop, rather than having DraftCanvas create it
  2. Upon save, sending a new canvas (which will be cropped). This second canvas is generated by DraftCanvas - but the first one is not.
jpuri commented 6 years ago

New property has been added. Here is an example usage: https://github.com/jewish-interactive/draft-canvas/blob/master/example/src/app/App-Main.tsx#L34