facebook / lexical-ios

Lexical iOS is an extensible text editor framework that integrates the APIs and philosophies from Lexical Web with a Swift API built on top of TextKit.
MIT License
538 stars 38 forks source link

Ability to handle paste for images in editor #58

Open morajabi opened 8 months ago

morajabi commented 8 months ago

It would be awesome if we could allow use to paste an image (copied from Photos, Safari, etc) and we'd receive the event in a listener. I would like to initiate an image upload when user pastes an image. Is there any workaround for this?

ivailop7 commented 8 months ago

There is already a 'PASTE_COMMAND' that gets fired upon the action, so you can define your handling of images (upload to S3, etc in there)

Edit: Realized it's lexical-ios, not sure if it applies here, but since 'PASTE_COMMAND' is part of the Lexical core, I'd assume this still applies, but haven't worked with this one.

morajabi commented 8 months ago

@ivailop7 Nice, but still I don't get the option to paste when I tap on the lexical editor if I only have image in my pasteboard.

IMG_CCE2BCEF4149-1

ivailop7 commented 8 months ago

I see. Not familiar with the mechanics here. Sorry.